From f0ed61e9f9ec4c1c2cf6c367703ad23dbbed6051 Mon Sep 17 00:00:00 2001 From: nrs23 Date: Thu, 9 Nov 2023 14:14:08 +0000 Subject: [PATCH] [BUGFIX #4] Deploy rust without docker --- README.md | 3 +-- deploy-rust.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100755 deploy-rust.sh diff --git a/README.md b/README.md index af21f17..b948f8f 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,7 @@ Similar advice is available from government sources on a subscription basis, mos # TODOs -- [✓] Build a decent docker template for the rust API [KN 4/11/23] -- [] Set up CI to deploy to digitalocean droplet using ssh and docker +See https://github.com/nseymoursmith/waterlogged-prototype/issues # User flow diff --git a/deploy-rust.sh b/deploy-rust.sh new file mode 100755 index 0000000..9c3acff --- /dev/null +++ b/deploy-rust.sh @@ -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