Skip to content

feat: change constant list #164

feat: change constant list

feat: change constant list #164

Workflow file for this run

name: server-deploy
on:
pull_request:
types: [closed]
branches:
- development
jobs:
docker-image-push:
if: github.event.pull_request.merged == true
name: Push to container registry
runs-on: ubuntu-latest
strategy:
matrix:
service: [api-gateway, auth, user, inbox, mail-integrator]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to NCP Container Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.NCP_ACCESS_KEY }}
password: ${{ secrets.NCP_SECRET_KEY }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./apps/Dockerfile.app
push: true
tags: ${{ secrets.NCP_CONTAINER_REGISTRY_URL }}/${{ matrix.service }}:latest
build-args: |
PKG_NAME=@apps/${{ matrix.service }}
PORT=3000
pull-n-run-docker-compose:
name: Move docker-compose file to remote server and compose docker containers
needs: docker-image-push
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create .env file for remote server
run: |
echo "GOOGLE_CLIENT_ID=${{secrets.GOOGLE_CLIENT_ID}}" >> .env
echo "GOOGLE_CLIENT_SECRET=${{secrets.GOOGLE_CLIENT_SECRET}}" >> .env
echo "GOOGLE_CALLBACK_URL=${{secrets.GOOGLE_CALLBACK_URL}}" >> .env
echo "DB_HOST=${{secrets.DB_HOST}}" >> .env
echo "DB_PORT=${{secrets.DB_PORT}}" >> .env
echo "DB_USER=${{secrets.DB_USER}}" >> .env
echo "DB_PASSWORD=${{secrets.DB_PASSWORD}}" >> .env
echo "AUTH_DB_NAME=${{secrets.AUTH_DB_NAME}}" >> .env
echo "USER_DB_NAME=${{secrets.USER_DB_NAME}}" >> .env
echo "AUTH_SERVICE_HOST=${{secrets.AUTH_SERVICE_HOST}}" >> .env
echo "AUTH_SERVICE_PORT=${{secrets.AUTH_SERVICE_PORT}}" >> .env
echo "USER_SERVICE_HOST=${{secrets.USER_SERVICE_HOST}}" >> .env
echo "USER_SERVICE_PORT=${{secrets.USER_SERVICE_PORT}}" >> .env
echo "INBOX_SERVICE_HOST=${{secrets.INBOX_SERVICE_HOST}}" >> .env
echo "INBOX_SERVICE_PORT=${{secrets.INBOX_SERVICE_PORT}}" >> .env
echo "MAIL_INTEGRATOR_SERVICE_HOST=${{secrets.MAIL_INTEGRATOR_SERVICE_HOST}}" >> .env
echo "MAIL_INTEGRATOR_SERVICE_PORT=${{secrets.MAIL_INTEGRATOR_SERVICE_PORT}}" >> .env
echo "MONGO_CONNECTION_STRING_DEV=${{secrets.MONGO_CONNECTION_STRING_DEV}}" >> .env
- name: Copy docker-compose file
uses: garygrossgarten/github-action-scp@release
with:
local: ./docker-compose-server.yaml
remote: apps/docker-compose-server.yaml
host: ${{ secrets.NCP_SERVER_HOST }}
username: ${{ secrets.NCP_SERVER_USERNAME }}
password: ${{ secrets.NCP_SERVER_PASSWORD }}
- name: Copy .env file to remote server
uses: garygrossgarten/github-action-scp@release
with:
local: ./.env
remote: apps/.env
host: ${{ secrets.NCP_SERVER_HOST }}
username: ${{ secrets.NCP_SERVER_USERNAME }}
password: ${{ secrets.NCP_SERVER_PASSWORD }}
- name: Access to remote server via SSH and run docker-compose
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.NCP_SERVER_HOST }}
username: ${{ secrets.NCP_SERVER_USERNAME }}
password: ${{ secrets.NCP_SERVER_PASSWORD }}
port: 22
script: |
docker-compose -f apps/docker-compose-server.yaml down
docker-compose -f apps/docker-compose-server.yaml pull
docker-compose -f apps/docker-compose-server.yaml up -d