From a8fdecd74c0da57fc17248d9f28ccfa3d3f5e05a Mon Sep 17 00:00:00 2001 From: august kline Date: Thu, 14 Nov 2024 16:55:04 -0500 Subject: [PATCH] Add deploy and staging scripts --- Cargo.lock | 3 ++- deploy.sh | 11 +++++++++++ src/server/mod.rs | 2 +- stage.sh | 11 +++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100755 deploy.sh create mode 100755 stage.sh diff --git a/Cargo.lock b/Cargo.lock index cc8cef2..efe0646 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -294,10 +294,11 @@ dependencies = [ [[package]] name = "blogdb" version = "0.1.0" -source = "git+https://git.augustkline.com/august/blogdb#67c0c156cc42f32a35c1815c39762b841cab4ea7" +source = "git+https://git.augustkline.com/august/blogdb#136b42918f09a527653e4535fbee096a29e13309" dependencies = [ "anyhow", "argon2", + "dotenvy", "infer", "mime_guess", "rand 0.8.5", diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..7ad6f51 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,11 @@ +#! /usr/bin/env bash + +# this only works on macos for now, cross compilation toolchain from https://github.com/messense/homebrew-macos-cross-toolchains + +cargo update; + +CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-gcc cargo build --release --target x86_64-unknown-linux-gnu; + +scp target/x86_64-unknown-linux-gnu/release/evie kline@augustkline.com:/home/kline/; + +ssh kline@augustkline.com "mv ~/evie /var/www/evieippolito.com/; sudo systemctl restart evie" diff --git a/src/server/mod.rs b/src/server/mod.rs index e052ffc..5d15506 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -115,7 +115,7 @@ impl BlogStateInner { let username = env!("INIT_USER_NAME").to_string(); let password = env!("INIT_USER_PASSWORD").to_string(); let domain = env!("DOMAIN").to_string(); - let db = BlogDb::new(&username, password.clone(), DB_URL).await?; + let db = BlogDb::new(&username, password.clone()).await?; Self::add_initial_assets(&db).await?; Self::add_initial_pages(&db).await?; #[cfg(debug_assertions)] diff --git a/stage.sh b/stage.sh new file mode 100755 index 0000000..c2dbf69 --- /dev/null +++ b/stage.sh @@ -0,0 +1,11 @@ +#! /usr/bin/env bash + +# this only works on macos for now, cross compilation toolchain from https://github.com/messense/homebrew-macos-cross-toolchains + +cargo update; + +CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-gcc cargo build --release --target x86_64-unknown-linux-gnu; + +scp target/x86_64-unknown-linux-gnu/release/evie kline@augustkline.com:/home/kline/; + +ssh kline@augustkline.com "mv ~/evie /var/www/staging.evieippolito.com/; sudo systemctl restart evie-staging"