Skip to content

Commit

Permalink
Fix certbot docker compose config to avoid nginx container name colli…
Browse files Browse the repository at this point in the history
…sion
  • Loading branch information
neoformit committed Dec 8, 2024
1 parent 6e07266 commit 9806526
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
14 changes: 7 additions & 7 deletions ansible/roles/galaxy_labs_engine/tasks/certbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@

- name: Request SSL certificate with certbot
shell: >
docker compose --profile certbot run --rm certbot certonly \
--webroot \
--webroot-path /var/www/certbot/ \
--agree-tos \
--non-interactive \
-d "{{ certbot_domain }}" \
docker compose --profile certbot run --rm certbot-init certonly \
--webroot \
--webroot-path /var/www/certbot/ \
--agree-tos \
--non-interactive \
-d "{{ certbot_domain }}" \
-m "{{ certbot_renew_email }}"
args:
chdir: "{{ config_root }}"
Expand All @@ -53,7 +53,7 @@
name: "certbot-renew"
minute: "0"
hour: "0"
job: "docker compose --profile certbot run --rm certbot renew"
job: "cd {{ config_root }} && docker compose --profile certbot run --rm certbot renew"
tags: certbot

always:
Expand Down
13 changes: 12 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ services:
- /etc/letsencrypt:/etc/letsencrypt:ro
restart: always

certbot:
certbot-init:
profiles:
- certbot
depends_on:
Expand All @@ -103,6 +103,17 @@ services:
- /var/www/certbot:/var/www/certbot:rw
- /etc/letsencrypt:/etc/letsencrypt:rw

certbot:
profiles:
- certbot
# depends_on: # N.B. certbot depends on nginx but it's usually running and
# - nginx # causes a container name collision
image: certbot/certbot:latest
container_name: certbot
volumes:
- /var/www/certbot:/var/www/certbot:rw
- /etc/letsencrypt:/etc/letsencrypt:rw

networks:
labs-engine-network:
driver: bridge

0 comments on commit 9806526

Please sign in to comment.