-
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.
[BUGFIX #4] Deploy rust without docker
- Loading branch information
1 parent
2eb1a77
commit d8996fd
Showing
3 changed files
with
62 additions
and
2 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,38 @@ | ||
name: deploy to digitalOcean | ||
run-name: Deploy to DigitalOcean by @${{ github.actor }} | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Deploy Flask app | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{secrets.SSH_HOST}} # IP address of the server you wish to ssh into | ||
key: ${{secrets.SSH_KEY}} # Private or public key of the server | ||
username: ${{ secrets.SSH_USERNAME }} # User of the server you want to ssh into | ||
script: | | ||
if ! [ -d "$HOME/waterlogged-prototype/" ]; then | ||
echo 'repo does not exist!' | ||
exit 1 | ||
fi | ||
cd $HOME/waterlogged-prototype/ | ||
git pull | ||
if [ $? != 0 ]; then | ||
echo "git pull failed, check the server logs!" | ||
exit 1 | ||
fi | ||
./deploy-rust.sh | ||
if [ $? != 0 ]; then | ||
echo "deploy-rust.sh failed, check the server logs!" | ||
exit 1 | ||
fi | ||
echo 'Deployment successful to digital ocean' |
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,23 @@ | ||
#!/bin/bash | ||
|
||
./stop-api.sh | ||
|
||
if ! [ -d "$HOME/waterlogged-prototype/dockerised-rust-api/" ]; then | ||
echo 'docker app directory does not exist!' | ||
exit 1 | ||
fi | ||
|
||
cd $HOME/waterlogged-prototype/dockerised-rust-api/ | ||
cargo build --release | ||
if [ $? != 0 ]; then | ||
echo "cargo build failed, check the server logs!" | ||
exit 1 | ||
fi | ||
|
||
./target/release/api-example & | ||
|
||
PID=$! | ||
|
||
echo "kill $!" > ../stop-api.sh | ||
|
||
chmod +x ../stop-api.sh |