Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

puppet: Factor out $::architecture case statement for golang.

Alex Vandiver788daa953b1c
diff --git a/puppet/zulip/manifests/common.pp b/puppet/zulip/manifests/common.pp
index 936398a557b..c86188ca518 100644
--- a/puppet/zulip/manifests/common.pp
+++ b/puppet/zulip/manifests/common.pp
@@ -33,6 +33,11 @@ class zulip::common {
$total_memory_mb = Integer($::memorysize_mb)
+ $goarch = $::architecture ? {
+ 'amd64' => 'amd64',
+ 'aarch64' => 'arm64',
+ }
+
$versions = {
# https://github.com/cactus/go-camo/releases
'go-camo' => {
diff --git a/puppet/zulip_ops/manifests/profile/grafana.pp b/puppet/zulip_ops/manifests/profile/grafana.pp
index b612c0ba1d6..5621db1455d 100644
--- a/puppet/zulip_ops/manifests/profile/grafana.pp
+++ b/puppet/zulip_ops/manifests/profile/grafana.pp
@@ -4,10 +4,6 @@ class zulip_ops::profile::grafana {
include zulip_ops::profile::base
include zulip::supervisor
- $arch = $::architecture ? {
- 'amd64' => 'amd64',
- 'aarch64' => 'arm64',
- }
$version = $zulip::common::versions['grafana']['version']
$dir = "/srv/zulip-grafana-${version}"
$bin = "${dir}/bin/grafana-server"
@@ -15,7 +11,7 @@ class zulip_ops::profile::grafana {
zulip::external_dep { 'grafana':
version => $version,
- url => "https://dl.grafana.com/oss/release/grafana-${version}.linux-${arch}.tar.gz",
+ url => "https://dl.grafana.com/oss/release/grafana-${version}.linux-${zulip::common::goarch}.tar.gz",
tarball_prefix => "grafana-${version}",
}
diff --git a/puppet/zulip_ops/manifests/profile/prometheus_server.pp b/puppet/zulip_ops/manifests/profile/prometheus_server.pp
index a0e3174347c..104fdaa18b1 100644
--- a/puppet/zulip_ops/manifests/profile/prometheus_server.pp
+++ b/puppet/zulip_ops/manifests/profile/prometheus_server.pp
@@ -6,10 +6,6 @@ class zulip_ops::profile::prometheus_server {
include zulip_ops::profile::base
include zulip_ops::prometheus::base
- $arch = $::architecture ? {
- 'amd64' => 'amd64',
- 'aarch64' => 'arm64',
- }
$version = $zulip::common::versions['prometheus']['version']
$dir = "/srv/zulip-prometheus-${version}"
$bin = "${dir}/prometheus"
@@ -17,8 +13,8 @@ class zulip_ops::profile::prometheus_server {
zulip::external_dep { 'prometheus':
version => $version,
- url => "https://github.com/prometheus/prometheus/releases/download/v${version}/prometheus-${version}.linux-${arch}.tar.gz",
- tarball_prefix => "prometheus-${version}.linux-${arch}",
+ url => "https://github.com/prometheus/prometheus/releases/download/v${version}/prometheus-${version}.linux-${zulip::common::goarch}.tar.gz",
+ tarball_prefix => "prometheus-${version}.linux-${zulip::common::goarch}",
}
file { '/usr/local/bin/promtool':
ensure => 'link',
diff --git a/puppet/zulip_ops/manifests/prometheus/node.pp b/puppet/zulip_ops/manifests/prometheus/node.pp
index ffa9425173d..51403067369 100644
--- a/puppet/zulip_ops/manifests/prometheus/node.pp
+++ b/puppet/zulip_ops/manifests/prometheus/node.pp
@@ -4,18 +4,14 @@ class zulip_ops::prometheus::node {
include zulip_ops::prometheus::base
include zulip::supervisor
- $arch = $::architecture ? {
- 'amd64' => 'amd64',
- 'aarch64' => 'arm64',
- }
$version = $zulip::common::versions['node_exporter']['version']
$dir = "/srv/zulip-node_exporter-${version}"
$bin = "${dir}/node_exporter"
zulip::external_dep { 'node_exporter':
version => $version,
- url => "https://github.com/prometheus/node_exporter/releases/download/v${version}/node_exporter-${version}.linux-${arch}.tar.gz",
- tarball_prefix => "node_exporter-${version}.linux-${arch}",
+ url => "https://github.com/prometheus/node_exporter/releases/download/v${version}/node_exporter-${version}.linux-${zulip::common::goarch}.tar.gz",
+ tarball_prefix => "node_exporter-${version}.linux-${zulip::common::goarch}",
}
# This was moved to an external_dep in 2021/12, and these lines can
diff --git a/puppet/zulip_ops/manifests/prometheus/uwsgi.pp b/puppet/zulip_ops/manifests/prometheus/uwsgi.pp
index f7645a10a8b..5280d88e839 100644
--- a/puppet/zulip_ops/manifests/prometheus/uwsgi.pp
+++ b/puppet/zulip_ops/manifests/prometheus/uwsgi.pp
@@ -4,14 +4,11 @@ class zulip_ops::prometheus::uwsgi {
$version = $zulip::common::versions['uwsgi_exporter']['version']
$dir = "/srv/zulip-uwsgi_exporter-${version}"
$bin = "${dir}/uwsgi_exporter"
- $arch = $::architecture ? {
- 'amd64' => 'amd64',
- 'aarch64' => 'arm64',
- }
+
zulip::external_dep { 'uwsgi_exporter':
version => $version,
- url => "https://github.com/timonwong/uwsgi_exporter/releases/download/v${version}/uwsgi_exporter-${version}.linux-${arch}.tar.gz",
- tarball_prefix => "uwsgi_exporter-${version}.linux-${arch}",
+ url => "https://github.com/timonwong/uwsgi_exporter/releases/download/v${version}/uwsgi_exporter-${version}.linux-${zulip::common::goarch}.tar.gz",
+ tarball_prefix => "uwsgi_exporter-${version}.linux-${zulip::common::goarch}",
}
zulip_ops::firewall_allow { 'uwsgi_exporter': port => '9238' }