Refactor Docker setup and migrate to PostgreSQL
Streamlined Dockerfiles with clearer ENV variables and build args. Switched backend database from MySQL to PostgreSQL, updated configurations accordingly, and added robust Docker Compose services for better orchestration, including health checks and persistent storage.
This commit is contained in:
@ -15,6 +15,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gpg && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# May need to install postgreSQL and run the server within the docker
|
||||
|
||||
# Download and install the msodbcsql18 driver for arm64-compatible base image
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends unixodbc-dev curl apt-transport-https gnupg && \
|
||||
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.asc.gpg && \
|
||||
|
@ -26,7 +26,9 @@ else: # Default is dev
|
||||
db_host = os.getenv("DB_HOST", "localhost")
|
||||
db_name = os.getenv("DB_NAME", "aare_dev_db")
|
||||
|
||||
SQLALCHEMY_DATABASE_URL = f"mysql://{db_username}:{db_password}@{db_host}/{db_name}"
|
||||
SQLALCHEMY_DATABASE_URL = (
|
||||
f"postgresql://{db_username}:{db_password}@{db_host}/{db_name}"
|
||||
)
|
||||
|
||||
# Create engine and session
|
||||
engine = create_engine(SQLALCHEMY_DATABASE_URL)
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"ssl_cert_path": "ssl/cert.pem",
|
||||
"ssl_key_path": "ssl/key.pem",
|
||||
"OPENAPI_URL": "https://127.0.0.1:8000/openapi.json",
|
||||
"SCHEMA_PATH": "./src/openapi.json",
|
||||
"OUTPUT_DIRECTORY": "./openapi",
|
||||
"ssl_cert_path": "/app/backend/ssl/cert.pem",
|
||||
"ssl_key_path": "/app/backend/ssl/key.pem",
|
||||
"OPENAPI_URL": "https://backend:8000/openapi.json",
|
||||
"SCHEMA_PATH": "/app/src/openapi.json",
|
||||
"OUTPUT_DIRECTORY": "/app/openapi",
|
||||
"PORT": 8000,
|
||||
"SSL_KEY_PATH": "../backend/ssl/key.pem",
|
||||
"SSL_CERT_PATH": "../backend/ssl/cert.pem"
|
||||
"SSL_KEY_PATH": "/app/backend/ssl/key.pem",
|
||||
"SSL_CERT_PATH": "/app/backend/ssl/cert.pem"
|
||||
}
|
@ -63,7 +63,7 @@ def run_server():
|
||||
print(f"[INFO] Running on port {port}")
|
||||
uvicorn.run(
|
||||
app,
|
||||
host="127.0.0.1" if environment in ["dev", "test"] else "0.0.0.0",
|
||||
host="0.0.0.0" if environment in ["dev", "test"] else "0.0.0.0",
|
||||
port=port,
|
||||
log_level="debug",
|
||||
ssl_keyfile=key_path,
|
||||
|
@ -28,7 +28,8 @@ dependencies = [
|
||||
"uvicorn==0.23.1",
|
||||
"python-dateutil~=2.8.2",
|
||||
"tomli>=2.0.1",
|
||||
"python-dotenv"
|
||||
"python-dotenv",
|
||||
"psycopg2-binary"
|
||||
]
|
||||
[tool.pytest.ini_options]
|
||||
norecursedirs = ["backend/python-client"]
|
||||
|
Reference in New Issue
Block a user