diff --git a/Makefile b/Makefile index 1ba6280..a9fd51e 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ DOCKER := docker -PROFILE := db wordpress webserver certbot phpmyadmin flask_website qbittorrent +PROFILE := wp_db wordpress webserver certbot phpmyadmin flask_website flask_db qbittorrent PROFILE_CMD := $(addprefix --profile ,$(PROFILE)) COMPOSE_FILE := docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml index 0c3d221..6635d95 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,8 +22,7 @@ services: image: mariadb:10.10.2 container_name: wp_db profiles: - - db - - wordpress + - wp_db restart: unless-stopped env_file: - env/wp_database.env @@ -51,14 +50,41 @@ services: flask_website: build: - context: ./flask + context: ./bensuperpc_website dockerfile: Dockerfile container_name: flask_website profiles: - flask_website + depends_on: + - flask_db volumes: - - ./flask:/app:rw + - ./bensuperpc_website:/app:rw + environment: + FLASK_DEBUG: "${FLASK_DEBUG:-1}" + POSTGRES_URL: "${POSTGRES_URL:-flask_db:5432}" + POSTGRES_USER: "${POSTGRES_USER:-postgres}" + POSTGRES_PW: "${POSTGRES_PW:-postgres}" + POSTGRES_DB: "${POSTGRES_DB:-website}" restart: unless-stopped + ports: + - 5000:5000 + networks: + - app-network + flask_db: + image: postgres:latest + container_name: flask_db + profiles: + - flask_db + restart: unless-stopped + environment: + POSTGRES_HOST_AUTH_METHOD: "${POSTGRES_HOST_AUTH_METHOD:-trust}" + POSTGRES_USER: "${POSTGRES_USER:-postgres}" + POSTGRES_PASSWORD: "${POSTGRES_PW:-postgres}" + POSTGRES_DB: "${POSTGRES_DB:-website}" +# ports: +# - 5432:5432 + volumes: + - postgres-data:/var/lib/postgresql/data networks: - app-network qbittorrent: @@ -117,6 +143,9 @@ volumes: downloads: name: downloads + postgres-data: + name: postgres-data + networks: app-network: driver: bridge diff --git a/flask/Dockerfile b/flask/Dockerfile deleted file mode 100644 index 1c7f06e..0000000 --- a/flask/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -ARG DOCKER_IMAGE=python:3.11-buster -FROM $DOCKER_IMAGE - -WORKDIR /app - -COPY requirements.txt requirements.txt - -RUN pip install --no-cache-dir -r requirements.txt - -EXPOSE 5000 - -CMD ["uwsgi", "app.ini"] diff --git a/flask/__pycache__/website.cpython-311.pyc b/flask/__pycache__/website.cpython-311.pyc deleted file mode 100644 index 88717ce..0000000 Binary files a/flask/__pycache__/website.cpython-311.pyc and /dev/null differ diff --git a/flask/app.ini b/flask/app.ini deleted file mode 100644 index 7f69240..0000000 --- a/flask/app.ini +++ /dev/null @@ -1,20 +0,0 @@ -[uwsgi] -plugins = python - -wsgi-file = wsgi.py -callable = app -# Or: module = wsgi:app - -socket = :8080 -# Or: socket = flask_server.sock -chmod-socket = 660 - -processes = 8 -threads = 2 -master = true - -vacuum = true -die-on-term = true -# enable-threads = true #enable threads support - -env = LANG=en_US.UTF-8 diff --git a/flask/requirements.txt b/flask/requirements.txt deleted file mode 100644 index 5bc97eb..0000000 --- a/flask/requirements.txt +++ /dev/null @@ -1,12 +0,0 @@ -requests - -flask -flask-babel -flask-login -flask-sqlalchemy -flask-assets -flask-wtf -flask-mail - - -uwsgi diff --git a/flask/website.py b/flask/website.py deleted file mode 100644 index 34b1c5c..0000000 --- a/flask/website.py +++ /dev/null @@ -1,9 +0,0 @@ -from flask import Flask -app = Flask(__name__) - -@app.route("/") -def hello(): - return "