-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (49 loc) · 2.17 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Deploy to EC2
on:
push:
branches:
- BE-20-connect-to-AWS
jobs:
Deploy:
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v3
with:
ref: BE-20-connect-to-AWS
- name: Executing remote ssh commands using ssh key
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.AWS_EC2_HOST }}
username: ${{ secrets.AWS_EC2_USERNAME }}
key: ${{ secrets.AWS_SSH_PRIVATE_KEY }}
port: ${{ secrets.AWS_PORT }}
script: |
set -x
cd app/backend-internship
git fetch origin
git reset --hard origin/BE-20-connect-to-AWS
git pull origin BE-20-connect-to-AWS
echo "PORT=${{ secrets.PORT }}" > .env
echo "HOST=${{ secrets.HOST }}" >> .env
echo "NODE_ENV=${{ secrets.NODE_ENV }}" >> .env
echo "DB_CONNECTION=${{ secrets.DB_CONNECTION }}" >> .env
echo "DB_USERNAME=${{ secrets.DB_USERNAME }}" >> .env
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> .env
echo "DB_NAME=${{ secrets.DB_NAME }}" >> .env
echo "DB_PORT=${{ secrets.DB_PORT }}" >> .env
echo "DB_HOST=${{ secrets.DB_HOST }}" >> .env
echo "ACCESS_SECRET_KEY=${{ secrets.ACCESS_SECRET_KEY }}" >> .env
echo "REFRESH_SECRET_KEY=${{ secrets.REFRESH_SECRET_KEY }}" >> .env
echo "ACTION_SECRET_KEY=${{ secrets.ACTION_SECRET_KEY }}" >> .env
echo "AUTH0_AUDIENCE=${{ secrets.AUTH0_AUDIENCE }}" >> .env
echo "AUTH0_ISSUER_URL=${{ secrets.AUTH0_ISSUER_URL }}" >> .env
echo "REDIS_URL=${{ secrets.REDIS_URL }}" >> .env
echo "REDIS_PASSWORD=${{ secrets.REDIS_PASSWORD }}" >> .env
echo "AUTH0_JWKS_URL=${{ secrets.AUTH0_JWKS_URL }}" >> .env
cp /etc/ssl/private/certificate.crt certificate.crt
cp /etc/ssl/private/private.key private.key
docker-compose stop backend-fullstack
docker-compose rm -f backend-fullstack
docker-compose build backend-fullstack
docker-compose up --no-deps -d backend-fullstack