chore: unify timezone and implement containerized log rotation
This commit is contained in:
@@ -23,6 +23,7 @@ workstation:3001 workstation:5060
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Key Improvements:**
|
**Key Improvements:**
|
||||||
|
- **Timezone Support:** All containers use the `TZ` variable from `.env` for consistent logging and database timestamps.
|
||||||
- **Scalable Routing:** Nginx uses Regex (`~^(dev|test|bak|sr|prod)?-?...`) to automatically handle any environment prefix without configuration changes.
|
- **Scalable Routing:** Nginx uses Regex (`~^(dev|test|bak|sr|prod)?-?...`) to automatically handle any environment prefix without configuration changes.
|
||||||
- **Isolated Stacks:** Each deployment uses a unique `AE_NETWORK_NAME` and `CONTAINER_` prefix to prevent collisions.
|
- **Isolated Stacks:** Each deployment uses a unique `AE_NETWORK_NAME` and `CONTAINER_` prefix to prevent collisions.
|
||||||
- **Shared Services:** Core infrastructure (DB/Redis) resides on the `aether_shared_net` which must be created manually once.
|
- **Shared Services:** Core infrastructure (DB/Redis) resides on the `aether_shared_net` which must be created manually once.
|
||||||
@@ -119,7 +120,7 @@ These scripts are located in the root directory:
|
|||||||
## 📂 Directory Map
|
## 📂 Directory Map
|
||||||
|
|
||||||
* **`conf/`**: Configuration templates for Nginx and Gunicorn. API config now lives in the `aether_api_fastapi` repo as `app/config.py` and reads settings directly from env vars.
|
* **`conf/`**: Configuration templates for Nginx and Gunicorn. API config now lives in the `aether_api_fastapi` repo as `app/config.py` and reads settings directly from env vars.
|
||||||
* **`logs/`**: Centralized logging for all containers.
|
* **`logs/`**: Centralized logging for all containers. Automatic rotation is managed by the `ae_ops` service (7-day retention).
|
||||||
* **`srv/`**: Mount points for data and source code (managed via symlinks).
|
* **`srv/`**: Mount points for data and source code (managed via symlinks).
|
||||||
* **`scripts/`**: Internal automation logic.
|
* **`scripts/`**: Internal automation logic.
|
||||||
* **`backups/`**: Storage for MariaDB snapshots.
|
* **`backups/`**: Storage for MariaDB snapshots.
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
55 * * * * bash /scripts/backup_internal.sh >> /logs/backup_cron.log 2>&1
|
55 * * * * bash /scripts/backup_internal.sh >> /logs/backup_cron.log 2>&1
|
||||||
|
0 0 * * * /usr/sbin/logrotate /etc/logrotate.conf
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Logrotate configuration for Aether Docker Logs
|
# Logrotate configuration for Aether Docker Logs (Internal container version)
|
||||||
# To use: sudo ln -s /home/scott/OSIT_dev/aether_container_env/conf/logrotate.conf /etc/logrotate.d/aether
|
|
||||||
|
|
||||||
/home/scott/OSIT_dev/aether_container_env/logs/*/*.log {
|
/logs/*/*.log
|
||||||
|
/logs/web/*/*.log {
|
||||||
daily
|
daily
|
||||||
rotate 7
|
rotate 7
|
||||||
missingok
|
missingok
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- PUID=1000
|
- PUID=1000
|
||||||
- PGID=1000
|
- PGID=1000
|
||||||
- TZ=US/Eastern
|
- TZ=${TZ}
|
||||||
|
|
||||||
- NGINX_SERVER_NAMES="demo.localhost dev.localhost dev.oneskyit.com dev-app.oneskyit.com dev-connect.oneskyit.com dev-demo.oneskyit.com dev-aacc.oneskyit.com dev-aapor.oneskyit.com dev-ascm.oneskyit.com dev-businessgroup.oneskyt.com dev-chow.oneskyit.com dev-cmsc.oneskyit.com dev-idaa.oneskyit.com dev-ishlt.oneskyit.com dev-lci.oneskyit.com dev-ncsd.oneskyit.com dev-npa.oneskyit.com dev-rli.oneskyit.com test-app.oneskyit.com test-api.oneskyit.com test-demo.oneskyit.com test-lci.oneskyit.com test-idaa.oneskyit.com scott.oneskyit.com dgr.oneskyit.com"
|
- NGINX_SERVER_NAMES="demo.localhost dev.localhost dev.oneskyit.com dev-app.oneskyit.com dev-connect.oneskyit.com dev-demo.oneskyit.com dev-aacc.oneskyit.com dev-aapor.oneskyit.com dev-ascm.oneskyit.com dev-businessgroup.oneskyt.com dev-chow.oneskyit.com dev-cmsc.oneskyit.com dev-idaa.oneskyit.com dev-ishlt.oneskyit.com dev-lci.oneskyit.com dev-ncsd.oneskyit.com dev-npa.oneskyit.com dev-rli.oneskyit.com test-app.oneskyit.com test-api.oneskyit.com test-demo.oneskyit.com test-lci.oneskyit.com test-idaa.oneskyit.com scott.oneskyit.com dgr.oneskyit.com"
|
||||||
ports:
|
ports:
|
||||||
@@ -54,6 +54,8 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- default
|
- default
|
||||||
- shared
|
- shared
|
||||||
|
environment:
|
||||||
|
- TZ=${TZ}
|
||||||
command: redis-server --save "" --loglevel warning
|
command: redis-server --save "" --loglevel warning
|
||||||
logging:
|
logging:
|
||||||
driver: "json-file"
|
driver: "json-file"
|
||||||
@@ -82,6 +84,7 @@ services:
|
|||||||
MYSQL_DATABASE: ${AE_DB_NAME}
|
MYSQL_DATABASE: ${AE_DB_NAME}
|
||||||
MYSQL_USER: ${AE_DB_USERNAME}
|
MYSQL_USER: ${AE_DB_USERNAME}
|
||||||
MYSQL_PASSWORD: ${AE_DB_PASSWORD}
|
MYSQL_PASSWORD: ${AE_DB_PASSWORD}
|
||||||
|
TZ: ${TZ}
|
||||||
ports:
|
ports:
|
||||||
- "${AE_DB_EXTERNAL_PORT}:3306"
|
- "${AE_DB_EXTERNAL_PORT}:3306"
|
||||||
volumes:
|
volumes:
|
||||||
@@ -103,6 +106,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
PMA_HOST: mariadb
|
PMA_HOST: mariadb
|
||||||
UPLOAD_LIMIT: 64M
|
UPLOAD_LIMIT: 64M
|
||||||
|
TZ: ${TZ}
|
||||||
ports:
|
ports:
|
||||||
- "${AE_PMA_PORT}:80"
|
- "${AE_PMA_PORT}:80"
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -180,10 +184,8 @@ services:
|
|||||||
home.oneskyit.com: "71.126.159.102"
|
home.oneskyit.com: "71.126.159.102"
|
||||||
static.oneskyit.com: "104.237.143.4"
|
static.oneskyit.com: "104.237.143.4"
|
||||||
dev.oneskyit.com: "192.168.32.7"
|
dev.oneskyit.com: "192.168.32.7"
|
||||||
# volumes:
|
volumes:
|
||||||
# # In production, the build happens INSIDE the container.
|
- ./logs/ae_app:/logs
|
||||||
# # Mounting the host source here would override the internal build.
|
|
||||||
# # - ${AE_APP_SRC}:/app
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- ae_api
|
- ae_api
|
||||||
- redis
|
- redis
|
||||||
@@ -197,6 +199,8 @@ services:
|
|||||||
dozzle:
|
dozzle:
|
||||||
container_name: ${CONTAINER_DOZZLE:-ae_dozzle_dev}
|
container_name: ${CONTAINER_DOZZLE:-ae_dozzle_dev}
|
||||||
image: amir20/dozzle:latest
|
image: amir20/dozzle:latest
|
||||||
|
environment:
|
||||||
|
- TZ=${TZ}
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
ports:
|
ports:
|
||||||
@@ -209,7 +213,6 @@ services:
|
|||||||
max-file: "3"
|
max-file: "3"
|
||||||
|
|
||||||
ae_ops:
|
ae_ops:
|
||||||
# ... (same as before) ...
|
|
||||||
container_name: ${CONTAINER_AE_OPS:-ae_ops_dev}
|
container_name: ${CONTAINER_AE_OPS:-ae_ops_dev}
|
||||||
image: alpine:latest
|
image: alpine:latest
|
||||||
restart: always
|
restart: always
|
||||||
@@ -224,7 +227,8 @@ services:
|
|||||||
- ./scripts:/scripts
|
- ./scripts:/scripts
|
||||||
- ./logs:/logs
|
- ./logs:/logs
|
||||||
- ./conf/crontab:/etc/crontabs/root
|
- ./conf/crontab:/etc/crontabs/root
|
||||||
command: sh -c "apk add --no-cache docker-cli bash && crond -f -l 2"
|
- ./conf/logrotate.conf:/etc/logrotate.conf
|
||||||
|
command: sh -c "apk add --no-cache docker-cli bash logrotate && crond -f -l 2"
|
||||||
depends_on:
|
depends_on:
|
||||||
- mariadb
|
- mariadb
|
||||||
logging:
|
logging:
|
||||||
|
|||||||
Reference in New Issue
Block a user