generated from nyu-software-engineering/final-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from software-students-spring2024/ydo
updated deployment
- Loading branch information
Showing
4 changed files
with
28 additions
and
29 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
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 |
---|---|---|
|
@@ -53,20 +53,31 @@ jobs: | |
tags: ${{ secrets.DOCKER_USERNAME }}/webapp:latest | ||
context: ./web_app | ||
file: ./web_app/Dockerfile | ||
|
||
|
||
# Deploy to Digital Ocean using SSH | ||
- name: Deploy to Digital Ocean | ||
uses: appleboy/[email protected] | ||
# Building Docker image for backend api and push to Docker Hub | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
tags: ${{ secrets.DOCKER_USERNAME }}/backend-api:latest | ||
context: ./backend_api | ||
file: ./backend_api/Dockerfile | ||
|
||
- name: Deploy to Digital Ocean droplet | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.DO_HOST }} | ||
username: ${{ secrets.DO_USERNAME }} | ||
key: ${{ secrets.DO_SSH_KEY }} | ||
passphrase: ${{ secrets.SSH_PASSPHRASE }} | ||
password: ${{ secrets.DO_PWD }} | ||
script: | | ||
echo "MONGODB_USER=${{ secrets.MONGODB_USER }}" >> 5-final-project-spring-2024-berries/.env | ||
echo "MONGO_PWD=${{ secrets.MONGO_PWD }}" >> 5-final-project-spring-2024-berries/.env | ||
echo "DB_HOST=${{ secrets.DB_HOST }}" >> 5-final-project-spring-2024-berries/.env | ||
echo "API_KEY=${{ secrets.API_KEY }}" >> 5-final-project-spring-2024-berries/.env | ||
echo "SECRET_KEY=${{ secrets.SECRET_KEY }}" >> 5-final-project-spring-2024-berries/.env | ||
docker pull ${{ secrets.DOCKER_USERNAME }}/webapp:latest | ||
docker stop web-app || true | ||
docker rm web-app || true | ||
docker run -d --name web-app -p 3000:3000 --restart unless-stopped ${{ secrets.DOCKER_USERNAME }}/webapp:latest | ||
sleep 10 | ||
# curl http://localhost:3000/healthcheck | ||
docker pull ${{ secrets.DOCKER_USERNAME }}/backend-api:latest | ||
cd 5-final-project-spring-2024-berries | ||
docker-compose down | ||
docker-compose pull | ||
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