Architecture: Finalized dynamic scaling and Nginx gateway port configuration.

This commit is contained in:
Scott Idem
2026-01-12 17:10:16 -05:00
parent 6ee6f24c00
commit 7bce390e5f
3 changed files with 11 additions and 79 deletions

View File

@@ -164,27 +164,7 @@ server {
upstream fastapi_backend {
# Balancing: Comment out both ip_hash and least_conn to use the default of round robin
# hash $binary_remote_addr consistent;
# IP hash for sticky sessions/connections load balancing method
# ip_hash;
# Least connections balancing method
least_conn;
# zone backend 64k; # Use NGINX Plus' shared memory
# Development Environment
# larger number will recieve more requests
# Example of 20 vs 10: 20 will recieve twice as many requests as 10
# server aether_api_gunicorn:5005 weight=20 max_fails=1 fail_timeout=5s;
server aether_api_gunicorn_red:5005 weight=20 max_fails=1 fail_timeout=5s;
server aether_api_gunicorn_green:5005 weight=20 max_fails=1 fail_timeout=5s;
# server aether_api_gunicorn_blue:5005 weight=20 max_fails=1 fail_timeout=5s;
# server aether_api_gunicorn_black:5005 weight=20 max_fails=1 fail_timeout=5s;
# server aether_api_gunicorn_white:5005 weight=20 max_fails=1 fail_timeout=5s;
# maintain up to 20 idle connections to the group of upstream servers
server ae_api:5005 weight=20 max_fails=1 fail_timeout=5s;
keepalive 10;
}

View File

@@ -14,29 +14,24 @@ services:
ports:
- "${OSIT_WEB_HTTP_PORT}:80"
- "${OSIT_WEB_HTTPS_PORT}:443"
- "${AE_API_GATEWAY_PORT}:80" # Entry point for external API traffic (HTTP)
volumes:
- ./srv/html_php:/srv/html_php
- ./srv/oneskyit_site:/srv/oneskyit_site
- ${HOSTED_FILES_SRC}:/srv/hosted_files
- ${HOSTED_TMP_SRC}:/srv/hosted_tmp
- ./conf/nginx/options-ssl-nginx.conf:/etc/nginx/options-ssl-nginx.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_flask_gunicorn.conf:/etc/nginx/templates/site-enabled_aether_flask_gunicorn.conf.template
- ./conf/certs/oneskyit_wild_fullchain.pem:/etc/certs/fullchain_wild.pem
- ./conf/certs/oneskyit_wild_privkey.pem:/etc/certs/privkey_wild.pem
- ./conf/certs/oneskyit.com_fullchain.pem:/etc/certs/fullchain.pem
- ./conf/certs/oneskyit.com_privkey.pem:/etc/certs/privkey.pem
- ./conf/certs/ssl-dhparams.pem:/etc/certs/ssl-dhparams.pem
- ./logs/web:/logs
depends_on:
- aether_api_gunicorn_red
- aether_api_gunicorn_green
- ae_api
- aether_app_gunicorn
redis:
@@ -44,8 +39,6 @@ services:
container_name: ${CONTAINER_REDIS}
image: redis
command: redis-server --save "" --loglevel warning
# ports:
# - "${AE_REDIS_PORT}:6379"
mariadb:
restart: always
@@ -83,17 +76,15 @@ services:
depends_on:
- mariadb
# API - Red
aether_api_gunicorn_red:
ae_api:
restart: always
container_name: ${CONTAINER_AE_API_RED}
# We don't use container_name here so we can scale
build:
context: ./
dockerfile: aether_fastapi_gunicorn.Dockerfile
scale: ${AE_API_REPLICAS}
env_file:
- ./.env
ports:
- "${AE_API_GUNICORN_PORT_RED}:5005"
extra_hosts:
- "${DOCKER_AE_SERVER_EXTRA_HOST}"
- "${DOCKER_AE_APP_SERVER_EXTRA_HOST}"
@@ -105,49 +96,10 @@ services:
- ./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
- ${AE_API_SRC}:/srv/aether_api
- ${HOSTED_FILES_SRC}:/srv/hosted_files
- ${HOSTED_TMP_SRC}:/srv/hosted_tmp
- ./temp/ae_api:/temp
depends_on:
- redis
- mariadb
stdin_open: true
tty: true
# API - Green
aether_api_gunicorn_green:
restart: always
container_name: ${CONTAINER_AE_API_GREEN}
build:
context: ./
dockerfile: aether_fastapi_gunicorn.Dockerfile
env_file:
- ./.env
ports:
- "${AE_API_GUNICORN_PORT_GREEN}: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"
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
- ${AE_API_SRC}:/srv/aether_api
- ${HOSTED_FILES_SRC}:/srv/hosted_files
- ${HOSTED_TMP_SRC}:/srv/hosted_tmp
- ./temp/ae_api:/temp
depends_on:
- redis
@@ -174,14 +126,11 @@ services:
- ./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
- ${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_red
- aether_api_gunicorn_green
- ae_api
stdin_open: true
tty: true
tty: true

View File

@@ -119,6 +119,9 @@ HOSTED_TMP_SRC=/path/to/hosted_tmp
# SERVICES CONFIG
# ------------------------------------------------------------------------------
AE_PMA_PORT=8081
AE_API_GATEWAY_PORT=5060
AE_API_REPLICAS=2
# MariaDB Tuning (Adjust per environment hardware)
MARIADB_MAX_CONNECTIONS=500