From 91d15f162f712858951221e8f31943fd897e4f85 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 15:57:37 +0200 Subject: [PATCH 01/23] first draft of ci deploy --- .gitlab-ci.yml | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d98e2fd..9c26584 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,10 +1,38 @@ -stages: - - build +image: rust:latest -rust-latest: +variables: + CARGO_TARGET: x86_64-unknown-linux-musl + +before_script: + - rustup target add $CARGO_TARGET + - apt-get update -qq && apt-get install -y -qq sshpass + +build: stage: build + script: + - cargo build --release --target $CARGO_TARGET + artifacts: + paths: + - target/$CARGO_TARGET/release/rot + expire_in: 1 week + +test: + stage: test image: rust:latest script: - apt update && apt install -y sqlite3 && ./test_db.sh - cargo build --verbose - cargo test --verbose + +deploy: + stage: deploy + before_script: + - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' + - eval $(ssh-agent -s) + - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + script: + - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging + only: + - staging From 3561940a0e7e8aca141db12bd48a03bd75ff19e8 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 15:59:51 +0200 Subject: [PATCH 02/23] fix --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9c26584..fb85355 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ variables: before_script: - rustup target add $CARGO_TARGET - - apt-get update -qq && apt-get install -y -qq sshpass + - apt-get update -qq && apt-get install -y -qq sshpass musl build: stage: build From a901d237aa9a62b6780c4235070c07695fe57972 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 16:02:02 +0200 Subject: [PATCH 03/23] push --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fb85355..edb4340 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ variables: before_script: - rustup target add $CARGO_TARGET - - apt-get update -qq && apt-get install -y -qq sshpass musl + - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools build: stage: build From eca9884b405aa10c27c931fdf8d0e5914031baf7 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 16:10:56 +0200 Subject: [PATCH 04/23] push --- .gitlab-ci.yml | 3 +-- rotstaging.service | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 rotstaging.service diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index edb4340..2f72f81 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,6 +6,7 @@ variables: before_script: - rustup target add $CARGO_TARGET - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools + - apt update && apt install -y sqlite3 && ./test_db.sh build: stage: build @@ -20,8 +21,6 @@ test: stage: test image: rust:latest script: - - apt update && apt install -y sqlite3 && ./test_db.sh - - cargo build --verbose - cargo test --verbose deploy: diff --git a/rotstaging.service b/rotstaging.service new file mode 100644 index 0000000..8091a14 --- /dev/null +++ b/rotstaging.service @@ -0,0 +1,16 @@ +[Unit] +Description=Rot Staging + +[Service] +User=root +Group=root +WorkingDirectory=/home/k004373/rowing-staging +Environment="ROCKET_ENV=prod" +Environment="ROCKET_ADDRESS=127.0.0.1" +Environment="ROCKET_PORT=7999" +Environment="ROCKET_LOG=info" +ExecStart=./rot + +[Install] +WantedBy=multi-user.target + From fa48bf2984e88f34dfbc23d18b2403462d0414a1 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 16:27:54 +0200 Subject: [PATCH 05/23] push --- .gitlab-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2f72f81..6e28ef7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,10 +28,17 @@ deploy: before_script: - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' - eval $(ssh-agent -s) + - echo "$SSH_PRIVATE_KEY" - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - - mkdir -p ~/.ssh - chmod 700 ~/.ssh script: - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging + - ssh $SSH_USER@$SSH_HOST 'rm /home/k004373/rowing-staging/db.sqlite && cp /home/k004373/rowing/db.sqlite /home/k004373/rowing-staging/db.sqlite' + - scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ + - scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ + - scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ + - ssh $SSH_USER@$SSH_HOST '/bin/systemctl restart rotstaging' + only: - staging From cd959dd9ab502ce8788f473ea8f739e8c6c471cd Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 16:31:38 +0200 Subject: [PATCH 06/23] push --- .gitlab-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6e28ef7..b536abe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,8 +28,7 @@ deploy: before_script: - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' - eval $(ssh-agent -s) - - echo "$SSH_PRIVATE_KEY" - - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - + - echo "$SSH_PRIVATE_KEY" | ssh-add - - mkdir -p ~/.ssh - chmod 700 ~/.ssh script: From 7a9e30cdae4578dfb259423554cb6202b3edd804 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 16:46:57 +0200 Subject: [PATCH 07/23] push --- .gitlab-ci.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b536abe..aeb74c2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,7 +23,7 @@ test: script: - cargo test --verbose -deploy: +deploy-staging: stage: deploy before_script: - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' @@ -31,6 +31,7 @@ deploy: - echo "$SSH_PRIVATE_KEY" | ssh-add - - mkdir -p ~/.ssh - chmod 700 ~/.ssh + - ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts script: - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging - ssh $SSH_USER@$SSH_HOST 'rm /home/k004373/rowing-staging/db.sqlite && cp /home/k004373/rowing/db.sqlite /home/k004373/rowing-staging/db.sqlite' @@ -41,3 +42,21 @@ deploy: only: - staging + +deploy-main: + stage: deploy + before_script: + - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' + - eval $(ssh-agent -s) + - echo "$SSH_PRIVATE_KEY" | ssh-add - + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + script: + - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing + - scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing/ + - scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing/ + - scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing/ + - ssh $SSH_USER@$SSH_HOST '/bin/systemctl restart rot' + + only: + - main From fb78b3b071ba167ec0e63b7ba7a76cf01b8792b5 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 17:14:56 +0200 Subject: [PATCH 08/23] push --- .gitlab-ci.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aeb74c2..898cc3a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,12 +34,11 @@ deploy-staging: - ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts script: - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging - - ssh $SSH_USER@$SSH_HOST 'rm /home/k004373/rowing-staging/db.sqlite && cp /home/k004373/rowing/db.sqlite /home/k004373/rowing-staging/db.sqlite' + - ssh $SSH_USER@$SSH_HOST 'rm /home/k004373/rowing-staging/db.sqlite && cp /home/k004373/rowing/db.sqlite /home/k004373/rowing-staging/db.sqlite && mkdir /home/k004373/rowing-staging/svelte/build' - scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ - scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ - scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ - - ssh $SSH_USER@$SSH_HOST '/bin/systemctl restart rotstaging' - + - ssh $SSH_USER@$SSH_HOST 'sudo systemctl restart rotstaging' only: - staging @@ -51,12 +50,12 @@ deploy-main: - echo "$SSH_PRIVATE_KEY" | ssh-add - - mkdir -p ~/.ssh - chmod 700 ~/.ssh + - ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts script: - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing - scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - - ssh $SSH_USER@$SSH_HOST '/bin/systemctl restart rot' - + - ssh $SSH_USER@$SSH_HOST 'sudo systemctl restart rot' only: - main From 2f954ea02eb51f50bc2d3654fa2699ff55e91e2d Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 17:27:32 +0200 Subject: [PATCH 09/23] push --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 898cc3a..589e6b9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,6 +33,7 @@ deploy-staging: - chmod 700 ~/.ssh - ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts script: + - ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rotstaging' - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging - ssh $SSH_USER@$SSH_HOST 'rm /home/k004373/rowing-staging/db.sqlite && cp /home/k004373/rowing/db.sqlite /home/k004373/rowing-staging/db.sqlite && mkdir /home/k004373/rowing-staging/svelte/build' - scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ @@ -52,6 +53,7 @@ deploy-main: - chmod 700 ~/.ssh - ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts script: + - ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rot' - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing - scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing/ From c4f070fa05ec3e270d8fee71efc4c86d2b70e758 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 17:28:50 +0200 Subject: [PATCH 10/23] push --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 589e6b9..1407b77 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -39,7 +39,7 @@ deploy-staging: - scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ - scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ - scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ - - ssh $SSH_USER@$SSH_HOST 'sudo systemctl restart rotstaging' + - ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rotstaging' only: - staging @@ -58,6 +58,6 @@ deploy-main: - scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - - ssh $SSH_USER@$SSH_HOST 'sudo systemctl restart rot' + - ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rot' only: - main From 63f2e805caa40074ce622458a9b24c72c690a96f Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 17:30:11 +0200 Subject: [PATCH 11/23] push --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1407b77..ba43527 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,6 +55,7 @@ deploy-main: script: - ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rot' - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing + - ssh $SSH_USER@$SSH_HOST 'mkdir /home/k004373/rowing-staging/svelte/build' - scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing/ From 9538dac8ed9836d30466f0753db990c6a6267ae8 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 17:30:40 +0200 Subject: [PATCH 12/23] push --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ba43527..da70875 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,10 +55,10 @@ deploy-main: script: - ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rot' - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing - - ssh $SSH_USER@$SSH_HOST 'mkdir /home/k004373/rowing-staging/svelte/build' - scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing/ + - ssh $SSH_USER@$SSH_HOST 'mkdir /home/k004373/rowing-staging/svelte/build' - ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rot' only: - main From 57edcb497c243b68863da45d2fe6961efc719f22 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 17:41:34 +0200 Subject: [PATCH 13/23] push --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1407b77..07181a9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,7 +35,7 @@ deploy-staging: script: - ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rotstaging' - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging - - ssh $SSH_USER@$SSH_HOST 'rm /home/k004373/rowing-staging/db.sqlite && cp /home/k004373/rowing/db.sqlite /home/k004373/rowing-staging/db.sqlite && mkdir /home/k004373/rowing-staging/svelte/build' + - ssh $SSH_USER@$SSH_HOST 'rm /home/k004373/rowing-staging/db.sqlite && cp /home/k004373/rowing/db.sqlite /home/k004373/rowing-staging/db.sqlite && mkdir -p /home/k004373/rowing-staging/svelte/build' - scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ - scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ - scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ From bcf6c9d06dfea0c2e09865ed87f731858d18c31d Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 17:41:34 +0200 Subject: [PATCH 14/23] push --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index da70875..9ee8d8b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,7 +35,7 @@ deploy-staging: script: - ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rotstaging' - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging - - ssh $SSH_USER@$SSH_HOST 'rm /home/k004373/rowing-staging/db.sqlite && cp /home/k004373/rowing/db.sqlite /home/k004373/rowing-staging/db.sqlite && mkdir /home/k004373/rowing-staging/svelte/build' + - ssh $SSH_USER@$SSH_HOST 'rm /home/k004373/rowing-staging/db.sqlite && cp /home/k004373/rowing/db.sqlite /home/k004373/rowing-staging/db.sqlite && mkdir -p /home/k004373/rowing-staging/svelte/build' - scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ - scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ - scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ From ba48c08e4b335e8fd014b9afd05c1a8983f1c46f Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 17:42:01 +0200 Subject: [PATCH 15/23] push --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9ee8d8b..60c28fd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -58,7 +58,7 @@ deploy-main: - scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - - ssh $SSH_USER@$SSH_HOST 'mkdir /home/k004373/rowing-staging/svelte/build' + - ssh $SSH_USER@$SSH_HOST 'mkdir -p /home/k004373/rowing-staging/svelte/build' - ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rot' only: - main From d2f6e37725a4f2f69a3c170e19a74f2a54ce7df6 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 17:56:32 +0200 Subject: [PATCH 16/23] push --- .gitlab-ci.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 60c28fd..22e503e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,8 +5,7 @@ variables: before_script: - rustup target add $CARGO_TARGET - - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools - - apt update && apt install -y sqlite3 && ./test_db.sh + - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 && ./test_db.sh build: stage: build @@ -33,12 +32,13 @@ deploy-staging: - chmod 700 ~/.ssh - ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts script: - - ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rotstaging' - - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging - - ssh $SSH_USER@$SSH_HOST 'rm /home/k004373/rowing-staging/db.sqlite && cp /home/k004373/rowing/db.sqlite /home/k004373/rowing-staging/db.sqlite && mkdir -p /home/k004373/rowing-staging/svelte/build' + - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/rot-updating - scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ - scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ - scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ + - ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rotstaging' + - ssh $SSH_USER@$SSH_HOST 'rm /home/k004373/rowing-staging/db.sqlite && cp /home/k004373/rowing/db.sqlite /home/k004373/rowing-staging/db.sqlite && mkdir -p /home/k004373/rowing-staging/svelte/build' + - mv /home/k004373/rowing-staging/rot-updating /home/k004373/rowing-staging/rot - ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rotstaging' only: - staging @@ -53,12 +53,13 @@ deploy-main: - chmod 700 ~/.ssh - ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts script: - - ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rot' - - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing + - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing/rot-updating - scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - - ssh $SSH_USER@$SSH_HOST 'mkdir -p /home/k004373/rowing-staging/svelte/build' + - ssh $SSH_USER@$SSH_HOST 'mkdir -p /home/k004373/rowing/svelte/build' + - ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rotstaging' + - mv /home/k004373/rowing/rot-updating /home/k004373/rowing/rot - ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rot' only: - main From 0c504001d3c35a53348f58b5d8e13c2e633cd03e Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 18:24:10 +0200 Subject: [PATCH 17/23] strip binary --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 22e503e..a328078 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,7 @@ build: stage: build script: - cargo build --release --target $CARGO_TARGET + - strip target/$CARGO_TARGET/release/rot artifacts: paths: - target/$CARGO_TARGET/release/rot From 7f7dc912a9188c94a4cd1af3df2a973657e223bc Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 18:28:01 +0200 Subject: [PATCH 18/23] build js --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a328078..d86868f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,7 @@ build: stage: build script: - cargo build --release --target $CARGO_TARGET + - cd frontend && npm run build - strip target/$CARGO_TARGET/release/rot artifacts: paths: From dd9ed3ae07c1b680e47725e82c725ed759e058d7 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 18:30:56 +0200 Subject: [PATCH 19/23] push --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d86868f..5f11d5c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -40,7 +40,7 @@ deploy-staging: - scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ - ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rotstaging' - ssh $SSH_USER@$SSH_HOST 'rm /home/k004373/rowing-staging/db.sqlite && cp /home/k004373/rowing/db.sqlite /home/k004373/rowing-staging/db.sqlite && mkdir -p /home/k004373/rowing-staging/svelte/build' - - mv /home/k004373/rowing-staging/rot-updating /home/k004373/rowing-staging/rot + - ssh $SSH_USER@$SSH_HOST 'mv /home/k004373/rowing-staging/rot-updating /home/k004373/rowing-staging/rot' - ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rotstaging' only: - staging @@ -60,8 +60,8 @@ deploy-main: - scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - ssh $SSH_USER@$SSH_HOST 'mkdir -p /home/k004373/rowing/svelte/build' - - ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rotstaging' - - mv /home/k004373/rowing/rot-updating /home/k004373/rowing/rot + - ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rot' + - ssh $SSH_USER@$SSH_HOST 'mv /home/k004373/rowing/rot-updating /home/k004373/rowing/rot' - ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rot' only: - main From b51529c3db8b1f85937eff5d2fbf0490d062fc79 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 19:20:04 +0200 Subject: [PATCH 20/23] push --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5f11d5c..464d0ec 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,13 +5,13 @@ variables: before_script: - rustup target add $CARGO_TARGET - - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 && ./test_db.sh + - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 npm && ./test_db.sh build: stage: build script: - cargo build --release --target $CARGO_TARGET - - cd frontend && npm run build + - cd frontend && npm install && npm run build - strip target/$CARGO_TARGET/release/rot artifacts: paths: From 3e20e9961c1ebc970dc0e08bf4eff27f3676eb7e Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 19:35:10 +0200 Subject: [PATCH 21/23] use new nodejs --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 464d0ec..3b15acb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,8 @@ variables: before_script: - rustup target add $CARGO_TARGET - - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 npm && ./test_db.sh + - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs + - ./test_db.sh build: stage: build From c99b78cbf4c629c5a134a1686d70652b758a2384 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 19:37:08 +0200 Subject: [PATCH 22/23] push --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3b15acb..cc5dc8d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ variables: before_script: - rustup target add $CARGO_TARGET - - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs + - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs - ./test_db.sh build: From 25f35bd500b92c65a60f14d10121b31691994a0c Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 30 Jul 2023 19:56:53 +0200 Subject: [PATCH 23/23] push --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cc5dc8d..8486d7b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,7 @@ build: script: - cargo build --release --target $CARGO_TARGET - cd frontend && npm install && npm run build - - strip target/$CARGO_TARGET/release/rot + # - strip target/$CARGO_TARGET/release/rot artifacts: paths: - target/$CARGO_TARGET/release/rot