-
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* init setup digital ocean * split script * add echo secret_key * add echo secret_key * update droplet_ip * Add DigitalOcean droplet to known_hosts
- Loading branch information
1 parent
fc31798
commit 901c2e7
Showing
6 changed files
with
85 additions
and
22 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,36 @@ | ||
name: Deploy to DigitalOcean | ||
|
||
on: | ||
push: | ||
branches: | ||
- config/digital-ocean | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup SSH and known hosts | ||
uses: webfactory/ssh-agent@v0.5.3 | ||
with: | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
|
||
- name: Add DigitalOcean droplet to known_hosts | ||
run: ssh-keyscan ${{ secrets.DROPLET_IP }} >> ~/.ssh/known_hosts | ||
|
||
- name: Copy project files to the server | ||
run: rsync -avz --exclude '/node_modules/' --exclude '/.git/' ./ root@${{ secrets.DROPLET_IP }}:/root/abibliadigital/ | ||
|
||
- name: Build container | ||
run: ssh root@${{ secrets.DROPLET_IP }} "cd /root/abibliadigital/ && docker-compose up -d --build" | ||
|
||
- name: Environment setup | ||
run: | | ||
ssh root@${{ secrets.DROPLET_IP }} "echo 'MONGODB_URI=${{ secrets.MONGODB_URI }}' >> /root/abibliadigital/.env" | ||
ssh root@${{ secrets.DROPLET_IP }} "echo 'SECRET_KEY=${{ secrets.SECRET_KEY }}' >> /root/abibliadigital/.env" | ||
ssh root@${{ secrets.DROPLET_IP }} "echo 'SENDGRID_KEY=${{ secrets.SENDGRID_KEY }}' >> /root/abibliadigital/.env" | ||
- name: Restart the application | ||
run: ssh root@${{ secrets.DROPLET_IP }} "cd /root/abibliadigital/ && docker-compose down && docker-compose up -d" |
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,44 @@ | ||
version: '3' | ||
|
||
services: | ||
abibliadigital: | ||
build: ./docker-api | ||
command: [ "bash", "/usr/src/api/start.sh" ] | ||
ports: | ||
- "3000:3000" | ||
expose: | ||
- "3000" | ||
container_name: abibliadigital | ||
environment: | ||
- MONGODB_URI=mongodb://abibliadigital-mongo/abibliadigital | ||
- NODE_ENV=development | ||
- SECRET_KEY=19B2AFFC3B287A4E41FA7C1158A8A | ||
- REDIS_URL=redis://abibliadigital-redis | ||
volumes: | ||
- ../abibliadigital:/usr/src/api | ||
depends_on: | ||
- abibliadigital-mongo | ||
- abibliadigital-redis | ||
|
||
abibliadigital-mongo: | ||
build: ./docker-mongo | ||
container_name: abibliadigital-mongo | ||
ports: | ||
- "27017:27017" | ||
expose: | ||
- "27017" | ||
volumes: | ||
- ../mongo-abibliadigital/db/data:/data/db | ||
- ../mongo-abibliadigital/db/log:/var/log/mongodb | ||
|
||
abibliadigital-redis: | ||
image: "redis:alpine" | ||
container_name: abibliadigital-redis | ||
command: redis-server | ||
ports: | ||
- "6379:6379" | ||
expose: | ||
- "6379" | ||
restart: always | ||
volumes: | ||
- ../redis-data:/var/lib/redis |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
yarn install | ||
yarn dev | ||
yarn start |