From ccd9aad51f59fe70819465dc91cc738ec060f951 Mon Sep 17 00:00:00 2001 From: philipp Date: Tue, 6 Feb 2024 16:01:34 +0100 Subject: [PATCH 1/3] switch deplyment --- .gitea/workflows/action.yml | 26 +++++++++++++------------- rot.service | 2 +- rotstaging.service | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index c3cce02..5800d8f 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -80,15 +80,15 @@ jobs: echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/rot-updating + scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/philipp/rowing-staging/rot-updating - scp staging-diff.sql $SSH_USER@$SSH_HOST:/home/k004373/rowing-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/ + scp staging-diff.sql $SSH_USER@$SSH_HOST:/home/philipp/rowing-staging/ + scp -r static $SSH_USER@$SSH_HOST:/home/philipp/rowing-staging/ + scp -r templates $SSH_USER@$SSH_HOST:/home/philipp/rowing-staging/ + scp -r svelte $SSH_USER@$SSH_HOST:/home/philipp/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 && mkdir -p /home/k004373/rowing-staging/data-ergo/thirty && mkdir -p /home/k004373/rowing-staging/data-ergo/dozen && sqlite3 /home/k004373/rowing-staging/db.sqlite < /home/k004373/rowing-staging/staging-diff.sql' - ssh $SSH_USER@$SSH_HOST 'mv /home/k004373/rowing-staging/rot-updating /home/k004373/rowing-staging/rot' + ssh $SSH_USER@$SSH_HOST 'rm /home/philipp/rowing-staging/db.sqlite && cp /home/philipp/rowing/db.sqlite /home/philipp/rowing-staging/db.sqlite && mkdir -p /home/philipp/rowing-staging/svelte/build && mkdir -p /home/philipp/rowing-staging/data-ergo/thirty && mkdir -p /home/philipp/rowing-staging/data-ergo/dozen && sqlite3 /home/philipp/rowing-staging/db.sqlite < /home/philipp/rowing-staging/staging-diff.sql' + ssh $SSH_USER@$SSH_HOST 'mv /home/philipp/rowing-staging/rot-updating /home/philipp/rowing-staging/rot' ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rotstaging' env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} @@ -132,13 +132,13 @@ jobs: echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa - 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/svelte/build && mkdir -p /home/k004373/rowing/data-ergo/thirty && mkdir -p /home/k004373/rowing/data-ergo/dozen' + scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/philipp/rowing/rot-updating + scp -r static $SSH_USER@$SSH_HOST:/home/philipp/rowing/ + scp -r templates $SSH_USER@$SSH_HOST:/home/philipp/rowing/ + scp -r svelte $SSH_USER@$SSH_HOST:/home/philipp/rowing/ + ssh $SSH_USER@$SSH_HOST 'mkdir -p /home/philipp/rowing/svelte/build && mkdir -p /home/philipp/rowing/data-ergo/thirty && mkdir -p /home/philipp/rowing/data-ergo/dozen' 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 'mv /home/philipp/rowing/rot-updating /home/philipp/rowing/rot' ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rot' env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} diff --git a/rot.service b/rot.service index ba8f463..b0f3632 100644 --- a/rot.service +++ b/rot.service @@ -4,7 +4,7 @@ Description=Rot [Service] User=root Group=root -WorkingDirectory=/home/k004373/rowing +WorkingDirectory=/home/philipp/rowing Environment="ROCKET_ENV=prod" Environment="ROCKET_ADDRESS=127.0.0.1" Environment="ROCKET_PORT=8001" diff --git a/rotstaging.service b/rotstaging.service index 7a7e252..ed6ee20 100644 --- a/rotstaging.service +++ b/rotstaging.service @@ -4,12 +4,12 @@ Description=Rot Staging [Service] User=root Group=root -WorkingDirectory=/home/k004373/rowing-staging +WorkingDirectory=/home/philipp/rowing-staging Environment="ROCKET_ENV=prod" Environment="ROCKET_ADDRESS=127.0.0.1" Environment="ROCKET_PORT=7999" Environment="ROCKET_LOG=info" -ExecStart=/home/k004373/rowing-staging/rot +ExecStart=/home/philipp/rowing-staging/rot [Install] WantedBy=multi-user.target -- 2.45.2 From c1bed58fbbd04295c80fcf04bdca9b595587a03a Mon Sep 17 00:00:00 2001 From: philipp Date: Tue, 6 Feb 2024 16:03:11 +0100 Subject: [PATCH 2/3] no sudo for deployment... --- .gitea/workflows/action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index 5800d8f..729e3a0 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -86,10 +86,10 @@ jobs: scp -r static $SSH_USER@$SSH_HOST:/home/philipp/rowing-staging/ scp -r templates $SSH_USER@$SSH_HOST:/home/philipp/rowing-staging/ scp -r svelte $SSH_USER@$SSH_HOST:/home/philipp/rowing-staging/ - ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rotstaging' + ssh $SSH_USER@$SSH_HOST 'systemctl stop rotstaging' ssh $SSH_USER@$SSH_HOST 'rm /home/philipp/rowing-staging/db.sqlite && cp /home/philipp/rowing/db.sqlite /home/philipp/rowing-staging/db.sqlite && mkdir -p /home/philipp/rowing-staging/svelte/build && mkdir -p /home/philipp/rowing-staging/data-ergo/thirty && mkdir -p /home/philipp/rowing-staging/data-ergo/dozen && sqlite3 /home/philipp/rowing-staging/db.sqlite < /home/philipp/rowing-staging/staging-diff.sql' ssh $SSH_USER@$SSH_HOST 'mv /home/philipp/rowing-staging/rot-updating /home/philipp/rowing-staging/rot' - ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rotstaging' + ssh $SSH_USER@$SSH_HOST 'systemctl start rotstaging' env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_HOST: ${{ secrets.SSH_HOST }} @@ -137,9 +137,9 @@ jobs: scp -r templates $SSH_USER@$SSH_HOST:/home/philipp/rowing/ scp -r svelte $SSH_USER@$SSH_HOST:/home/philipp/rowing/ ssh $SSH_USER@$SSH_HOST 'mkdir -p /home/philipp/rowing/svelte/build && mkdir -p /home/philipp/rowing/data-ergo/thirty && mkdir -p /home/philipp/rowing/data-ergo/dozen' - ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rot' + ssh $SSH_USER@$SSH_HOST 'systemctl stop rot' ssh $SSH_USER@$SSH_HOST 'mv /home/philipp/rowing/rot-updating /home/philipp/rowing/rot' - ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rot' + ssh $SSH_USER@$SSH_HOST 'systemctl start rot' env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_HOST: ${{ secrets.SSH_HOST }} -- 2.45.2 From 664bb6273338711b4007d3918c8fa1d912e8cd60 Mon Sep 17 00:00:00 2001 From: philipp Date: Tue, 6 Feb 2024 16:12:10 +0100 Subject: [PATCH 3/3] fix ci --- .gitea/workflows/action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index 729e3a0..5800d8f 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -86,10 +86,10 @@ jobs: scp -r static $SSH_USER@$SSH_HOST:/home/philipp/rowing-staging/ scp -r templates $SSH_USER@$SSH_HOST:/home/philipp/rowing-staging/ scp -r svelte $SSH_USER@$SSH_HOST:/home/philipp/rowing-staging/ - ssh $SSH_USER@$SSH_HOST 'systemctl stop rotstaging' + ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rotstaging' ssh $SSH_USER@$SSH_HOST 'rm /home/philipp/rowing-staging/db.sqlite && cp /home/philipp/rowing/db.sqlite /home/philipp/rowing-staging/db.sqlite && mkdir -p /home/philipp/rowing-staging/svelte/build && mkdir -p /home/philipp/rowing-staging/data-ergo/thirty && mkdir -p /home/philipp/rowing-staging/data-ergo/dozen && sqlite3 /home/philipp/rowing-staging/db.sqlite < /home/philipp/rowing-staging/staging-diff.sql' ssh $SSH_USER@$SSH_HOST 'mv /home/philipp/rowing-staging/rot-updating /home/philipp/rowing-staging/rot' - ssh $SSH_USER@$SSH_HOST 'systemctl start rotstaging' + ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rotstaging' env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_HOST: ${{ secrets.SSH_HOST }} @@ -137,9 +137,9 @@ jobs: scp -r templates $SSH_USER@$SSH_HOST:/home/philipp/rowing/ scp -r svelte $SSH_USER@$SSH_HOST:/home/philipp/rowing/ ssh $SSH_USER@$SSH_HOST 'mkdir -p /home/philipp/rowing/svelte/build && mkdir -p /home/philipp/rowing/data-ergo/thirty && mkdir -p /home/philipp/rowing/data-ergo/dozen' - ssh $SSH_USER@$SSH_HOST 'systemctl stop rot' + ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rot' ssh $SSH_USER@$SSH_HOST 'mv /home/philipp/rowing/rot-updating /home/philipp/rowing/rot' - ssh $SSH_USER@$SSH_HOST 'systemctl start rot' + ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rot' env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_HOST: ${{ secrets.SSH_HOST }} -- 2.45.2