diff --git a/build/tmp.patch b/build/tmp.patch index c68bb8c..0c670ba 100644 --- a/build/tmp.patch +++ b/build/tmp.patch @@ -1,10 +1,8 @@ diff --git a/docker-compose.yml b/docker-compose.yml -index 02958b245..869b7d5de 100644 +index 81ece4913..869b7d5de 100644 --- a/docker-compose.yml +++ b/docker-compose.yml -@@ -1,8 +1,9 @@ - version: '3' -+name: labca +@@ -3,7 +3,7 @@ name: labca services: boulder: # Should match one of the GO_DEV_VERSIONS in test/boulder-tools/tag_and_upload.sh. @@ -13,7 +11,7 @@ index 02958b245..869b7d5de 100644 environment: # To solve HTTP-01 and TLS-ALPN-01 challenges, change the IP in FAKE_DNS # to the IP address where your ACME client's solver is listening. -@@ -13,12 +14,9 @@ services: +@@ -14,12 +14,9 @@ services: # Forward the parent env's GOEXPERIMENT value into the container. GOEXPERIMENT: ${GOEXPERIMENT:-} volumes: @@ -29,7 +27,7 @@ index 02958b245..869b7d5de 100644 networks: bluenet: ipv4_address: 10.77.77.77 -@@ -42,6 +40,7 @@ services: +@@ -43,6 +40,7 @@ services: depends_on: - bmysql - bconsul @@ -37,7 +35,7 @@ index 02958b245..869b7d5de 100644 entrypoint: labca/entrypoint.sh working_dir: &boulder_working_dir /opt/boulder logging: -@@ -76,8 +75,10 @@ services: +@@ -77,8 +75,10 @@ services: bconsul: image: hashicorp/consul:1.14.2 @@ -49,7 +47,7 @@ index 02958b245..869b7d5de 100644 networks: consulnet: ipv4_address: 10.55.55.10 -@@ -85,27 +86,28 @@ services: +@@ -86,27 +86,28 @@ services: ipv4_address: 10.77.77.10 rednet: ipv4_address: 10.88.88.10 @@ -88,7 +86,7 @@ index 02958b245..869b7d5de 100644 logging: driver: "json-file" options: -@@ -122,27 +124,26 @@ services: +@@ -123,27 +124,26 @@ services: - 80:80 - 443:443 volumes: @@ -130,7 +128,7 @@ index 02958b245..869b7d5de 100644 expose: - 3030 environment: -@@ -153,6 +154,14 @@ services: +@@ -154,6 +154,14 @@ services: volumes: dbdata: diff --git a/install b/install index f20950b..ef01c04 100755 --- a/install +++ b/install @@ -68,6 +68,7 @@ cmdlineBranch="" fullCmdline="" keepLocal=0 alphaTest=0 +dcdowngraded=0 # # Helper functions for informing the user and logging to file @@ -471,6 +472,7 @@ install_extra() { if [ "$dcver" != "0" ]; then dc18=$(apt list docker-compose-plugin -a 2>/dev/null | grep 2.18 | cut -d ' ' -f 2) apt install -y --allow-downgrades docker-compose-plugin=${dc18} &>>$installLog + dcdowngraded=1 msg_warn "docker-compose-plugin was downgraded to v2.18 due to a known bug with v2.19.x" fi @@ -734,10 +736,6 @@ startup() { local msg="Restart docker containers and service" cd "$boulderDir" - let num=$(docker ps -a | grep " boulder-" | wc -l) - if [ $num -eq 0 ]; then - perl -i -p0e "s/(version:.*\n).*\n?(services:\n)/\1name: labca\n\2/" docker-compose.yml - fi cnt=$(docker compose ps | wc -l) if [ "$cnt" -le "2" ]; then msg="Download docker images and build containers" @@ -745,26 +743,35 @@ startup() { msg_info "$msg (this will take a while!!)" docker compose pull -q &>>$installLog - cnt=$(count $PS_CONTROL || echo "0") - docker compose stop boulder bmysql labca nginx bconsul gui &>>$installLog || true + + # Cleanup any remaining containers with old names + docker compose -p boulder stop &>>$installLog || true + docker compose -p boulder rm -f &>>$installLog || true for ct in boulder_bhsm_1 boulder_bredis_1 boulder_bredis_2 boulder_bredis_3 boulder_bredis_4 boulder_bredis_5 boulder_bredis_6; do [ -z "$(docker ps | grep $ct)" ] || docker stop $ct &>>$installLog done - if [ $num -ne 0 ]; then - docker compose stop control &>>$installLog || true - fi + for ct in boulder_bhsm_1 boulder_bredis_1 boulder_bredis_2 boulder_bredis_3 boulder_bredis_4 boulder_bredis_5 boulder_bredis_6; do + [ -z "$(docker ps -a | grep -e "$ct\$")" ] || docker rm -f $ct &>>$installLog + done + docker network rm -f boulder_bluenet boulder_consulnet boulder_rednet &>>$installLog || true + docker stop boulder-labca-1 >&/dev/null || true + docker rm -f boulder-labca-1 >&/dev/null || true + docker stop labca-labca-1 >&/dev/null || true + docker rm -f labca-labca-1 >&/dev/null || true + + cnt=$(count $PS_CONTROL || echo "0") + haserr=$(docker compose logs | grep "cannot assign requested address" | wc -l) + docker compose stop &>>$installLog || true wait_down $PS_NGINX &>>$installLog || true wait_down $PS_MYSQL &>>$installLog || true wait_down $PS_CONSUL &>>$installLog || true wait_down $PS_LABCA &>>$installLog || true + wait_down $PS_CONTROL &>>$installLog || true wait_down $PS_BOULDER &>>$installLog || true - if [ $num -ne 0 ]; then - wait_down $PS_CONTROL &>>$installLog || true - cnt=0 + + if [ $dcdowngraded -eq 1 ] || [ $haserr -ne 0 ]; then + docker compose rm -f &>>$installLog || true fi - for ct in boulder_bhsm_1 boulder_bredis_1 boulder_bredis_2 boulder_bredis_3 boulder_bredis_4 boulder_bredis_5 boulder_bredis_6; do - [ -z "$(docker ps -a | grep -e "$ct\$")" ] || docker rm -f $ct &>>$installLog - done local rc=0 service labca status &> /dev/null || rc=$? @@ -776,10 +783,6 @@ startup() { [ -d /home/labca/control_logs ] || mkdir -p /home/labca/control_logs - perl -i -p0e "s/(version:.*\n).*\n?(services:\n)/\1name: labca\n\2/" docker-compose.yml - docker network rm -f boulder_bluenet boulder_consulnet boulder_rednet &>>$installLog || /bin/true - docker rm -f boulder-control-1 boulder-boulder-1 boulder-labca-1 boulder-bmysql-1 boulder-bconsul-1 boulder-nginx-1 >/dev/null &>>$installLog - # Restore MySQL data when moving from boulder-bmysql-1 to labca-bmysql-1 if [ -z "$(docker volume ls | grep labca_dbdata)" ] && [ ! -z "$(docker volume ls | grep boulder_dbdata)" ]; then docker volume create labca_dbdata &>>$installLog @@ -795,11 +798,7 @@ startup() { wait_up $PS_LABCA &>>$installLog || true wait_up $PS_CONTROL &>>$installLog || true docker exec -i labca-bmysql-1 mysql_upgrade &>>$installLog - [ -f "$boulderLabCADir/setup_complete" ] && wait_up $PS_BOULDER $PS_BOULDER_COUNT &>>$installLog || /bin/true - - if [ $cnt -gt 0 ]; then - COMPOSE_HTTP_TIMEOUT=180 docker compose restart control &>>$installLog - fi + [ -f "$boulderLabCADir/setup_complete" ] && wait_up $PS_BOULDER $PS_BOULDER_COUNT &>>$installLog || true msg_ok "$msg" } diff --git a/patches/docker-compose.patch b/patches/docker-compose.patch index abdb9db..a341716 100644 --- a/patches/docker-compose.patch +++ b/patches/docker-compose.patch @@ -1,8 +1,14 @@ diff --git a/docker-compose.yml b/docker-compose.yml -index 59f5423d4..02958b245 100644 +index 59f5423d4..81ece4913 100644 --- a/docker-compose.yml +++ b/docker-compose.yml -@@ -8,12 +8,14 @@ services: +@@ -1,4 +1,5 @@ + version: '3' ++name: labca + services: + boulder: + # Should match one of the GO_DEV_VERSIONS in test/boulder-tools/tag_and_upload.sh. +@@ -8,12 +9,14 @@ services: # to the IP address where your ACME client's solver is listening. # FAKE_DNS: 172.17.0.1 FAKE_DNS: 10.77.77.77 @@ -20,7 +26,7 @@ index 59f5423d4..02958b245 100644 - ./.gocache:/root/.cache/go-build:cached - ./.hierarchy:/hierarchy/:cached - ./.softhsm-tokens/:/var/lib/softhsm/tokens/:cached -@@ -33,20 +35,26 @@ services: +@@ -33,20 +36,26 @@ services: # TODO: Remove this when ServerAddress is deprecated in favor of SRV records # and DNSAuthority. dns: 10.55.55.10 @@ -55,7 +61,7 @@ index 59f5423d4..02958b245 100644 networks: bluenet: aliases: -@@ -60,22 +68,11 @@ services: +@@ -60,22 +69,11 @@ services: # small. command: mysqld --bind-address=0.0.0.0 --slow-query-log --log-output=TABLE --log-queries-not-using-indexes=ON logging: @@ -83,7 +89,7 @@ index 59f5423d4..02958b245 100644 bconsul: image: hashicorp/consul:1.14.2 -@@ -89,27 +86,73 @@ services: +@@ -89,27 +87,73 @@ services: rednet: ipv4_address: 10.88.88.10 command: "consul agent -dev -config-format=hcl -config-file=/test/consul/config.hcl"