Initial commit.

This commit is contained in:
2025-07-12 09:07:17 +02:00
commit 24bc192085
7 changed files with 170 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
# web app
app/
app/*
# environment variables
*.env

33
Dockerfile Normal file
View File

@@ -0,0 +1,33 @@
FROM python:3.11-slim
# Install only the necessary client libraries
RUN apt-get update && apt-get install -y \
default-libmysqlclient-dev \
build-essential \
pkg-config \
wait-for-it \
# curl \
# && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
# && apt-get install -y node.js \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app/ .
# # Install npm dependencies and build static assets
# RUN if [ -f "package.json" ]; then npm install && npm run build; fi
ENV FLASK_APP=app.py
ENV FLASK_ENV=production
CMD echo "PW=$DB_PASSWORD"
EXPOSE 8569
# CMD ["gunicorn", "--bind", "0.0.0.0:8569", "app:app"]
CMD wait-for-it dev_partsltd_co_uk_db:3306 -t 60 -- gunicorn --bind 0.0.0.0:8569 app:app
# --access-logfile - --access-logformat '%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"' app:app

53
docker-compose.yml Normal file
View File

@@ -0,0 +1,53 @@
version: '3.8'
services:
molly_teddy_org_uk:
build: .
container_name: molly_teddy_org_uk
restart: unless-stopped
environment:
SQLALCHEMY_DATABASE_URI: ${SQLALCHEMY_DATABASE_URI}
WAIT_HOSTS: ${DB_SERVICE}:3306
WAIT_TIMEOUT: 300
WAIT_SLEEP_INTERVAL: 5
WAIT_HOST_CONNECT_TIMEOUT: 30
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
DB_NAME: ${DB_NAME}
KEY_SECRET_FLASK: ${KEY_SECRET_FLASK}
FLASK_ENV: ${FLASK_ENV}
ID_AUTH0_CLIENT: ${ID_AUTH0_CLIENT}
ID_AUTH0_CLIENT_SECRET: ${ID_AUTH0_CLIENT_SECRET}
DOMAIN_AUTH0: ${DOMAIN_AUTH0}
MAIL_PASSWORD: ${MAIL_PASSWORD}
MAIL_CONTACT_PUBLIC: ${MAIL_CONTACT_PUBLIC}
MAIL_DEFAULT_SENDER: ${MAIL_DEFAULT_SENDER}
RECAPTCHA_PUBLIC_KEY: ${RECAPTCHA_PUBLIC_KEY}
RECAPTCHA_PRIVATE_KEY: ${RECAPTCHA_PRIVATE_KEY}
URL_HOST: ${URL_HOST}
external_links:
- dev_partsltd_co_uk_db:dev_partsltd_co_uk_db
#depends_on:
#dev_partsltd_co_uk_db:
#condition: service_healthy
networks:
- traefik-public
expose:
- "8569"
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik-public"
- "traefik.http.routers.molly-teddy-org-uk.rule=Host(`molly.teddy.org.uk`)"
- "traefik.http.routers.molly-teddy-org-uk.entrypoints=https"
- "traefik.http.routers.molly-teddy-org-uk.tls=true"
- "traefik.http.routers.molly-teddy-org-uk.tls.certresolver=le"
- "traefik.http.services.molly-teddy-org-uk.loadbalancer.server.port=8569"
- "traefik.http.routers.molly-teddy-org-uk-http.rule=Host(`molly.teddy.org.uk`)"
- "traefik.http.routers.molly-teddy-org-uk-http.entrypoints=http"
- "traefik.http.routers.molly-teddy-org-uk-http.middlewares=https-redirect"
# @docker
networks:
traefik-public:
#driver: bridge
name: traefik-public
external: true

5
init.sql Normal file
View File

@@ -0,0 +1,5 @@
-- init.sql
CREATE DATABASE IF NOT EXISTS demo;
CREATE USER IF NOT EXISTS 'teddy'@'%' IDENTIFIED BY 'slap_chop_rinse_erect';
GRANT ALL PRIVILEGES ON demo.* TO 'teddy'@'%';
FLUSH PRIVILEGES;

39
nginx.conf Normal file
View File

@@ -0,0 +1,39 @@
user nginx;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 1024;
multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# Set default MIME type
default_type application/octet-stream;
# SSL Settings
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
# Logging Settings
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# Gzip Settings
gzip on;
gzip_disable "msie6";
# Virtual Host Configs
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*.conf;
# MIME Types
include /etc/nginx/mime.types;
}

18
requirements.txt Normal file
View File

@@ -0,0 +1,18 @@
Flask==3.0.3
gunicorn==23.0.0
flask_wtf
flask_sqlalchemy
flask_cors
flask_mail
authlib
jwt
mysqlclient
stripe
python_dotenv
authlib
pydantic
# psycopg2
requests
cryptography
altcha

16
requirements.txt.bak Normal file
View File

@@ -0,0 +1,16 @@
Flask==3.0.3
gunicorn==23.0.0
flask_wtf
flask_sqlalchemy
flask_cors
flask_mail
authlib
jwt
mysqlclient
stripe
python_dotenv
authlib
pydantic
# psycopg2
requests