Skip to content

Commit

Permalink
chore: variables de entorno dinámcas en CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
judlup committed Jun 6, 2024
1 parent 488a080 commit 15912e9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ jobs:
git clone https://github.com/Trycatch-tv/ValidadorBootcamp-backend /home/${{ secrets.EC2_USER }}/app
cd /home/${{ secrets.EC2_USER }}/app
# Crear un archivo .env con las variables de entorno necesarias
echo "DATABASE_HOST=${{secrets.DATABASE_NAME}}" > .env
echo "DATABASE_PORT=${{secrets.DATABASE_PORT}}" >> .env
echo "DATABASE_USER=${{secrets.DATABASE_USER}}" >> .env
echo "DATABASE_PASSWORD=${{secrets.DATABASE_PASSWORD}}" >> .env
echo "DATABASE_NAME=${{secrets.DATABASE_NAME}}" >> .env
echo "FILE_SERVICE_URL=${{secrets.FILE_SERVICE_URL}}" >> .env
echo "REVIEW_SERVICE_URL=${{secrets.REVIEW_SERVICE_URL}}" >> .env
echo "NODE_ENV=${{secrets.NODE_ENV}}" >> .env
echo "POSTGRES_USER=${{secrets.POSTGRES_USER}}" >> .env
echo "POSTGRES_PASSWORD=${{secrets.POSTGRES_PASSWORD}}" >> .env
echo "POSTGRES_DB=${{secrets.POSTGRES_DB}}" >> .env
# Actualizar la imagen del servicio backend y reiniciarlo sin afectar db
docker-compose down
Expand Down
26 changes: 15 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ services:
db:
image: postgres:14.2-alpine
restart: always
env_file:
- .env
environment:
- POSTGRES_DB=validador_bootcamps
- POSTGRES_USER=admin
- POSTGRES_PASSWORD=trycatch_tv23
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
volumes:
- db-data:/var/lib/postgresql/data
networks:
Expand All @@ -18,15 +20,17 @@ services:
backend:
build: .
container_name: backend
env_file:
- .env
environment:
- DATABASE_HOST=db
- DATABASE_PORT=5432
- DATABASE_USER=admin
- DATABASE_PASSWORD=trycatch_tv23
- DATABASE_NAME=validador_bootcamps
- FILE_SERVICE_URL=http://localhost:3000/files
- REVIEW_SERVICE_URL=http://localhost:3000/reviews
- NODE_ENV=dev
- DATABASE_HOST=${DATABASE_HOST}
- DATABASE_PORT=${DATABASE_PORT}
- DATABASE_USER=${DATABASE_USER}
- DATABASE_PASSWORD=${DATABASE_PASSWORD}
- DATABASE_NAME=${DATABASE_NAME}
- FILE_SERVICE_URL=${FILE_SERVICE_URL}
- REVIEW_SERVICE_URL=${REVIEW_SERVICE_URL}
- NODE_ENV=${NODE_ENV}
networks:
- vnet-backend
depends_on:
Expand Down

0 comments on commit 15912e9

Please sign in to comment.