puppet: Centralize versions and sha256 hashes of external dependencies.

This will make it easier to update versions of these dependencies.
This commit is contained in:
Alex Vandiver
2021-12-28 02:00:14 +00:00
committed by Tim Abbott
parent 74b804880e
commit f166f9f7d6
9 changed files with 83 additions and 16 deletions

View File

@@ -6,14 +6,13 @@ class zulip::camo (String $listen_address = '0.0.0.0') {
ensure => 'purged', ensure => 'purged',
} }
$version = '2.3.0' $version = $zulip::common::versions['go-camo']['version']
$dir = "/srv/zulip-go-camo-${version}" $dir = "/srv/zulip-go-camo-${version}"
$bin = "${dir}/bin/go-camo" $bin = "${dir}/bin/go-camo"
zulip::external_dep { 'go-camo': zulip::external_dep { 'go-camo':
version => $version, version => $version,
url => "https://github.com/cactus/go-camo/releases/download/v${version}/go-camo-${version}.go1171.linux-${::architecture}.tar.gz", url => "https://github.com/cactus/go-camo/releases/download/v${version}/go-camo-${version}.go1171.linux-${::architecture}.tar.gz",
sha256 => '965506e6edb9d974c810519d71e847afb7ca69d1d01ae7d8be6d7a91de669c0c',
tarball_prefix => "go-camo-${version}", tarball_prefix => "go-camo-${version}",
} }

View File

@@ -32,4 +32,64 @@ class zulip::common {
$supervisor_conf_dir = "${supervisor_system_conf_dir}/zulip" $supervisor_conf_dir = "${supervisor_system_conf_dir}/zulip"
$total_memory_mb = Integer($::memorysize_mb) $total_memory_mb = Integer($::memorysize_mb)
$versions = {
# https://github.com/cactus/go-camo/releases
'go-camo' => {
'version' => '2.3.0',
'sha256' => {
'amd64' => '965506e6edb9d974c810519d71e847afb7ca69d1d01ae7d8be6d7a91de669c0c',
},
},
# https://go.dev/dl/
'golang' => {
'version' => '1.17.3',
'sha256' => {
'amd64' => '550f9845451c0c94be679faf116291e7807a8d78b43149f9506c1b15eb89008c',
},
},
# https://github.com/stripe/smokescreen/tags
'smokescreen-src' => {
'version' => 'dc403015f563eadc556a61870c6ad327688abe88',
# Source code, so arch-invariant sha256
'sha256' => 'ad4b181d14adcd9425045152b903a343dbbcfcad3c1e7625d2c65d1d50e1959d',
},
# https://github.com/wal-g/wal-g/releases
'wal-g' => {
'version' => '1.1.1-rc',
'sha256' => {
'amd64' => 'eed4de63c2657add6e0fe70f8c0fbe62a4a54405b9bfc801b1912b6c4f2c7107',
},
},
### zulip_ops packages
# https://grafana.com/grafana/download?edition=oss
'grafana' => {
'version' => '8.3.2',
'sha256' => {
'amd64' => '100f92c50aa612f213052c55594e58b68b7da641b751c5f144003d704730d189',
},
},
# https://prometheus.io/download/#node_exporter
'node_exporter' => {
'version' => '8.3.2',
'sha256' => {
'amd64' => '8c1f6a317457a658e0ae68ad710f6b4098db2cad10204649b51e3c043aa3e70d',
},
},
# https://prometheus.io/download/#prometheus
'prometheus' => {
'version' => '2.27.1',
'sha256' => {
'amd64' => 'ce637d0167d5e6d2561f3bd37e1c58fe8601e13e4e1ea745653c068f6e1317ae',
},
},
}
} }

View File

@@ -1,15 +1,29 @@
define zulip::external_dep( define zulip::external_dep(
String $version, String $version,
String $sha256,
String $url, String $url,
String $tarball_prefix, String $tarball_prefix,
String $sha256 = '',
) { ) {
if $sha256 == '' {
if $zulip::common::versions[$title]['sha256'] =~ Hash {
$sha256_filled = $zulip::common::versions[$title]['sha256'][$::architecture]
if $sha256_filled == undef {
err("No sha256 found for ${title} for architecture ${::architecture}")
fail()
}
} else {
# For things like source code which are arch-invariant
$sha256_filled = $zulip::common::versions[$title]['sha256']
}
} else {
$sha256_filled = $sha256
}
$dir = "/srv/zulip-${title}-${version}" $dir = "/srv/zulip-${title}-${version}"
zulip::sha256_tarball_to { $title: zulip::sha256_tarball_to { $title:
url => $url, url => $url,
sha256 => $sha256, sha256 => $sha256_filled,
install => { install => {
$tarball_prefix => $dir, $tarball_prefix => $dir,
}, },

View File

@@ -1,7 +1,7 @@
# @summary go compiler and tools # @summary go compiler and tools
# #
class zulip::golang { class zulip::golang {
$version = '1.17.3' $version = $zulip::common::versions['golang']['version']
$dir = "/srv/zulip-golang-${version}" $dir = "/srv/zulip-golang-${version}"
$bin = "${dir}/bin/go" $bin = "${dir}/bin/go"
@@ -9,7 +9,6 @@ class zulip::golang {
zulip::external_dep { 'golang': zulip::external_dep { 'golang':
version => $version, version => $version,
url => "https://golang.org/dl/go${version}.linux-${::architecture}.tar.gz", url => "https://golang.org/dl/go${version}.linux-${::architecture}.tar.gz",
sha256 => '550f9845451c0c94be679faf116291e7807a8d78b43149f9506c1b15eb89008c',
tarball_prefix => 'go', tarball_prefix => 'go',
} }
} }

View File

@@ -3,7 +3,7 @@
class zulip::postgresql_backups { class zulip::postgresql_backups {
include zulip::postgresql_common include zulip::postgresql_common
$wal_g_version = '1.1.1-rc' $wal_g_version = $zulip::common::versions['wal-g']['version']
$bin = "/srv/zulip-wal-g-${wal_g_version}" $bin = "/srv/zulip-wal-g-${wal_g_version}"
$package = "wal-g-pg-ubuntu-20.04-${::architecture}" $package = "wal-g-pg-ubuntu-20.04-${::architecture}"
@@ -11,7 +11,6 @@ class zulip::postgresql_backups {
zulip::external_dep { 'wal-g': zulip::external_dep { 'wal-g':
version => $wal_g_version, version => $wal_g_version,
url => "https://github.com/wal-g/wal-g/releases/download/v${wal_g_version}/${package}.tar.gz", url => "https://github.com/wal-g/wal-g/releases/download/v${wal_g_version}/${package}.tar.gz",
sha256 => 'eed4de63c2657add6e0fe70f8c0fbe62a4a54405b9bfc801b1912b6c4f2c7107',
tarball_prefix => $package, tarball_prefix => $package,
} }
file { '/usr/local/bin/wal-g': file { '/usr/local/bin/wal-g':

View File

@@ -2,14 +2,13 @@ class zulip::smokescreen {
include zulip::supervisor include zulip::supervisor
include zulip::golang include zulip::golang
$version = 'dc403015f563eadc556a61870c6ad327688abe88' $version = $zulip::common::versions['smokescreen-src']['version']
$dir = "/srv/zulip-smokescreen-src-${version}" $dir = "/srv/zulip-smokescreen-src-${version}"
$bin = "/usr/local/bin/smokescreen-${version}-go-${zulip::golang::version}" $bin = "/usr/local/bin/smokescreen-${version}-go-${zulip::golang::version}"
zulip::external_dep { 'smokescreen-src': zulip::external_dep { 'smokescreen-src':
version => $version, version => $version,
url => "https://github.com/stripe/smokescreen/archive/${version}.tar.gz", url => "https://github.com/stripe/smokescreen/archive/${version}.tar.gz",
sha256 => 'ad4b181d14adcd9425045152b903a343dbbcfcad3c1e7625d2c65d1d50e1959d',
tarball_prefix => "smokescreen-${version}", tarball_prefix => "smokescreen-${version}",
} }

View File

@@ -4,7 +4,7 @@ class zulip_ops::profile::grafana {
include zulip_ops::profile::base include zulip_ops::profile::base
include zulip::supervisor include zulip::supervisor
$version = '8.3.2' $version = $zulip::common::versions['grafana']['version']
$dir = "/srv/zulip-grafana-${version}" $dir = "/srv/zulip-grafana-${version}"
$bin = "${dir}/bin/grafana-server" $bin = "${dir}/bin/grafana-server"
$data_dir = '/var/lib/grafana' $data_dir = '/var/lib/grafana'
@@ -12,7 +12,6 @@ class zulip_ops::profile::grafana {
zulip::external_dep { 'grafana': zulip::external_dep { 'grafana':
version => $version, version => $version,
url => "https://dl.grafana.com/oss/release/grafana-${version}.linux-${::architecture}.tar.gz", url => "https://dl.grafana.com/oss/release/grafana-${version}.linux-${::architecture}.tar.gz",
sha256 => '100f92c50aa612f213052c55594e58b68b7da641b751c5f144003d704730d189',
tarball_prefix => "grafana-${version}", tarball_prefix => "grafana-${version}",
} }

View File

@@ -6,7 +6,7 @@ class zulip_ops::profile::prometheus_server {
include zulip_ops::profile::base include zulip_ops::profile::base
include zulip_ops::prometheus::base include zulip_ops::prometheus::base
$version = '2.27.1' $version = $zulip::common::versions['prometheus']['version']
$dir = "/srv/zulip-prometheus-${version}" $dir = "/srv/zulip-prometheus-${version}"
$bin = "${dir}/prometheus" $bin = "${dir}/prometheus"
$data_dir = '/var/lib/prometheus' $data_dir = '/var/lib/prometheus'
@@ -14,7 +14,6 @@ class zulip_ops::profile::prometheus_server {
zulip::external_dep { 'prometheus': zulip::external_dep { 'prometheus':
version => $version, version => $version,
url => "https://github.com/prometheus/prometheus/releases/download/v${version}/prometheus-${version}.linux-${::architecture}.tar.gz", url => "https://github.com/prometheus/prometheus/releases/download/v${version}/prometheus-${version}.linux-${::architecture}.tar.gz",
sha256 => 'ce637d0167d5e6d2561f3bd37e1c58fe8601e13e4e1ea745653c068f6e1317ae',
tarball_prefix => "prometheus-${version}.linux-${::architecture}", tarball_prefix => "prometheus-${version}.linux-${::architecture}",
} }
file { '/usr/local/bin/promtool': file { '/usr/local/bin/promtool':

View File

@@ -4,14 +4,13 @@ class zulip_ops::prometheus::node {
include zulip_ops::prometheus::base include zulip_ops::prometheus::base
include zulip::supervisor include zulip::supervisor
$version = '1.1.2' $version = $zulip::common::versions['node_exporter']['version']
$dir = "/srv/zulip-node_exporter-${version}" $dir = "/srv/zulip-node_exporter-${version}"
$bin = "${dir}/node_exporter" $bin = "${dir}/node_exporter"
zulip::external_dep { 'node_exporter': zulip::external_dep { 'node_exporter':
version => $version, version => $version,
url => "https://github.com/prometheus/node_exporter/releases/download/v${version}/node_exporter-${version}.linux-${::architecture}.tar.gz", url => "https://github.com/prometheus/node_exporter/releases/download/v${version}/node_exporter-${version}.linux-${::architecture}.tar.gz",
sha256 => '8c1f6a317457a658e0ae68ad710f6b4098db2cad10204649b51e3c043aa3e70d',
tarball_prefix => "node_exporter-${version}.linux-${::architecture}", tarball_prefix => "node_exporter-${version}.linux-${::architecture}",
} }