diff --git a/docker-compose.yml b/docker-compose.yml index 066feb8..30dce0b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,31 +1,30 @@ -version: "3.8" - -services: - db: - image: postgres:14 - restart: always - volumes: - - db_data:/var/lib/postgresql/data - environment: - POSTGRES_USER: ${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-passwd} - POSTGRES_DB: db - PGDATABASE: db - PGPASSWORD: ${POSTGRES_PASSWORD:-passwd} - PGUSER: ${POSTGRES_USER:-postgres} - ports: - - 127.0.0.1:${LOCAL_DB_PORT:-15432}:5432 - - app: - build: . - # restart: always - command: sh ./start_server.sh - environment: - APP_ENV: production - depends_on: - - db - ports: - - 127.0.0.1:${LOCAL_WEB_PORT:-8000}:8000 - -volumes: - db_data: +version: "3.8" + +services: + db: + image: postgres:14 + restart: always + volumes: + - db_data:/var/lib/postgresql/data + environment: + POSTGRES_USER: ${POSTGRES_USER:-postgres} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-passwd} + POSTGRES_DB: db + PGDATABASE: db + PGPASSWORD: ${POSTGRES_PASSWORD:-passwd} + PGUSER: ${POSTGRES_USER:-postgres} + ports: + - '127.0.0.1:${LOCAL_DB_PORT:-15432}:5432' + + app: + build: . + # restart: always + command: sh ./start_server.sh + env_file: ./project.env + depends_on: + - db + ports: + - '127.0.0.1:${LOCAL_WEB_PORT:-8000}:${LOCAL_WEB_PORT:-8000}' + +volumes: + db_data: diff --git a/project.env b/project.env index 4c58e05..0dbc047 100644 --- a/project.env +++ b/project.env @@ -1,8 +1,9 @@ # Put environment variables that hold sensitive data such as passwords here. # NOTE: This file will not be placed under version control. +APP_ENV=production APP_NAME=Open Law -SERVER_NAME=127.0.0.1:5006 +SERVER_NAME=127.0.0.1:8000 SECRET_KEY=set_here_secret # Database @@ -17,8 +18,7 @@ DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGR DEVEL_DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@127.0.0.1:${LOCAL_DB_PORT}/${POSTGRES_DB} # WEB app -LOCAL_WEB_PORT=8080 - +LOCAL_WEB_PORT=8000 # Super admin ADMIN_USERNAME=admin diff --git a/start_server.sh b/start_server.sh index 81198cb..e889b3a 100644 --- a/start_server.sh +++ b/start_server.sh @@ -4,4 +4,4 @@ poetry run flask db upgrade # echo Run app # flask run -h 0.0.0.0 echo Run app server -poetry run gunicorn -w 4 -b 0.0.0.0 'wsgi:app' $@ +poetry run gunicorn -w 4 -b "0.0.0.0:$LOCAL_WEB_PORT" 'wsgi:app' $@