diff --git a/provisioning/cloud-init.yaml b/provisioning/cloud-init.yaml index 5b7a996..bb4fe8d 100644 --- a/provisioning/cloud-init.yaml +++ b/provisioning/cloud-init.yaml @@ -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 \ @@ -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'