-
Notifications
You must be signed in to change notification settings - Fork 563
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created action for gauzy api stage on digitalOcean droplet
- Loading branch information
1 parent
a597e98
commit de62037
Showing
10 changed files
with
358 additions
and
216 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
version: '3.8' | ||
|
||
services: | ||
nginx: | ||
image: nginx:latest | ||
volumes: | ||
- ./nginx.demo.pre.conf:/etc/nginx/nginx.conf:ro | ||
- ./ingress.api.crt:/etc/nginx/ssl/fullchain.pem | ||
- ./ingress.api.key:/etc/nginx/ssl/privkey.pem | ||
- ./etc/letsencrypt:/etc/letsencrypt:ro | ||
- ./certbot/data:/var/www/certbot | ||
restart: unless-stopped | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
networks: | ||
- overlay | ||
certbot: | ||
image: certbot/certbot | ||
container_name: certbot | ||
volumes: | ||
- ./certbot/conf:/etc/letsencrypt | ||
- ./certbot/www:/var/www/certbot | ||
command: certonly --webroot -w /var/www/certbot --force-renewal --email ever@ever.tech -d apidemodts.gauzy.co --agree-tos | ||
volumes: | ||
certificates: {} | ||
|
||
networks: | ||
overlay: | ||
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
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,52 @@ | ||
user nginx; | ||
events { | ||
worker_connections 1024; | ||
} | ||
http { | ||
server { | ||
listen 80; | ||
server_name apidemodt.gauzy.co; | ||
|
||
location / { | ||
return 301 https://$host$request_uri; | ||
} | ||
} | ||
server { | ||
listen 443 ssl; | ||
server_name apidemodt.gauzy.co; | ||
|
||
ssl_certificate /etc/nginx/ssl/fullchain.pem; | ||
ssl_certificate_key /etc/nginx/ssl/privkey.pem; | ||
|
||
location / { | ||
proxy_pass http://api:3000; | ||
} | ||
} | ||
|
||
############## using letsencrypt ########################## | ||
server { | ||
listen 80; | ||
server_name apidemodts.gauzy.co; | ||
|
||
location / { | ||
return 301 https://$host$request_uri; | ||
} | ||
location /.well-known/acme-challenge/ { | ||
root /var/www/certbot; | ||
} | ||
} | ||
|
||
server { | ||
listen 443 ssl; | ||
server_name apidemodts.gauzy.co; | ||
|
||
# use the certificates | ||
ssl_certificate /etc/letsencrypt/live/apidemodts.gauzy.co/fullchain.pem; | ||
ssl_certificate_key /etc/letsencrypt/live/apidemodts.gauzy.co/privkey.pem; | ||
|
||
location / { | ||
proxy_pass http://api:3000; | ||
} | ||
} | ||
|
||
} |
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
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,40 @@ | ||
name: Deploy to DigitalOcean Droplet Stage | ||
|
||
on: | ||
push: | ||
branches: | ||
- test-do-droplet2 | ||
|
||
jobs: | ||
deploy: | ||
runs-on: buildjet-4vcpu-ubuntu-2204 | ||
|
||
environment: stage | ||
|
||
steps: | ||
- name: checkout out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Generate TLS Secrets for DO Droplet | ||
run: | | ||
rm -f $GITHUB_WORKSPACE/.deploy/ssh/ingress.api.crt $GITHUB_WORKSPACE/.deploy/ssh/ingress.api.key | ||
echo ${{ secrets.INGRESS_API_CERT }} | base64 --decode > $GITHUB_WORKSPACE/.deploy/ssh/ingress.api.crt | ||
echo ${{ secrets.INGRESS_API_CERT_KEY }} | base64 --decode > $GITHUB_WORKSPACE/.deploy/ssh/ingress.api.key | ||
- name: Copy file via scp | ||
uses: appleboy/scp-action@master | ||
with: | ||
host: ${{secrets.DO_DROPLET_HOST}} | ||
username: ${{secrets.DO_DROPLET_USERNAME}} | ||
key: ${{secrets.DO_DROPLET_KEY}} | ||
source: '.deploy/ssh/docker-compose.api.demo.pre.yml,.deploy/ssh/nginx.demo.pre.conf,.deploy/ssh/ingress.api.crt,.deploy/ssh/ingress.api.key' | ||
target: '.' | ||
- name: Deploy to DigitalOcean Droplet | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{secrets.DO_DROPLET_HOST}} | ||
username: ${{secrets.DO_DROPLET_USERNAME}} | ||
key: ${{secrets.DO_DROPLET_KEY}} | ||
script: | | ||
docker-compose -f .deploy/ssh/docker-compose.api.demo.pre.yml up -d | ||
Oops, something went wrong.