File tree Expand file tree Collapse file tree 1 file changed +36
-1
lines changed
Expand file tree Collapse file tree 1 file changed +36
-1
lines changed Original file line number Diff line number Diff line change 2222 aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
2323 aws-region : ap-northeast-2
2424
25+ - name : Setup Nginx and SSL
26+ uses : appleboy/ssh-action@master
27+ with :
28+ host : ${{ secrets.EC2_HOST }}
29+ username : ubuntu
30+ key : ${{ secrets.EC2_SSH_KEY }}
31+ script : |
32+ if ! command -v nginx &> /dev/null; then
33+ sudo apt update
34+ sudo apt install -y nginx certbot python3-certbot-nginx
35+ fi
36+
37+ sudo tee /etc/nginx/sites-available/default << 'EOF'
38+ server {
39+ listen 80;
40+ listen [::]:80;
41+ server_name api-loa-life.duckdns.org;
42+
43+ location / {
44+ proxy_pass http://localhost:3001;
45+ proxy_http_version 1.1;
46+ proxy_set_header Upgrade $http_upgrade;
47+ proxy_set_header Connection 'upgrade';
48+ proxy_set_header Host $host;
49+ proxy_cache_bypass $http_upgrade;
50+ }
51+ }
52+ EOF
53+
54+ if [ ! -d "/etc/letsencrypt/live/api-loa-life.duckdns.org" ]; then
55+ sudo certbot --nginx -d api-loa-life.duckdns.org --non-interactive --agree-tos --email ${{ secrets.CERTBOT_EMAIL }}
56+ fi
57+
58+ sudo systemctl reload nginx
59+
2560 - name : Build and Deploy Backend
2661 uses : appleboy/ssh-action@master
2762 with :
3873
3974 docker run -d \
4075 --name backend-service \
41- -p 3000:3000 \
76+ -p 3001:3001 \
4277 -e DATABASE_URL="${{ secrets.DATABASE_URL }}" \
4378 -e GOOGLE_CLIENT_ID="${{ secrets.GOOGLE_CLIENT_ID }}" \
4479 -e GOOGLE_CLIENT_SECRET="${{ secrets.GOOGLE_CLIENT_SECRET }}" \
You can’t perform that action at this time.
0 commit comments