fix: put into old state, revert prod logs to debug and disable loggin… #29
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
name: users_service CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: [main] | |
env: | |
APP_NAME: FACT_CHECK_API | |
APP_PORT: 3000 | |
API_PREFIX: api/v1 | |
APP_FALLBACK_LANGUAGE: en | |
APP_HEADER_LANGUAGE: x-custom-lang | |
AUTH_JWT_SECRET: bA2xcjpf8y5aSUFsNB2qN5yymUBS | |
AUTH_JWT_TOKEN_EXPIRES_IN: 15 | |
MONGO_URI: mongodb://localhost/fact_checking_api | |
MONGO_URI_TEST: mongodb://localhost/fact_checking_api_test | |
MONGO_DB_NAME: fact_checking_api_test | |
EMAIL_HOST: smtp-relay.sendinblue.com | |
EMAIL_USERNAME: smtp-username | |
EMAIL_PASSWORD: smtp-password | |
REDIS_HOST: localhost | |
REDIS_PORT: 6379 | |
REDIS_PASSWORD: redistest | |
jobs: | |
tests: | |
env: | |
NODE_ENV: test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x] | |
mongodb-version: ['6.0'] | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Build App | |
run: npm install | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: v1-npm-deps-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: v1-npm-deps- | |
- name: Start MongoDB | |
uses: supercharge/mongodb-github-action@1.8.0 | |
with: | |
mongodb-version: ${{ matrix.mongodb-version }} | |
- name: Start Redis | |
uses: shogo82148/actions-setup-redis@v1 | |
with: | |
redis-version: '6.x' | |
- run: npm run test:e2e | |
deploy: | |
needs: tests | |
env: | |
NODE_ENV: production | |
AUTH_JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
MONGO_URI: ${{ secrets.MONGO_DEPLOY_URI }} | |
AUTH_JWT_TOKEN_EXPIRES_IN: ${{ secrets.AUTH_JWT_TOKEN_EXPIRES_IN }} | |
EMAIL_PORT: ${{ secrets.EMAIL_PORT }} | |
EMAIL_HOST: ${{ secrets.EMAIL_HOST }} | |
EMAIL_USERNAME: ${{ secrets.EMAIL_USERNAME }} | |
EMAIL_PASSWORD: ${{ secrets.EMAIL_PASSWORD }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Build and push Docker images | |
run: | | |
docker build -t rastokopal/fact-checking-api:latest . | |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
docker push rastokopal/fact-checking-api:latest | |
- name: SSH and deploy | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
script: | | |
docker pull rastokopal/fact-checking-api:latest | |
cd ${{ secrets.DEPLOY_FOLDER }} | |
docker-compose up -d --no-deps api |