Modernization: Standardized Docker env, added local MariaDB/phpMyAdmin, added automated restore script.
This commit is contained in:
22
.dockerignore
Normal file
22
.dockerignore
Normal file
@@ -0,0 +1,22 @@
|
||||
# Ignore Git
|
||||
.git
|
||||
.gitignore
|
||||
|
||||
# Ignore Data Directories (CRITICAL for build speed and permissions)
|
||||
srv/
|
||||
logs/
|
||||
temp/
|
||||
tmp/
|
||||
backups/
|
||||
|
||||
# Ignore Environment Files
|
||||
.env
|
||||
.env.*
|
||||
*.env
|
||||
|
||||
# Ignore IDE settings
|
||||
.vscode/
|
||||
*.code-workspace
|
||||
|
||||
# Ignore miscellaneous
|
||||
README.md
|
||||
@@ -1,37 +0,0 @@
|
||||
# FROM tiangolo/uvicorn-gunicorn-fastapi:latest
|
||||
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.11
|
||||
|
||||
LABEL maintainer="Scott Idem <scott.idem@oneskyit.com>"
|
||||
|
||||
WORKDIR /srv/aether_api
|
||||
|
||||
# RUN apt install poppler-utils
|
||||
RUN apt-get update; \
|
||||
apt-get install -y \
|
||||
poppler-utils \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
# RUN set -ex; \
|
||||
# \
|
||||
# apt-get update; \
|
||||
# apt-get install -y --no-install-recommends \
|
||||
# poppler-utils \
|
||||
# ; \
|
||||
# rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
RUN pdftoppm -h
|
||||
|
||||
COPY conf/aether_api_v5_fastapi_requirements.txt /tmp/requirements.txt
|
||||
|
||||
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
||||
|
||||
# RUN pip freeze
|
||||
# RUN mkdir /temp
|
||||
RUN pip freeze > /requirements_current.txt
|
||||
# COPY requirements_current.txt tmp/requirements_current.txt
|
||||
# RUN pip freeze > /logs/requirements_current.txt
|
||||
|
||||
# COPY conf/aether_fastapi_requirements.txt /tmp/requirements.txt
|
||||
|
||||
CMD ["gunicorn", "--conf", "/conf/gunicorn_fastapi_conf.py"]
|
||||
@@ -1,9 +1,8 @@
|
||||
services:
|
||||
web:
|
||||
restart: no # unless-stopped
|
||||
restart: unless-stopped
|
||||
container_name: ${CONTAINER_WEB}
|
||||
build:
|
||||
# context: ./builds
|
||||
context: ./
|
||||
dockerfile: aether_nginx.Dockerfile
|
||||
env_file:
|
||||
@@ -11,38 +10,21 @@ services:
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
|
||||
# NOTE: This does not seem to work with nginx yet???
|
||||
# NOTE: Use the template directory and .template extension for the .conf files.
|
||||
# - NGINX_SERVER_NAMES="dev-demo.oneskyit.com dev-example.oneskyit.com"
|
||||
# - NGINX_SERVER_NAMES="dev-idaa.oneskyit.com dev-ishlt.oneskyit.com"
|
||||
# - AE_DOMAIN_LIST:'dev-aapor.oneskyit.com dev-businessgroup.oneskyt.com dev-cmsc.oneskyit.com dev-idaa.oneskyit.com dev-ishlt.oneskyit.com dev-ncsd.oneskyit.com dev-npa.oneskyit.com dev-rli.oneskyit.com'
|
||||
# - NGINX_SERVER_NAMES="flask_gunicorn.localhost demo.localhost dev.localhost dev.oneskyit.com dev-app.oneskyit.com dev-connect.oneskyit.com *.dev-connect.oneskyit.com dev-demo.oneskyit.com *.dev-demo.oneskyit.com dev-aapor.oneskyit.com *.dev-aapor.oneskyit.com dev-businessgroup.oneskyt.com *.dev-businessgroup.oneskyt.com dev-cmsc.oneskyit.com *.dev-cmsc.oneskyit.com dev-idaa.oneskyit.com *.dev-idaa.oneskyit.com dev-ishlt.oneskyit.com *.dev-ishlt.oneskyit.com dev-ncsd.oneskyit.com *.dev-ncsd.oneskyit.com dev-npa.oneskyit.com *.dev-npa.oneskyit.com dev-rli.oneskyit.com *.dev-rli.oneskyit.com test-app.oneskyit.com"
|
||||
- NGINX_SERVER_NAMES="flask_gunicorn.localhost 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"
|
||||
ports:
|
||||
- "${OSIT_WEB_HTTP_PORT}:80"
|
||||
- "${OSIT_WEB_HTTPS_PORT}:443"
|
||||
# - "80:80"
|
||||
# - "443:443"
|
||||
# - "8181:80"
|
||||
# - "8443:443"
|
||||
# networks:
|
||||
# - local-net
|
||||
volumes:
|
||||
- ./srv/html_php:/srv/html_php
|
||||
- ./srv/oneskyit_site:/srv/oneskyit_site
|
||||
|
||||
- ./srv/hosted_files_ln:/srv/hosted_files
|
||||
- ./srv/hosted_tmp_ln:/srv/hosted_tmp
|
||||
- ${HOSTED_FILES_SRC}:/srv/hosted_files
|
||||
- ${HOSTED_TMP_SRC}:/srv/hosted_tmp
|
||||
|
||||
# - ./conf/nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./conf/nginx/options-ssl-nginx.conf:/etc/nginx/options-ssl-nginx.conf
|
||||
# - ./conf/nginx/other.conf:/etc/nginx/conf.d/other.conf
|
||||
|
||||
- ./conf/nginx/site.conf:/etc/nginx/conf.d/0_site.conf
|
||||
|
||||
- ./conf/nginx/site-enabled_aether_fastapi_gunicorn.conf:/etc/nginx/templates/site-enabled_aether_fastapi_gunicorn.conf.template
|
||||
# - ./conf/nginx/site-enabled_aether_api_v5_fastapi_gunicorn.conf:/etc/nginx/templates/site-enabled_aether_api_v5_fastapi_gunicorn.conf.template
|
||||
- ./conf/nginx/site-enabled_aether_flask_gunicorn.conf:/etc/nginx/templates/site-enabled_aether_flask_gunicorn.conf.template
|
||||
|
||||
- ./conf/certs/oneskyit_wild_fullchain.pem:/etc/certs/fullchain_wild.pem
|
||||
@@ -53,84 +35,49 @@ services:
|
||||
|
||||
- ./logs/web:/logs
|
||||
depends_on:
|
||||
# - php7
|
||||
# - aether_api_gunicorn
|
||||
- aether_api_gunicorn_red
|
||||
- aether_api_gunicorn_green
|
||||
# - aether_api_v5_gunicorn
|
||||
- aether_app_gunicorn
|
||||
|
||||
|
||||
# Need to fix the memory overcommit warning from Redis
|
||||
# https://ourcodeworld.com/articles/read/2083/how-to-remove-redis-warning-on-docker-memory-overcommit-must-be-enabled
|
||||
redis:
|
||||
restart: always
|
||||
container_name: ${CONTAINER_REDIS}
|
||||
image: redis
|
||||
# By default redis saves every 3600 seconds if there is at least 1 change.
|
||||
command: redis-server --save "" --loglevel warning
|
||||
# command: redis-server --save 60 1 --loglevel warning
|
||||
# build:
|
||||
# ports:
|
||||
# # host to image
|
||||
# # default port is 6379
|
||||
# - "${AE_REDIS_PORT}:6379"
|
||||
|
||||
# API - Default
|
||||
# aether_api_gunicorn:
|
||||
# restart: always
|
||||
# container_name: ${CONTAINER_AE_API}
|
||||
# build:
|
||||
# # context: ./builds
|
||||
# context: ./
|
||||
# dockerfile: aether_fastapi_gunicorn.Dockerfile
|
||||
# env_file:
|
||||
# - ./.env
|
||||
# environment:
|
||||
# - PUID=1000
|
||||
# - PGID=1000
|
||||
# ports:
|
||||
# - "${AE_API_GUNICORN_PORT}:5005"
|
||||
# extra_hosts:
|
||||
# - "${DOCKER_AE_SERVER_EXTRA_HOST}"
|
||||
# - "${DOCKER_AE_APP_SERVER_EXTRA_HOST}"
|
||||
# - "${DOCKER_AE_API_SERVER_EXTRA_HOST}"
|
||||
# - "${DOCKER_AE_API_BAK_SERVER_EXTRA_HOST}"
|
||||
# - "${DOCKER_AE_DB_SERVER_EXTRA_HOST}"
|
||||
# - "linode.oneskyit.com:104.237.143.4"
|
||||
# # - "db.oneskyit.com:104.237.143.4"
|
||||
# # expose:
|
||||
# # - 5005
|
||||
# # networks:
|
||||
# # - local-net
|
||||
# volumes:
|
||||
# - ./conf/aether_fastapi_gunicorn_conf.py:/conf/gunicorn_fastapi_conf.py
|
||||
# - ./conf/aether_fastapi_requirements_current.txt:/requirements_current.txt
|
||||
# - ./conf/aether_api_config.py:/srv/aether_api/app/config.py
|
||||
mariadb:
|
||||
restart: always
|
||||
image: mariadb:10.11
|
||||
container_name: ae_mariadb_dev
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${AE_DB_PASSWORD}
|
||||
MYSQL_DATABASE: ${AE_DB_NAME}
|
||||
MYSQL_USER: ${AE_DB_USERNAME}
|
||||
MYSQL_PASSWORD: ${AE_DB_PASSWORD}
|
||||
volumes:
|
||||
- ./srv/mariadb:/var/lib/mysql
|
||||
ports:
|
||||
- "3306:3306"
|
||||
|
||||
# - ./logs/ae_api:/logs
|
||||
|
||||
# - ./srv/aether_api_ln:/srv/aether_api
|
||||
# - ./srv/hosted_files_ln:/srv/hosted_files
|
||||
# - ./srv/hosted_tmp_ln:/srv/hosted_tmp
|
||||
|
||||
# # - ./tmp/ae_api:/tmp
|
||||
# # - ./tmp/root/aether_fastapi_requirements_current.txt:/aether_fastapi_requirements_current.txt
|
||||
# # - ./temp/ae_api/aether_fastapi_requirements_current.txt:/temp/aether_fastapi_requirements_current.txt
|
||||
# # - ./tmp/test:/var
|
||||
# # links:
|
||||
# # - redis
|
||||
# depends_on:
|
||||
# - redis
|
||||
# stdin_open: true # docker run -i
|
||||
# tty: true # docker run -t
|
||||
phpmyadmin:
|
||||
restart: always
|
||||
image: phpmyadmin/phpmyadmin
|
||||
container_name: ae_pma_dev
|
||||
environment:
|
||||
PMA_HOST: mariadb
|
||||
UPLOAD_LIMIT: 64M
|
||||
ports:
|
||||
- "${AE_PMA_PORT}:80"
|
||||
depends_on:
|
||||
- mariadb
|
||||
|
||||
# API - Red
|
||||
aether_api_gunicorn_red:
|
||||
restart: always
|
||||
container_name: ${CONTAINER_AE_API_RED}
|
||||
build:
|
||||
# context: ./builds
|
||||
context: ./
|
||||
dockerfile: aether_fastapi_gunicorn.Dockerfile
|
||||
env_file:
|
||||
@@ -144,11 +91,6 @@ services:
|
||||
- "${DOCKER_AE_API_BAK_SERVER_EXTRA_HOST}"
|
||||
- "${DOCKER_AE_DB_SERVER_EXTRA_HOST}"
|
||||
- "linode.oneskyit.com:104.237.143.4"
|
||||
# - "db.oneskyit.com:104.237.143.4"
|
||||
# expose:
|
||||
# - 5005
|
||||
# networks:
|
||||
# - local-net
|
||||
volumes:
|
||||
- ./conf/aether_fastapi_gunicorn_conf.py:/conf/gunicorn_fastapi_conf.py
|
||||
- ./conf/aether_fastapi_requirements_current.txt:/requirements_current.txt
|
||||
@@ -156,25 +98,22 @@ services:
|
||||
|
||||
- ./logs/ae_api:/logs
|
||||
|
||||
- ./srv/aether_api_ln:/srv/aether_api
|
||||
- ./srv/hosted_files_ln:/srv/hosted_files
|
||||
- ./srv/hosted_tmp_ln:/srv/hosted_tmp
|
||||
- ${AE_API_SRC}:/srv/aether_api
|
||||
- ${HOSTED_FILES_SRC}:/srv/hosted_files
|
||||
- ${HOSTED_TMP_SRC}:/srv/hosted_tmp
|
||||
|
||||
# - ./tmp/ae_api:/tmp
|
||||
- ./temp/ae_api:/temp
|
||||
# links:
|
||||
# - redis
|
||||
depends_on:
|
||||
- redis
|
||||
stdin_open: true # docker run -i
|
||||
tty: true # docker run -t
|
||||
- mariadb
|
||||
stdin_open: true
|
||||
tty: true
|
||||
|
||||
# API - Green
|
||||
aether_api_gunicorn_green:
|
||||
restart: always
|
||||
container_name: ${CONTAINER_AE_API_GREEN}
|
||||
build:
|
||||
# context: ./builds
|
||||
context: ./
|
||||
dockerfile: aether_fastapi_gunicorn.Dockerfile
|
||||
env_file:
|
||||
@@ -188,11 +127,6 @@ services:
|
||||
- "${DOCKER_AE_API_BAK_SERVER_EXTRA_HOST}"
|
||||
- "${DOCKER_AE_DB_SERVER_EXTRA_HOST}"
|
||||
- "linode.oneskyit.com:104.237.143.4"
|
||||
# - "db.oneskyit.com:104.237.143.4"
|
||||
# expose:
|
||||
# - 5005
|
||||
# networks:
|
||||
# - local-net
|
||||
volumes:
|
||||
- ./conf/aether_fastapi_gunicorn_conf.py:/conf/gunicorn_fastapi_conf.py
|
||||
- ./conf/aether_fastapi_requirements_current.txt:/requirements_current.txt
|
||||
@@ -200,173 +134,44 @@ services:
|
||||
|
||||
- ./logs/ae_api:/logs
|
||||
|
||||
- ./srv/aether_api_ln:/srv/aether_api
|
||||
- ./srv/hosted_files_ln:/srv/hosted_files
|
||||
- ./srv/hosted_tmp_ln:/srv/hosted_tmp
|
||||
- ${AE_API_SRC}:/srv/aether_api
|
||||
- ${HOSTED_FILES_SRC}:/srv/hosted_files
|
||||
- ${HOSTED_TMP_SRC}:/srv/hosted_tmp
|
||||
|
||||
# - ./tmp/ae_api:/tmp
|
||||
- ./temp/ae_api:/temp
|
||||
# links:
|
||||
# - redis
|
||||
depends_on:
|
||||
- redis
|
||||
stdin_open: true # docker run -i
|
||||
tty: true # docker run -t
|
||||
|
||||
# API - Blue
|
||||
# aether_api_gunicorn_blue:
|
||||
# restart: always
|
||||
# container_name: ${CONTAINER_AE_API_BLUE}
|
||||
# build:
|
||||
# # context: ./builds
|
||||
# context: ./
|
||||
# dockerfile: aether_fastapi_gunicorn.Dockerfile
|
||||
# env_file:
|
||||
# - ./.env
|
||||
# ports:
|
||||
# - "${AE_API_GUNICORN_PORT_BLUE}:5005"
|
||||
# extra_hosts:
|
||||
# - "${DOCKER_AE_SERVER_EXTRA_HOST}"
|
||||
# - "${DOCKER_AE_APP_SERVER_EXTRA_HOST}"
|
||||
# - "${DOCKER_AE_API_SERVER_EXTRA_HOST}"
|
||||
# - "${DOCKER_AE_API_BAK_SERVER_EXTRA_HOST}"
|
||||
# - "${DOCKER_AE_DB_SERVER_EXTRA_HOST}"
|
||||
# - "linode.oneskyit.com:104.237.143.4"
|
||||
# # - "db.oneskyit.com:104.237.143.4"
|
||||
# # expose:
|
||||
# # - 5005
|
||||
# # networks:
|
||||
# # - local-net
|
||||
# volumes:
|
||||
# - ./conf/aether_fastapi_gunicorn_conf.py:/conf/gunicorn_fastapi_conf.py
|
||||
# - ./conf/aether_fastapi_requirements_current.txt:/requirements_current.txt
|
||||
# - ./conf/aether_api_config.py:/srv/aether_api/app/config.py
|
||||
|
||||
# - ./logs/ae_api:/logs
|
||||
|
||||
# - ./srv/aether_api_ln:/srv/aether_api
|
||||
# - ./srv/hosted_files_ln:/srv/hosted_files
|
||||
# - ./srv/hosted_tmp_ln:/srv/hosted_tmp
|
||||
|
||||
# # - ./tmp/ae_api:/tmp
|
||||
# - ./temp/ae_api:/temp
|
||||
# # links:
|
||||
# # - redis
|
||||
# depends_on:
|
||||
# - redis
|
||||
# stdin_open: true # docker run -i
|
||||
# tty: true # docker run -t
|
||||
|
||||
# API - Black
|
||||
# aether_api_gunicorn_black:
|
||||
# restart: always
|
||||
# container_name: ${CONTAINER_AE_API_BLACK}
|
||||
# build:
|
||||
# # context: ./builds
|
||||
# context: ./
|
||||
# dockerfile: aether_fastapi_gunicorn.Dockerfile
|
||||
# env_file:
|
||||
# - ./.env
|
||||
# ports:
|
||||
# - "${AE_API_GUNICORN_PORT_BLACK}:5005"
|
||||
# extra_hosts:
|
||||
# - "${DOCKER_AE_SERVER_EXTRA_HOST}"
|
||||
# - "${DOCKER_AE_APP_SERVER_EXTRA_HOST}"
|
||||
# - "${DOCKER_AE_API_SERVER_EXTRA_HOST}"
|
||||
# - "${DOCKER_AE_API_BAK_SERVER_EXTRA_HOST}"
|
||||
# - "${DOCKER_AE_DB_SERVER_EXTRA_HOST}"
|
||||
# - "linode.oneskyit.com:104.237.143.4"
|
||||
# # - "db.oneskyit.com:104.237.143.4"
|
||||
# volumes:
|
||||
# - ./conf/aether_fastapi_gunicorn_conf.py:/conf/gunicorn_fastapi_conf.py
|
||||
# - ./conf/aether_fastapi_requirements_current.txt:/requirements_current.txt
|
||||
# - ./conf/aether_api_config.py:/srv/aether_api/app/config.py
|
||||
|
||||
# - ./logs/ae_api:/logs
|
||||
|
||||
# - ./srv/aether_api_ln:/srv/aether_api
|
||||
# - ./srv/hosted_files_ln:/srv/hosted_files
|
||||
# - ./srv/hosted_tmp_ln:/srv/hosted_tmp
|
||||
|
||||
# - ./temp/ae_api:/temp
|
||||
# depends_on:
|
||||
# - redis
|
||||
# stdin_open: true
|
||||
# tty: true
|
||||
|
||||
# API - White
|
||||
# aether_api_gunicorn_white:
|
||||
# restart: always
|
||||
# container_name: ${CONTAINER_AE_API_WHITE}
|
||||
# build:
|
||||
# context: ./
|
||||
# dockerfile: aether_fastapi_gunicorn.Dockerfile
|
||||
# env_file:
|
||||
# - ./.env
|
||||
# ports:
|
||||
# - "${AE_API_GUNICORN_PORT_WHITE}:5005"
|
||||
# extra_hosts:
|
||||
# - "${DOCKER_AE_SERVER_EXTRA_HOST}"
|
||||
# - "${DOCKER_AE_APP_SERVER_EXTRA_HOST}"
|
||||
# - "${DOCKER_AE_API_SERVER_EXTRA_HOST}"
|
||||
# - "${DOCKER_AE_API_BAK_SERVER_EXTRA_HOST}"
|
||||
# volumes:
|
||||
# - ./conf/aether_fastapi_gunicorn_conf.py:/conf/gunicorn_fastapi_conf.py
|
||||
# - ./conf/aether_fastapi_requirements_current.txt:/requirements_current.txt
|
||||
# - ./conf/aether_api_config.py:/srv/aether_api/app/config.py
|
||||
|
||||
# - ./logs/ae_api:/logs
|
||||
|
||||
# - ./srv/aether_api_ln:/srv/aether_api
|
||||
# - ./srv/hosted_files_ln:/srv/hosted_files
|
||||
# - ./srv/hosted_tmp_ln:/srv/hosted_tmp
|
||||
|
||||
# - ./temp/ae_api:/temp
|
||||
# depends_on:
|
||||
# - redis
|
||||
# stdin_open: true
|
||||
# tty: true
|
||||
|
||||
- mariadb
|
||||
stdin_open: true
|
||||
tty: true
|
||||
|
||||
aether_app_gunicorn:
|
||||
restart: always
|
||||
container_name: ${CONTAINER_AE_APP}
|
||||
build:
|
||||
# context: ./builds
|
||||
context: ./
|
||||
dockerfile: aether_flask_gunicorn.Dockerfile
|
||||
# image: tiangolo/uvicorn-gunicorn:latest
|
||||
env_file:
|
||||
- ./.env
|
||||
ports:
|
||||
- "${AE_APP_GUNICORN_PORT}:5005"
|
||||
# expose:
|
||||
# - 5005
|
||||
# networks:
|
||||
# - local-net
|
||||
extra_hosts:
|
||||
- "${DOCKER_AE_SERVER_EXTRA_HOST}"
|
||||
- "${DOCKER_AE_API_SERVER_EXTRA_HOST}"
|
||||
- "${DOCKER_AE_API_BAK_SERVER_EXTRA_HOST}"
|
||||
# - "${DOCKER_AE_API_V5_SERVER_EXTRA_HOST}"
|
||||
# - dev-api.oneskyit.com:192.168.32.20
|
||||
volumes:
|
||||
- ./conf/aether_flask_gunicorn_conf.py:/conf/gunicorn_flask_conf.py
|
||||
- ./conf/aether_flask_requirements_current.txt:/requirements_current.txt
|
||||
- ./conf/aether_app_config.py:/srv/aether_app/flask_config_v2.py
|
||||
- ./logs/ae_app:/logs
|
||||
# - ./logs/aether_flask_gunicorn_access.log:/logs/gunicorn_access.log
|
||||
# - ./logs/aether_flask_gunicorn_error.log:/logs/gunicorn_error.log
|
||||
# - ./logs/aether_app.log:/logs/aether_app.log
|
||||
# - ./logs/aether_app_warning.log:/logs/aether_app_warning.log
|
||||
- ./srv/aether_app_ln:/srv/aether_app
|
||||
- ./srv/hosted_files_ln:/srv/hosted_files
|
||||
- ./srv/hosted_tmp_ln:/srv/hosted_tmp
|
||||
|
||||
- ${AE_APP_SRC}:/srv/aether_app
|
||||
- ${HOSTED_FILES_SRC}:/srv/hosted_files
|
||||
- ${HOSTED_TMP_SRC}:/srv/hosted_tmp
|
||||
|
||||
- ./tmp/ae_app:/tmp
|
||||
depends_on:
|
||||
# - aether_api_gunicorn
|
||||
- aether_api_gunicorn_red
|
||||
- aether_api_gunicorn_green
|
||||
stdin_open: true # docker run -i
|
||||
tty: true # docker run -t
|
||||
stdin_open: true
|
||||
tty: true
|
||||
@@ -1,3 +0,0 @@
|
||||
# FROM php:5.6.20
|
||||
FROM php:5-fpm
|
||||
RUN docker-php-ext-install mysqli
|
||||
@@ -1,2 +0,0 @@
|
||||
FROM php:7-fpm
|
||||
RUN docker-php-ext-install mysqli
|
||||
49
restore_db.sh
Executable file
49
restore_db.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
# Aether MariaDB Restore Script (Physical Backup)
|
||||
# Automates: Stop -> Backup existing -> Extract -> Prepare -> Fix Perms -> Start
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_ROOT="/home/scott/OSIT_dev/aether_container_env"
|
||||
BACKUP_FILE="${PROJECT_ROOT}/backups/mariadbbackup_1555.gz"
|
||||
MARIADB_DATA="${PROJECT_ROOT}/srv/mariadb"
|
||||
RESTORE_TEMP="${PROJECT_ROOT}/srv/restore_temp"
|
||||
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
||||
|
||||
echo "--- Starting Aether Database Restore ---"
|
||||
|
||||
# 1. Stop MariaDB
|
||||
echo ">>> Stopping MariaDB container..."
|
||||
cd "${PROJECT_ROOT}" && docker compose stop mariadb
|
||||
|
||||
# 2. Archive current data
|
||||
if [ "$(ls -A ${MARIADB_DATA})" ]; then
|
||||
echo ">>> Archiving current data to srv/mariadb_bak_${TIMESTAMP}..."
|
||||
mv "${MARIADB_DATA}" "${PROJECT_ROOT}/srv/mariadb_bak_${TIMESTAMP}"
|
||||
fi
|
||||
mkdir -p "${MARIADB_DATA}" "${RESTORE_TEMP}"
|
||||
|
||||
# 3. Extract and Prepare using Docker
|
||||
echo ">>> Running extraction and preparation in temporary container..."
|
||||
docker run --rm --user 0 \
|
||||
-v "${PROJECT_ROOT}/backups":/backups \
|
||||
-v "${RESTORE_TEMP}":/restore \
|
||||
-v "${PROJECT_ROOT}/scripts/restore_internal.sh":/restore.sh \
|
||||
mariadb:10.11 bash /restore.sh
|
||||
|
||||
# 4. Move prepared data to final location
|
||||
echo ">>> Moving prepared data to srv/mariadb..."
|
||||
mv "${RESTORE_TEMP}"/* "${MARIADB_DATA}/"
|
||||
mv "${RESTORE_TEMP}"/.* "${MARIADB_DATA}/" 2>/dev/null || true
|
||||
rmdir "${RESTORE_TEMP}"
|
||||
|
||||
# 5. Fix Permissions
|
||||
echo ">>> Fixing ownership for MariaDB user (999:999)..."
|
||||
docker run --rm -v "${MARIADB_DATA}":/var/lib/mysql alpine chown -R 999:999 /var/lib/mysql
|
||||
|
||||
# 6. Start MariaDB
|
||||
echo ">>> Starting MariaDB container..."
|
||||
docker compose start mariadb
|
||||
|
||||
echo "--- Restore Complete! Check logs with 'docker logs ae_mariadb_dev' ---"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/home/scott/OSIT_dev/aether_api_fastapi
|
||||
@@ -1 +0,0 @@
|
||||
/home/scott/OSIT_dev/aether_app_flask
|
||||
@@ -1 +0,0 @@
|
||||
/home/scott/OSIT/hosted_files
|
||||
@@ -1 +0,0 @@
|
||||
/home/scott/OSIT/hosted_tmp
|
||||
4
srv/mariadb/.gitignore
vendored
4
srv/mariadb/.gitignore
vendored
@@ -1,4 +0,0 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except for this file
|
||||
!.gitignore
|
||||
Reference in New Issue
Block a user