diff --git a/bin/build.sh b/bin/build.sh index 0dd93153..621d2817 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -7,8 +7,5 @@ MNML_PATH=$(realpath "$DIR/../") VERSION=$(<"$MNML_PATH/VERSION") make server -cp -R "$MNML_PATH/server/target/release" "/usr/local/mnml/build/server/$VERSION" - make client -cp -R "$MNML_PATH/client/dist" "/usr/local/mnml/build/client/$VERSION" diff --git a/bin/deploy.sh b/bin/deploy.sh index 15d8a8fa..9ae5875d 100755 --- a/bin/deploy.sh +++ b/bin/deploy.sh @@ -5,8 +5,24 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) MNML_PATH=$(realpath "$DIR/../") VERSION=$(<"$MNML_PATH/VERSION") -echo "syncing /usr/local/mnml/build/server/$VERSION" -rsync -a --delete --delete-excluded "/usr/local/mnml/build/server/$VERSION" mnml:"/usr/local/mnml/build/server/" +SERVER_BIN_DIR="/usr/local/mnml/bin" +CLIENT_DIST_DIR="/var/lib/mnml/client" +CLIENT_PUBLIC_DIR="/var/lib/mnml/public/current" -echo "syncing /usr/local/mnml/build/client/$VERSION" -rsync -a --delete --delete-excluded "/usr/local/mnml/build/client/$VERSION" mnml:"/usr/local/mnml/build/client/" +# server updates +echo "syncing server $VERSION " +rsync -a --delete --delete-excluded "$MNML_PATH/server/target/release/mnml" mnml:"$SERVER_BIN_DIR/$VERSION" +ssh -q mnml ln -nfs "$SERVER_BIN_DIR/$VERSION" "$SERVER_BIN_DIR/mnml" +ssh -q mnml ls -lah "$SERVER_BIN_DIR" + +# client updates +echo "syncing client $VERSION" +rsync -a --delete --delete-excluded "$MNML_PATH/client/dist" mnml:"$CLIENT_DIST_DIR/$VERSION" +ssh -q mnml ln -nfs "$CLIENT_DIST_DIR/$VERSION" "$CLIENT_PUBLIC_DIR" +ssh -q mnml ls -lah "/var/lib/mnml/public" + +echo "restarting mnml service" +ssh -q -t mnml sudo service mnml restart && sleep 1 && systemctl --no-pager status mnml + +echo "restarting nginx service" +ssh -q -t mnml sudo service nginx restart && sleep 1 && systemctl --no-pager status nginx diff --git a/etc/systemd/system/mnml.service b/etc/systemd/system/mnml.service index 1b60ed47..fd859f8d 100644 --- a/etc/systemd/system/mnml.service +++ b/etc/systemd/system/mnml.service @@ -8,7 +8,6 @@ ExecStart=/usr/local/mnml/bin/mnml KillMode=process Restart=on-failure RestartPreventExitStatus=255 -Type=notify [Install] WantedBy=multi-user.target diff --git a/server/Cargo.toml b/server/Cargo.toml index ef32077c..17bd6446 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -3,6 +3,13 @@ name = "mnml" version = "0.1.0" authors = ["ntr "] +# makes sure to include openssl links in runtime path +# [profile.release] +# rpath = true + +# [profile.dev] +# rpath = true + [dependencies] rand = "0.6" uuid = { version = "0.5", features = ["serde", "v4"] } @@ -37,4 +44,5 @@ crossbeam-channel = "0.3" stripe-rust = { version = "0.10.4", features = ["webhooks"] } [patch.crates-io] -# stripe-rust = { git = "https://github.com/margh/stripe-rs.git" } \ No newline at end of file +# stripe-rust = { git = "https://github.com/margh/stripe-rs.git" } +