Solved msmtp bug and implemented healthchecks for it

This commit is contained in:
2025-04-03 15:09:10 +02:00
parent 170636d098
commit e024542d8e
8 changed files with 39 additions and 43 deletions

View File

@@ -37,6 +37,6 @@ docker-compose exec -it application /bin/sh
To test the email execute:
```bash
echo "Test Email" | sendmail -v your-email@example.com
docker-compose exec -it application /bin/sh -c 'echo "Test Email" | sendmail -v your-email@example.com'
```

View File

@@ -6,7 +6,7 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/*
# Copy the msmtp configuration into the container
COPY msmtp.conf /etc/msmtp.conf
COPY config/msmtprc.conf /etc/msmtprc
# Copy the PHP configuration for uploads (and mail settings)
COPY upload.ini $PHP_INI_DIR/conf.d/

View File

@@ -1,8 +0,0 @@
---
- name: rebuild wordpress container
command:
cmd: docker build --no-cache -t {{custom_wordpress_image}} .
chdir: "{{docker_compose.directories.instance}}"
environment:
COMPOSE_HTTP_TIMEOUT: 600
DOCKER_CLIENT_TIMEOUT: 600

View File

@@ -17,25 +17,19 @@
template:
src: upload.ini.j2
dest: "{{ docker_compose.directories.instance }}upload.ini"
notify:
- docker compose project setup
- rebuild wordpress container
notify: docker compose project build and setup
- name: "Transfering msmtp.conf to {{ docker_compose.directories.instance }}"
- name: "Transfering msmtprc to {{ host_msmtp_conf }}"
template:
src: "{{ playbook_dir }}/roles/msmtp/templates/msmtprc.conf.j2"
dest: "{{ docker_compose.directories.instance }}msmtp.conf"
notify:
- docker compose project setup
- rebuild wordpress container
dest: "{{ host_msmtp_conf }}"
notify: docker compose project build and setup
- name: "Transfering Dockerfile to {{ docker_compose.directories.instance }}"
copy:
src: Dockerfile
dest: "{{ docker_compose.directories.instance }}Dockerfile"
notify:
- docker compose project setup
- rebuild wordpress container
notify: docker compose project build and setup
- name: "copy docker-compose.yml and env file"
include_tasks: copy-docker-compose-and-env.yml

View File

@@ -12,11 +12,9 @@ services:
- "127.0.0.1:{{ports.localhost.http[application_id]}}:80"
volumes:
- data:/var/www/html
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80/"]
interval: 1m
timeout: 10s
retries: 3
{% include 'roles/docker-compose/templates/services/msmtp_curl_test.yml.j2' %}
{% include 'templates/docker/container/depends-on-just-database.yml.j2' %}
{% include 'templates/docker/container/networks.yml.j2' %}

View File

@@ -2,4 +2,5 @@ application_id: "wordpress"
wordpress_max_upload_size: "64M"
database_type: "mariadb"
database_password: "{{wordpress_database_password}}"
custom_wordpress_image: "custom_wordpress"
custom_wordpress_image: "custom_wordpress"
host_msmtp_conf: "{{docker_compose.directories.config}}msmtprc.conf"