-
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
Showing
2 changed files
with
30 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
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,29 @@ | ||
#!/bin/bash | ||
|
||
git pull | ||
if [ $? != 0 ]; then | ||
echo "git pull failed, check the server logs!" | ||
exit 1 | ||
fi | ||
|
||
./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 |
f0ed61e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works on the Digital Ocean droplet.
Will note that this method of capturing the PID of the process might not be the most robust ever, particularly if someone kills the process without using the
stop-api.sh
script, and then that script gets called anyway - in which case it could in rare cases stop something else. I'm happy to do a better job of it further down the line if we decide this is a good direction to go.