generated from HenriqueAmorim20/GEROcuidadoAPITemplate
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from fga-eps-mds/feature/#143-CI_CD
(#143) atualiza repositorio com novas configuracoes e deploy
- Loading branch information
Showing
26 changed files
with
429 additions
and
9,646 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
#!/bin/bash | ||
# TODO | ||
npm install | ||
npm run start:dev | ||
#!/bin/sh | ||
|
||
echo "---------------Run migrations---------------" | ||
|
||
node /app/migrations.js | ||
|
||
echo "---------------Run migrations - END---------" | ||
|
||
node /app/main.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
#!/bin/bash | ||
|
||
cd /home/node/app | ||
source .env.development | ||
|
||
npm install --legacy-peer-deps | ||
|
||
rm -rf dist | ||
|
||
echo "---------------Run migrations---------------" | ||
|
||
npm run typeorm:run | ||
|
||
echo "---------------Run migrations - END---------" | ||
npm run start:dev | ||
|
||
npm run start:debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ ENV LANG pt_BR.utf8 | |
ENV LC_ALL pt_BR.utf8 | ||
ENV LANGUAGE pt_BR.utf8 | ||
|
||
EXPOSE 5432 | ||
EXPOSE 5002 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
tags: ['v*.*.*'] | ||
|
||
env: | ||
TARGET_DIR: '~/${{ github.event.repository.name }}' | ||
|
||
jobs: | ||
docker-hub: | ||
name: Docker Hub Image Push | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Sending Image to Docker Hub | ||
uses: mr-smithers-excellent/docker-build-push@v5 | ||
with: | ||
image: gerocuidadodev/gerocuidado-forum-api | ||
registry: docker.io | ||
directory: ./ | ||
dockerfile: ./Dockerfile.prod | ||
tags: latest | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
deploy-ec2: | ||
name: Deploy EC2 | ||
needs: docker-hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the files | ||
uses: actions/checkout@v2 | ||
|
||
- name: Executing remote ssh commands using ssh key | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.EC2_HOST_DNS }} | ||
username: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_SSH_KEY }} | ||
script: | | ||
cd ${{env.TARGET_DIR}} | ||
sudo git pull | ||
sudo docker compose -f docker-compose.prod.yml up --force-recreate --build --pull --remove-orphans -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
version: '3.7' | ||
services: | ||
gerocuidado-forum-api-prod: | ||
image: gerocuidadodev/gerocuidado-forum-api:latest | ||
container_name: gerocuidado-forum-api-prod | ||
environment: | ||
- DB_HOST=gerocuidado-forum-db | ||
- DB_USERNAME=postgres | ||
- DB_PASS=postgres | ||
- DB_DATABASE=gerocuidado-forum-db | ||
- DB_PORT=5002 | ||
ports: | ||
- '3002:3002' | ||
depends_on: | ||
- gerocuidado-forum-db | ||
networks: | ||
- gerocuidado-forum-net | ||
|
||
gerocuidado-forum-db: | ||
build: | ||
context: ./.docker/postgres | ||
dockerfile: Dockerfile | ||
command: postgres -c 'config_file=/etc/postgresql/postgresql.conf' | ||
container_name: gerocuidado-forum-db | ||
volumes: | ||
- './.docker/postgres/config/postgresql.conf:/etc/postgresql/postgresql.conf' | ||
environment: | ||
- POSTGRES_DB=gerocuidado-forum-db | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=postgres | ||
ports: | ||
- '5002:5002' | ||
networks: | ||
- gerocuidado-forum-net | ||
|
||
networks: | ||
gerocuidado-forum-net: | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.