Adding sync script, adding mailtpit to both networks, minor container renames

This commit is contained in:
Finley Ghosh 2025-09-14 11:54:41 +10:00
parent e5041ef3a1
commit 5e825162af
3 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,32 @@
#!/bin/bash
set -e
# Default target directory for docs
TARGET_DIR="/mnt/cmc-docs"
# Parse optional target dir
for arg in "$@"; do
if [[ "$arg" == "-target" ]]; then
NEXT_IS_TARGET=1
continue
fi
if [[ $NEXT_IS_TARGET == 1 ]]; then
TARGET_DIR="$arg"
NEXT_IS_TARGET=0
fi
done
PDF_SRC="/mnt/vault/pdf"
ATTACH_SRC="/mnt/vault/attachment_files"
PDF_DEST="$TARGET_DIR/pdf"
ATTACH_DEST="$TARGET_DIR/attachments_files"
mkdir -p "$PDF_DEST" "$ATTACH_DEST"
# Sync PDF files
rsync -avz --progress "$PDF_SRC/" "$PDF_DEST/"
# Sync attachment files
rsync -avz --progress "$ATTACH_SRC/" "$ATTACH_DEST/"
echo "Sync complete. Files are in $TARGET_DIR (pdf/ and attachments_files/)"

View file

@ -2,6 +2,7 @@ services:
postfix:
image: boky/postfix
restart: unless-stopped
container_name: cmc-prod-postfix
# Staging: relay to Mailpit (no authentication required)
environment:
- RELAYHOST=mailpit.stg.internal
@ -46,6 +47,8 @@ services:
DB_PASSWORD: xVRQI&cA?7AU=hqJ!%au
DB_NAME: cmc
volumes:
- /mnt/cmc-docs/pdf:/var/www/cmc-sales/app/webroot/pdf
- /mnt/cmc-docs/attachments_files:/var/www/cmc-sales/app/webroot/attachments_files
- ./userpasswd:/etc/nginx/userpasswd:ro
networks:
- cmc-prod-network

View file

@ -2,6 +2,7 @@ services:
postfix:
image: boky/postfix
restart: unless-stopped
container_name: cmc-stg-postfix
# Staging: relay to Mailpit (no authentication required)
environment:
- RELAYHOST=mailpit.stg.internal
@ -46,6 +47,8 @@ services:
DB_PASSWORD: xVRQI&cA?7AU=hqJ!%au
DB_NAME: cmc
volumes:
- /mnt/cmc-docs/pdf:/var/www/cmc-sales/app/webroot/pdf
- /mnt/cmc-docs/attachments_files:/var/www/cmc-sales/app/webroot/attachments_files
- ./userpasswd:/etc/nginx/userpasswd:ro
networks:
- cmc-stg-network
@ -105,10 +108,14 @@ services:
- "1025:1025" # SMTP
networks:
- cmc-stg-network
- cmc-prod-network
restart: unless-stopped
networks:
cmc-stg-network:
cmc-prod-network:
external: true
volumes:
db_data: