Ops: Added backup script, dashboard UI, and project cheatsheet.
This commit is contained in:
19
CHEATSHEET.md
Normal file
19
CHEATSHEET.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Aether Docker Cheat Sheet 🚀
|
||||
|
||||
## 🛠️ Management Links
|
||||
- **Dashboard:** [http://localhost:8888](http://localhost:8888)
|
||||
- **Logs (Dozzle):** [http://localhost:8881](http://localhost:8881)
|
||||
- **Database (phpMyAdmin):** [http://localhost:8081](http://localhost:8081)
|
||||
- **API Docs:** [https://dev-api.oneskyit.com/docs](https://dev-api.oneskyit.com/docs)
|
||||
|
||||
## 💾 Database Operations
|
||||
- **Backup:** `./backup_db.sh`
|
||||
- **Restore:** `./restore_db.sh` (Note: Moves current data to a backup folder first)
|
||||
|
||||
## 📈 Scaling the API
|
||||
1. Edit `.env` -> `AE_API_REPLICAS=X`
|
||||
2. Run `docker compose up -d`
|
||||
|
||||
## 🧹 Maintenance
|
||||
- **Internal Logs:** Docker handles rotation automatically (10MB limit).
|
||||
- **External Proxy:** Point your home server to `[Workstation_IP]:5060`.
|
||||
23
backup_db.sh
Executable file
23
backup_db.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
# Aether MariaDB Backup Script (Physical Backup)
|
||||
# Performs a live, hot backup of the running local container.
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_ROOT="/home/scott/OSIT_dev/aether_container_env"
|
||||
BACKUP_DIR="${PROJECT_ROOT}/backups"
|
||||
TIMESTAMP=$(date +%Y%m%d_%H%M)
|
||||
BACKUP_FILE="${BACKUP_DIR}/local_backup_${TIMESTAMP}.gz"
|
||||
|
||||
echo "--- Starting Aether Local Database Backup ---"
|
||||
|
||||
# Ensure backup directory exists
|
||||
mkdir -p "${BACKUP_DIR}"
|
||||
|
||||
# Run mariabackup inside the container and stream it to a gzipped file on the host
|
||||
# We use root here since it's a workstation dev env
|
||||
echo ">>> Backing up to ${BACKUP_FILE}..."
|
||||
docker exec ae_mariadb_dev mariabackup --user=root --password='$1sky.AE_dev.2023' --backup --stream=xbstream | gzip > "${BACKUP_FILE}"
|
||||
|
||||
echo "--- Backup Complete! ---"
|
||||
ls -lh "${BACKUP_FILE}"
|
||||
12
conf/logrotate.conf
Normal file
12
conf/logrotate.conf
Normal file
@@ -0,0 +1,12 @@
|
||||
# Logrotate configuration for Aether Docker Logs
|
||||
# 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 {
|
||||
daily
|
||||
rotate 7
|
||||
missingok
|
||||
notifempty
|
||||
compress
|
||||
delaycompress
|
||||
copytruncate
|
||||
}
|
||||
@@ -14,7 +14,7 @@ services:
|
||||
ports:
|
||||
- "${OSIT_WEB_HTTP_PORT}:80"
|
||||
- "${OSIT_WEB_HTTPS_PORT}:443"
|
||||
- "${AE_API_GATEWAY_PORT}:80" # Entry point for external API traffic (HTTP)
|
||||
- "${AE_API_GATEWAY_PORT}:80"
|
||||
volumes:
|
||||
- ./srv/html_php:/srv/html_php
|
||||
- ./srv/oneskyit_site:/srv/oneskyit_site
|
||||
@@ -30,15 +30,30 @@ services:
|
||||
- ./conf/certs/oneskyit.com_privkey.pem:/etc/certs/privkey.pem
|
||||
- ./conf/certs/ssl-dhparams.pem:/etc/certs/ssl-dhparams.pem
|
||||
- ./logs/web:/logs
|
||||
networks:
|
||||
- ae_public
|
||||
- ae_private
|
||||
depends_on:
|
||||
- ae_api
|
||||
- aether_app_gunicorn
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
redis:
|
||||
restart: always
|
||||
container_name: ${CONTAINER_REDIS}
|
||||
image: redis
|
||||
command: redis-server --save "" --loglevel warning
|
||||
networks:
|
||||
- ae_private
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
mariadb:
|
||||
restart: always
|
||||
@@ -61,8 +76,13 @@ services:
|
||||
volumes:
|
||||
- ./srv/mariadb:/var/lib/mysql
|
||||
- ./conf/mariadb/server.cnf:/etc/mysql/conf.d/server.cnf
|
||||
ports:
|
||||
- "3306:3306"
|
||||
networks:
|
||||
- ae_private
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
phpmyadmin:
|
||||
restart: always
|
||||
@@ -73,16 +93,29 @@ services:
|
||||
UPLOAD_LIMIT: 64M
|
||||
ports:
|
||||
- "${AE_PMA_PORT}:80"
|
||||
networks:
|
||||
- ae_public
|
||||
- ae_private
|
||||
depends_on:
|
||||
- mariadb
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
ae_api:
|
||||
restart: always
|
||||
# We don't use container_name here so we can scale
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: aether_fastapi_gunicorn.Dockerfile
|
||||
scale: ${AE_API_REPLICAS}
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:5005/docs"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
env_file:
|
||||
- ./.env
|
||||
extra_hosts:
|
||||
@@ -101,11 +134,18 @@ services:
|
||||
- ${HOSTED_FILES_SRC}:/srv/hosted_files
|
||||
- ${HOSTED_TMP_SRC}:/srv/hosted_tmp
|
||||
- ./temp/ae_api:/temp
|
||||
networks:
|
||||
- ae_private
|
||||
depends_on:
|
||||
- redis
|
||||
- mariadb
|
||||
stdin_open: true
|
||||
tty: true
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
aether_app_gunicorn:
|
||||
restart: always
|
||||
@@ -130,7 +170,38 @@ services:
|
||||
- ${HOSTED_FILES_SRC}:/srv/hosted_files
|
||||
- ${HOSTED_TMP_SRC}:/srv/hosted_tmp
|
||||
- ./tmp/ae_app:/tmp
|
||||
networks:
|
||||
- ae_public
|
||||
- ae_private
|
||||
depends_on:
|
||||
- ae_api
|
||||
stdin_open: true
|
||||
tty: true
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
dozzle:
|
||||
container_name: ae_dozzle_dev
|
||||
image: amir20/dozzle:latest
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
ports:
|
||||
- "8881:8080"
|
||||
networks:
|
||||
- ae_public
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
networks:
|
||||
ae_public:
|
||||
name: ae_dev_public
|
||||
ae_private:
|
||||
name: ae_dev_private
|
||||
internal: true
|
||||
|
||||
@@ -32,6 +32,7 @@ AE_API_GATEWAY_PORT=5060
|
||||
DOCKER_AE_SERVER_EXTRA_HOST=example.oneskyit.com:127.0.0.1
|
||||
DOCKER_AE_APP_SERVER_EXTRA_HOST=example-app.oneskyit.com:127.0.0.1
|
||||
DOCKER_AE_API_SERVER_EXTRA_HOST=example-api.oneskyit.com:127.0.0.1
|
||||
DOCKER_AE_API_BAK_SERVER_EXTRA_HOST=example-bak-api.oneskyit.com:127.0.0.1
|
||||
DOCKER_AE_DB_SERVER_EXTRA_HOST=db.oneskyit.com:127.0.0.1
|
||||
|
||||
# Nginx Server Names
|
||||
|
||||
Reference in New Issue
Block a user