Skip to content

Commit

Permalink
Make gobetween.sh universal across different OS
Browse files Browse the repository at this point in the history
Signed-off-by: Artiom Diomin <[email protected]>
  • Loading branch information
kron4eg committed Jun 13, 2019
1 parent eb1f421 commit 4b29115
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 38 deletions.
27 changes: 15 additions & 12 deletions examples/terraform/hetzner/gobetween.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@
# This script is mostly used in CI
# It installs dependencies and starts the tests

set -xe
set -euf -o pipefail

GOBETWEEN_VERSION=0.7.0

mkdir /tmp/gobetween
cd /tmp/gobetween
curl -L -o gobetween_0.7.0_linux_amd64.tar.gz \
https://github.com/yyyar/gobetween/releases/download/0.7.0/gobetween_0.7.0_linux_amd64.tar.gz
tar xvf gobetween_0.7.0_linux_amd64.tar.gz
mv gobetween /usr/local/sbin/gobetween
chown root:root /usr/local/sbin/gobetween

cat <<EOF > /etc/systemd/system/gobetween.service
curl -L -o gobetween_${GOBETWEEN_VERSION}_linux_amd64.tar.gz \
https://github.com/yyyar/gobetween/releases/download/${GOBETWEEN_VERSION}/gobetween_${GOBETWEEN_VERSION}_linux_amd64.tar.gz
tar xvf gobetween_${GOBETWEEN_VERSION}_linux_amd64.tar.gz
sudo mkdir -p /opt/bin
sudo mv gobetween /opt/bin/gobetween
sudo chown root:root /opt/bin/gobetween

cat <<EOF | sudo tee /etc/systemd/system/gobetween.service
[Unit]
Description=Gobetween - modern LB for cloud era
Documentation=https://github.com/yyyar/gobetween/wiki
Expand All @@ -36,7 +39,7 @@ After=network.target remote-fs.target nss-lookup.target
[Service]
Type=simple
PIDFile=/run/gobetween.pid
ExecStart=/usr/local/sbin/gobetween -c /etc/gobetween.toml
ExecStart=/opt/bin/gobetween -c /etc/gobetween.toml
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
Expand All @@ -47,6 +50,6 @@ Group=nogroup
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl enable gobetween.service
systemctl start gobetween.service
sudo systemctl daemon-reload
sudo systemctl enable gobetween.service
sudo systemctl start gobetween.service
17 changes: 10 additions & 7 deletions examples/terraform/openstack/gobetween.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@
# This script is mostly used in CI
# It installs dependencies and starts the tests

set -xe
set -euf -o pipefail

GOBETWEEN_VERSION=0.7.0

mkdir /tmp/gobetween
cd /tmp/gobetween
curl -L -o gobetween_0.7.0_linux_amd64.tar.gz \
https://github.com/yyyar/gobetween/releases/download/0.7.0/gobetween_0.7.0_linux_amd64.tar.gz
tar xvf gobetween_0.7.0_linux_amd64.tar.gz
sudo mv gobetween /usr/local/sbin/gobetween
sudo chown root:root /usr/local/sbin/gobetween
curl -L -o gobetween_${GOBETWEEN_VERSION}_linux_amd64.tar.gz \
https://github.com/yyyar/gobetween/releases/download/${GOBETWEEN_VERSION}/gobetween_${GOBETWEEN_VERSION}_linux_amd64.tar.gz
tar xvf gobetween_${GOBETWEEN_VERSION}_linux_amd64.tar.gz
sudo mkdir -p /opt/bin
sudo mv gobetween /opt/bin/gobetween
sudo chown root:root /opt/bin/gobetween

cat <<EOF | sudo tee /etc/systemd/system/gobetween.service
[Unit]
Expand All @@ -36,7 +39,7 @@ After=network.target remote-fs.target nss-lookup.target
[Service]
Type=simple
PIDFile=/run/gobetween.pid
ExecStart=/usr/local/sbin/gobetween -c /etc/gobetween.toml
ExecStart=/opt/bin/gobetween -c /etc/gobetween.toml
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
Expand Down
27 changes: 15 additions & 12 deletions examples/terraform/packet/gobetween.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@
# This script is mostly used in CI
# It installs dependencies and starts the tests

set -xe
set -euf -o pipefail

GOBETWEEN_VERSION=0.7.0

mkdir /tmp/gobetween
cd /tmp/gobetween
curl -L -o gobetween_0.7.0_linux_amd64.tar.gz \
https://github.com/yyyar/gobetween/releases/download/0.7.0/gobetween_0.7.0_linux_amd64.tar.gz
tar xvf gobetween_0.7.0_linux_amd64.tar.gz
mv gobetween /usr/local/sbin/gobetween
chown root:root /usr/local/sbin/gobetween

cat <<EOF > /etc/systemd/system/gobetween.service
curl -L -o gobetween_${GOBETWEEN_VERSION}_linux_amd64.tar.gz \
https://github.com/yyyar/gobetween/releases/download/${GOBETWEEN_VERSION}/gobetween_${GOBETWEEN_VERSION}_linux_amd64.tar.gz
tar xvf gobetween_${GOBETWEEN_VERSION}_linux_amd64.tar.gz
sudo mkdir -p /opt/bin
sudo mv gobetween /opt/bin/gobetween
sudo chown root:root /opt/bin/gobetween

cat <<EOF | sudo tee /etc/systemd/system/gobetween.service
[Unit]
Description=Gobetween - modern LB for cloud era
Documentation=https://github.com/yyyar/gobetween/wiki
Expand All @@ -36,7 +39,7 @@ After=network.target remote-fs.target nss-lookup.target
[Service]
Type=simple
PIDFile=/run/gobetween.pid
ExecStart=/usr/local/sbin/gobetween -c /etc/gobetween.toml
ExecStart=/opt/bin/gobetween -c /etc/gobetween.toml
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
Expand All @@ -47,6 +50,6 @@ Group=nogroup
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl enable gobetween.service
systemctl start gobetween.service
sudo systemctl daemon-reload
sudo systemctl enable gobetween.service
sudo systemctl start gobetween.service
17 changes: 10 additions & 7 deletions examples/terraform/vsphere/gobetween.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@
# This script is mostly used in CI
# It installs dependencies and starts the tests

set -xe
set -euf -o pipefail

GOBETWEEN_VERSION=0.7.0

mkdir /tmp/gobetween
cd /tmp/gobetween
curl -L -o gobetween_0.7.0_linux_amd64.tar.gz \
https://github.com/yyyar/gobetween/releases/download/0.7.0/gobetween_0.7.0_linux_amd64.tar.gz
tar xvf gobetween_0.7.0_linux_amd64.tar.gz
sudo mv gobetween /usr/local/sbin/gobetween
sudo chown root:root /usr/local/sbin/gobetween
curl -L -o gobetween_${GOBETWEEN_VERSION}_linux_amd64.tar.gz \
https://github.com/yyyar/gobetween/releases/download/${GOBETWEEN_VERSION}/gobetween_${GOBETWEEN_VERSION}_linux_amd64.tar.gz
tar xvf gobetween_${GOBETWEEN_VERSION}_linux_amd64.tar.gz
sudo mkdir -p /opt/bin
sudo mv gobetween /opt/bin/gobetween
sudo chown root:root /opt/bin/gobetween

cat <<EOF | sudo tee /etc/systemd/system/gobetween.service
[Unit]
Expand All @@ -36,7 +39,7 @@ After=network.target remote-fs.target nss-lookup.target
[Service]
Type=simple
PIDFile=/run/gobetween.pid
ExecStart=/usr/local/sbin/gobetween -c /etc/gobetween.toml
ExecStart=/opt/bin/gobetween -c /etc/gobetween.toml
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
Expand Down

0 comments on commit 4b29115

Please sign in to comment.