Skip to content

Commit

Permalink
redeploy of haproxy on arm64 unnecessary after focal-backports remove…
Browse files Browse the repository at this point in the history
…d from charm
  • Loading branch information
rajannpatel committed Apr 6, 2023
1 parent c605bc9 commit e71200a
Showing 1 changed file with 2 additions and 30 deletions.
32 changes: 2 additions & 30 deletions provisioning/cloud-init.yaml
Expand Up @@ -58,15 +58,10 @@ runcmd:
- su ubuntu -c 'juju bootstrap localhost lxdlandscape'
- su ubuntu -c "juju set-model-constraints arch=$(dpkg --print-architecture)"
- su ubuntu -c "juju deploy landscape-scalable --channel {{ CHANNEL }}"
- |
if [ $(dpkg --print-architecture) = 'arm64' ]; then
/bin/bash /tmp/redeploy_haproxy.sh
else
{% if SSL_KEY != "SELFSIGNED" %}
su ubuntu -c "juju config haproxy ssl_cert='{{ SSL_CERT }}' ssl_key='{{ SSL_KEY }}'"
- su ubuntu -c "juju config haproxy ssl_cert='{{ SSL_CERT }}' ssl_key='{{ SSL_KEY }}'"
{% endif %}
/bin/bash /home/ubuntu/iptables_haproxy.sh
fi
- /bin/bash /home/ubuntu/iptables_haproxy.sh
{% if SMTP_HOST %}
- |
su ubuntu -c "juju deploy postfix-relay \
Expand Down Expand Up @@ -97,29 +92,6 @@ write_files:
iptables -I OUTPUT 1 -o lxdbr0 -j ACCEPT -m comment --comment "Permit outgoing on lxdbr0"
netfilter-persistent save
echo "$(date +'%Y-%m-%d %H:%M:%S'): networking.sh completed"
- path: /tmp/redeploy_haproxy.sh
owner: 'ubuntu:ubuntu'
permissions: '0755'
defer: true
content: |
#!/bin/bash
echo "$(date +'%Y-%m-%d %H:%M:%S'): redeploy_haproxy.sh started - arm64 detected, HAProxy charm needs to be redeployed on arm64 architectures"
su ubuntu -c 'juju remove-application haproxy --force'
while true; do
juju_status=$(su ubuntu -c "juju status --format json")
count=$(echo "$juju_status" | grep -o '{\"haproxy/' | wc -l)
if [ "$count" -lt 1 ]; then
su ubuntu -c "juju deploy haproxy --config default_timeouts='queue 60000, connect 5000, client 120000, server 120000' --config services='' --config ssl_cert='{{ SSL_CERT }}' --config ssl_key='{{ SSL_KEY }}' --config global_default_bind_options='no-tlsv10' --series focal"
su ubuntu -c 'juju relate landscape-server haproxy'
break
else
echo "$(date +'%Y-%m-%d %H:%M:%S'): Waiting for haproxy/0 to be removed"
sleep 10
su ubuntu -c "juju status"
fi
done
echo "$(date +'%Y-%m-%d %H:%M:%S'): redeploy_haproxy.sh completed"
/bin/bash /home/ubuntu/iptables_haproxy.sh
- path: /home/ubuntu/iptables_haproxy.sh
owner: 'ubuntu:ubuntu'
permissions: '0755'
Expand Down

0 comments on commit e71200a

Please sign in to comment.