diff --git a/.env b/.env index a3f34aef..2af46d8d 100644 --- a/.env +++ b/.env @@ -24,3 +24,5 @@ POSTGRES_PASSWORD=postgres # Host is postgres, as we're using docker and the service name is "postgres" POSTGRES_HOST=postgres POSTGRES_PORT=5432 + +POSTGRES_EXPOSE=127.0.0.1:5433 \ No newline at end of file diff --git a/.github/workflows/container-deploy.yml b/.github/workflows/container-deploy.yml index 010a8073..d666b772 100644 --- a/.github/workflows/container-deploy.yml +++ b/.github/workflows/container-deploy.yml @@ -32,7 +32,6 @@ jobs: - name: Set common variables run: | # We use the prod oauth server for all environments - echo "OAUTH2_SERVER_URL=https://world.openfoodfacts.org/cgi/auth.pl" >> $GITHUB_ENV echo "SSH_PROXY_HOST=ovh1.openfoodfacts.org" >> $GITHUB_ENV echo "SSH_USERNAME=off" >> $GITHUB_ENV - name: Set various variable for staging (net) deployment @@ -108,7 +107,7 @@ jobs: # Set Docker Compose variables echo "DOCKER_CLIENT_TIMEOUT=180" >> .env echo "COMPOSE_HTTP_TIMEOUT=180" >> .env - echo "COMPOSE_PROJECT_NAME=open-prices" >> .env + echo "COMPOSE_PROJECT_NAME=open_prices" >> .env echo "COMPOSE_PATH_SEPARATOR=;" >> .env echo "COMPOSE_FILE=docker-compose.yml;docker/prod.yml" >> .env # Set docker variables @@ -116,7 +115,13 @@ jobs: echo "RESTART_POLICY=always" >> .env # Set App variables echo "API_PORT=8190" >> .env + echo "OAUTH2_SERVER_URL=https://world.openfoodfacts.org/cgi/auth.pl" >> .env echo "SENTRY_DNS=${{ secrets.SENTRY_DSN }}" >> .env + echo "POSTGRES_EXPOSE=127.0.0.1:5433" >> .env + echo "POSTGRES_HOST=postgres.open_prices_default" >> .env + echo "POSTGRES_DB=postgres" >> .env + echo "POSTGRES_USER=postgres" >> .env + echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> .env - name: Create Docker volumes uses: appleboy/ssh-action@master diff --git a/Makefile b/Makefile index 9d57a048..c45f1683 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,28 @@ down: ${DOCKER_COMPOSE} down +hdown: + @echo "🥫 Bringing down containers and associated volumes …" + ${DOCKER_COMPOSE} down -v + + +# pull images from image repository +pull: + ${DOCKER_COMPOSE} pull + +restart: + @echo "🥫 Restarting containers …" + ${DOCKER_COMPOSE} restart + +status: + @echo "🥫 Getting container status …" + ${DOCKER_COMPOSE} ps + +log: + @echo "🥫 Reading logs (docker-compose) …" + ${DOCKER_COMPOSE} logs -f api + + #------------# # Production # #------------# @@ -61,7 +83,7 @@ down: # Create all external volumes needed for production. Using external volumes is useful to prevent data loss (as they are not deleted when performing docker down -v) create_external_volumes: @echo "🥫 Creating external volumes (production only) …" - docker volume create postgres-data + docker volume create open_prices_postgres-data #---------# # Cleanup #