Adapt for Networ7 environment

- Add clamav

- Use nlss/mariadb

- Add healthchecks

- Overall improvements
This commit is contained in:
xZero707 2021-05-27 19:09:16 +02:00
parent e97b062207
commit b55e5e4577
4 changed files with 146 additions and 54 deletions

View File

@ -1,64 +1,146 @@
version: "3"
services:
postal:
image: catdeployed/postal:alpine
container_name: postal
command: run
ports:
- 127.0.0.1:25:25
nginx:
image: nginx:mainline-alpine
links:
- service
depends_on:
- "mysql"
- "rabbitmq"
- service
volumes:
- persistent_assets:/storage
- ./src/nginx.conf:/etc/nginx/conf.d/default.conf:ro
- static_assets:/opt/postal/public:ro
- assets:/opt/postal/public/assets:ro
networks:
default: {aliases: [ postal_nginx, nginx ]}
http:
restart: unless-stopped
healthcheck:
test: [ "CMD", "curl", "--fail", "http://127.0.0.1" ]
interval: 15s
timeout: 10s
retries: 3
service:
image: catdeployed/postal:alpine
build:
context: .
command: run
depends_on:
- systemdb
- messagedb
- queue
- clamav
volumes:
- storage:/storage
- static_assets:/opt/postal/public
- postal_assets:/opt/postal/public/assets
- assets:/opt/postal/public/assets
- ./src/templates/:/templates
environment:
- MYSQL_ROOT_PASSWORD=changeme
- MYSQL_DATABASE=postal
- CLAMAV_HOST=clamav
- CLAMAV_PORT=3310
- SYSTEMDB_HOST=systemdb
- SYSTEMDB_DATABASE=postal
- SYSTEMDB_USER=root
- SYSTEMDB_PASSWORD=SQtDHUD7spitQQvoQ^2vSCTZBg5nX^
- MESSAGEDB_HOST=messagedb
- MESSAGEDB_DATABASE=messages
- MESSAGEDB_USER=root
- MESSAGEDB_PASSWORD=SQtDHUD7spitQQvoQ^2vSCTZBg5nX^
- RABBITMQ_DEFAULT_USER=postal
- RABBITMQ_DEFAULT_PASS=changeme
- RABBITMQ_DEFAULT_VHOST=postal
- POSTAL_FNAME=Sia
- POSTAL_LNAME=Cat
- POSTAL_PASSWORD=SecretCatPassword
- POSTAL_EMAIL=myemail@catsworld.com
- POSTAL_PASSWORD=hDzqLsP5hEXuBinpQ3KHSknvgTxRu6
- POSTAL_EMAIL=aleksandar@puharic.com
networks:
default: { aliases: [ postal, service ] }
client: { aliases: [ postal, mailer, mailer-service ] }
healthcheck:
test: curl -sS http://127.0.0.1:5000 || exit 1
interval: 5s
timeout: 10s
retries: 3
mysql:
image: mariadb:10
container_name: postal_mysql
restart: unless-stopped
systemdb:
image: nlss/mariadb
volumes:
- mysql_data:/var/lib/mysql
- systemdb_data:/var/lib/mysql
- systemdb_backup:/var/lib/backup
- systemdb_log:/var/log/mysql
environment:
- MYSQL_ROOT_PASSWORD=changeme
- MYSQL_DATABASE=postal
rabbitmq:
- MARIADB_ROOT_PASSWORD=SQtDHUD7spitQQvoQ^2vSCTZBg5nX^
- MARIADB_DATABASE=postal
networks:
default: { aliases: [ postal_mysql, mysql, mariadb, database ] }
restart: unless-stopped
healthcheck:
test: [ "CMD", "/usr/bin/healthcheck" ]
interval: 30s
timeout: 20s
retries: 3
messagedb:
image: nlss/mariadb
volumes:
- messagedb_data:/var/lib/mysql
- messagedb_backup:/var/lib/backup
- messagedb_log:/var/log/mysql
environment:
- MARIADB_ROOT_PASSWORD=SQtDHUD7spitQQvoQ^2vSCTZBg5nX^
- MARIADB_DATABASE=messages
networks:
default: { aliases: [ postal_mysql, mysql, mariadb, database ] }
restart: unless-stopped
healthcheck:
test: [ "CMD", "/usr/bin/healthcheck" ]
interval: 30s
timeout: 20s
retries: 3
queue:
image: rabbitmq:3-alpine
container_name: postal_rabbitmq
environment:
- RABBITMQ_DEFAULT_USER=postal
- RABBITMQ_DEFAULT_PASS=changeme
- RABBITMQ_DEFAULT_VHOST=/postal
nginx:
image: nginx
container_name: postal_nginx
ports:
- 80:80
links:
- postal
depends_on:
- postal
networks:
default: { aliases: [ postal_rabbitmq, rabbitmq, queue ] }
restart: unless-stopped
healthcheck:
test: rabbitmq-diagnostics -q ping
interval: 30s
timeout: 30s
retries: 3
clamav:
image: mkodockx/docker-clamav:alpine
volumes:
- ./src/nginx.conf:/etc/nginx/conf.d/default.conf:ro
- static_assets:/opt/postal/public:ro
- postal_assets:/opt/postal/public/assets:ro
- clamav_data:/var/lib/clamav
networks:
default: { aliases: [ clamav ] }
healthcheck:
test: [ "CMD", "./check.sh" ]
interval: 60s
retries: 3
start_period: 120s
restart: unless-stopped
networks:
default:
client:
http:
volumes:
static_assets:
postal_assets:
mysql_data:
persistent_assets:
assets:
clamav_data:
systemdb_data:
systemdb_backup:
systemdb_log:
messagedb_data:
messagedb_backup:
messagedb_log:
storage:

View File

@ -22,7 +22,7 @@ elif [ ! -f /opt/postal/config/postal.yml ] || [[ $(cat /opt/postal/config/posta
## Generate config and keys
/opt/postal/bin/postal initialize-config
/opt/postal/bin/postal initialize
/create-user.sh
#/create-user.sh
## Copy over config to persistent storage
cp -p /opt/postal/config/postal.yml /storage/postal.yml
rm /opt/postal/config/postal.yml

View File

@ -21,18 +21,18 @@ general:
main_db:
# Specify the connection details for your MySQL database
host: mysql
username: root
password: {{ MYSQL_ROOT_PASSWORD }}
database: {{ MYSQL_DATABASE }}
host: {{ SYSTEMDB_HOST }}
username: {{ SYSTEMDB_USER }}
password: {{ SYSTEMDB_PASSWORD }}
database: {{ SYSTEMDB_DATABASE }}
message_db:
# Specify the connection details for your MySQL server that will be house the
# message databases for mail servers.
host: mysql
username: root
password: {{ MYSQL_ROOT_PASSWORD }}
prefix: postal
host: {{ MESSAGEDB_HOST }}
username: {{ MESSAGEDB_USER }}
password: {{ MESSAGEDB_PASSWORD }}
database: {{ MESSAGEDB_DATABASE }}
rabbitmq:
# Specify the connection details for your RabbitMQ server.
@ -64,3 +64,8 @@ smtp:
from_name: Postal
from_address: postal@yourdomain.com
clamav:
enabled: true
host: {{ CLAMAV_HOST }}
port: {{ CLAMAV_PORT }}

View File

@ -16,18 +16,18 @@ general:
main_db:
# Specify the connection details for your MySQL database
host: mysql
username: root
password: {{ MYSQL_ROOT_PASSWORD }}
database: {{ MYSQL_DATABASE }}
host: {{ SYSTEMDB_HOST }}
username: {{ SYSTEMDB_USER }}
password: {{ SYSTEMDB_PASSWORD }}
database: {{ SYSTEMDB_DATABASE }}
message_db:
# Specify the connection details for your MySQL server that will be house the
# message databases for mail servers.
host: mysql
username: root
password: {{ MYSQL_ROOT_PASSWORD }}
prefix: postal
host: {{ MESSAGEDB_HOST }}
username: {{ MESSAGEDB_USER }}
password: {{ MESSAGEDB_PASSWORD }}
database: {{ MESSAGEDB_DATABASE }}
rabbitmq:
# Specify the connection details for your RabbitMQ server.
@ -66,3 +66,8 @@ rails:
web_server:
bind_address: 0.0.0.0
clamav:
enabled: true
host: {{ CLAMAV_HOST }}
port: {{ CLAMAV_PORT }}