From 5c30fa3cfaae2f2ce81d1b7488fd119288ee1294 Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 18 Nov 2023 20:02:23 +0100 Subject: [PATCH 01/22] switch to gitea --- .gitea/workflows/action.yml | 103 ++++++++++++++++++++++++++++++++++++ .gitlab-ci.yml | 70 ------------------------ 2 files changed, 103 insertions(+), 70 deletions(-) create mode 100644 .gitea/workflows/action.yml delete mode 100644 .gitlab-ci.yml diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml new file mode 100644 index 0000000..fbf348c --- /dev/null +++ b/.gitea/workflows/action.yml @@ -0,0 +1,103 @@ +name: CI/CD Pipeline + +on: + push: + branches: + - main + - staging + +env: + CARGO_TARGET: x86_64-unknown-linux-musl + SSH_HOST: ${{ secrets.SSH_HOST }} + SSH_USER: ${{ secrets.SSH_USER }} + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + +jobs: + build: + runs-on: ubuntu-latest + container: rust:latest + + steps: + - name: Setup Environment + run: | + rustup target add $CARGO_TARGET + apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y + + - name: Checkout + uses: actions/checkout@v3 + + - name: Run Test DB Script + run: ./test_db.sh + + - name: Build + run: | + cargo build --release --target $CARGO_TARGET + strip target/$CARGO_TARGET/release/rot + cd frontend && npm install && npm run build + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: build-artifacts + path: | + target/$CARGO_TARGET/release/rot + static + retention-days: 1 + + test: + runs-on: ubuntu-latest + container: rust:latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Run Tests + run: cargo test --verbose + + deploy-staging: + runs-on: ubuntu-latest + needs: [build, test] + if: github.ref == 'refs/heads/staging' + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Deploy to Staging + run: | + scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/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/ + 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 'sudo systemctl start rotstaging' + env: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + SSH_HOST: ${{ secrets.SSH_HOST }} + SSH_USER: ${{ secrets.SSH_USER }} + + deploy-main: + runs-on: ubuntu-latest + needs: [build, test] + if: github.ref == 'refs/heads/main' + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Deploy to Main + run: | + 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' + 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' + env: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + SSH_HOST: ${{ secrets.SSH_HOST }} + SSH_USER: ${{ secrets.SSH_USER }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 381c0a5..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,70 +0,0 @@ -image: 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 musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y - - ./test_db.sh - -build: - stage: build - script: - - cargo build --release --target $CARGO_TARGET - - strip target/$CARGO_TARGET/release/rot - - cd frontend && npm install && npm run build - artifacts: - paths: - - target/$CARGO_TARGET/release/rot - - static - expire_in: 3 hours - -test: - stage: test - image: rust:latest - script: - - cargo test --verbose - -deploy-staging: - 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 - - ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts - script: - - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/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/ - - 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 'sudo systemctl start rotstaging' - 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 - - ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts - script: - - 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' - - 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 0ec49ea264f0fc1b479aef871af9e4fa30a5efcb Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 18 Nov 2023 20:23:07 +0100 Subject: [PATCH 02/22] push --- .gitea/workflows/action.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index fbf348c..1a93082 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -49,6 +49,10 @@ jobs: container: rust:latest steps: + - name: Setup Environment + run: | + apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y + - name: Checkout uses: actions/checkout@v3 @@ -60,6 +64,10 @@ jobs: needs: [build, test] if: github.ref == 'refs/heads/staging' steps: + - name: Setup Environment + run: | + apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y + - name: Checkout uses: actions/checkout@v3 @@ -84,6 +92,10 @@ jobs: needs: [build, test] if: github.ref == 'refs/heads/main' steps: + - name: Setup Environment + run: | + apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y + - name: Checkout uses: actions/checkout@v3 From ffb437e1f47284a66e39d2f54b99fc1c98c0211c Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 18 Nov 2023 20:47:21 +0100 Subject: [PATCH 03/22] push --- .gitea/workflows/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index 1a93082..ecdd59d 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -56,6 +56,9 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Run Test DB Script + run: ./test_db.sh + - name: Run Tests run: cargo test --verbose From cf257c5f6589e8e137fa554f0fa310611b319b0a Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 18 Nov 2023 21:18:07 +0100 Subject: [PATCH 04/22] push --- .gitea/workflows/action.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index ecdd59d..90def89 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -59,6 +59,11 @@ jobs: - name: Run Test DB Script run: ./test_db.sh + - name: Download Artifacts + uses: actions/download-artifact@v3 + with: + name: build-artifacts + - name: Run Tests run: cargo test --verbose @@ -73,6 +78,11 @@ jobs: - name: Checkout uses: actions/checkout@v3 + + - name: Download Artifacts + uses: actions/download-artifact@v3 + with: + name: build-artifacts - name: Deploy to Staging run: | @@ -101,6 +111,11 @@ jobs: - name: Checkout uses: actions/checkout@v3 + + - name: Download Artifacts + uses: actions/download-artifact@v3 + with: + name: build-artifacts - name: Deploy to Main run: | From f96086753d58fdd7dc4b26b33b33acab69ecc36e Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 18 Nov 2023 21:46:00 +0100 Subject: [PATCH 05/22] ? --- .gitea/workflows/action.yml | 62 +++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index 90def89..2ebb599 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -13,19 +13,32 @@ env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} jobs: + setup-environment: + runs-on: ubuntu-latest + outputs: + cache-key: ${{ steps.cache-keys.outputs.cache-key }} + steps: + - name: Calculate Cache Keys + id: cache-keys + run: echo "::set-output name=cache-key::$(date +%s)" + build: runs-on: ubuntu-latest - container: rust:latest + needs: setup-environment + container: my-custom-container:latest steps: - - name: Setup Environment - run: | - rustup target add $CARGO_TARGET - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y - - name: Checkout uses: actions/checkout@v3 + - name: Restore Cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo + ./frontend/node_modules + key: ${{ needs.setup-environment.outputs.cache-key }} + - name: Run Test DB Script run: ./test_db.sh @@ -46,39 +59,31 @@ jobs: test: runs-on: ubuntu-latest - container: rust:latest + needs: build + container: my-custom-container:latest steps: - - name: Setup Environment - run: | - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y - - name: Checkout uses: actions/checkout@v3 - - name: Run Test DB Script - run: ./test_db.sh - - - name: Download Artifacts - uses: actions/download-artifact@v3 + - name: Restore Cache + uses: actions/cache@v3 with: - name: build-artifacts + path: ~/.cargo + key: ${{ needs.setup-environment.outputs.cache-key }} - name: Run Tests run: cargo test --verbose deploy-staging: runs-on: ubuntu-latest - needs: [build, test] + needs: test if: github.ref == 'refs/heads/staging' - steps: - - name: Setup Environment - run: | - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y + steps: - name: Checkout uses: actions/checkout@v3 - + - name: Download Artifacts uses: actions/download-artifact@v3 with: @@ -94,7 +99,7 @@ jobs: 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 'sudo 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 }} @@ -102,13 +107,10 @@ jobs: deploy-main: runs-on: ubuntu-latest - needs: [build, test] + needs: test if: github.ref == 'refs/heads/main' - steps: - - name: Setup Environment - run: | - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y + steps: - name: Checkout uses: actions/checkout@v3 @@ -126,7 +128,7 @@ jobs: 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' 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' + ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rot' env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_HOST: ${{ secrets.SSH_HOST }} From becd1b99e6acea0054090946fd790029bb0d415d Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 18 Nov 2023 21:54:11 +0100 Subject: [PATCH 06/22] push --- .gitea/workflows/action.yml | 44 ++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index 2ebb599..4b9bb5c 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -13,31 +13,28 @@ env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} jobs: - setup-environment: - runs-on: ubuntu-latest - outputs: - cache-key: ${{ steps.cache-keys.outputs.cache-key }} - steps: - - name: Calculate Cache Keys - id: cache-keys - run: echo "::set-output name=cache-key::$(date +%s)" - build: runs-on: ubuntu-latest - needs: setup-environment - container: my-custom-container:latest steps: - name: Checkout uses: actions/checkout@v3 - - name: Restore Cache - uses: actions/cache@v3 + - name: Setup Rust Environment + uses: actions-rs/toolchain@v1 with: - path: | - ~/.cargo - ./frontend/node_modules - key: ${{ needs.setup-environment.outputs.cache-key }} + toolchain: stable + target: $CARGO_TARGET + override: true + + - name: Install Dependencies + run: | + sudo apt-get update -qq + sudo apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg + curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /tmp/nodesource.gpg + echo "deb [signed-by=/tmp/nodesource.gpg] https://deb.nodesource.com/node_16.x $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/nodesource.list + sudo apt-get update + sudo apt-get install -y nodejs npm - name: Run Test DB Script run: ./test_db.sh @@ -60,17 +57,16 @@ jobs: test: runs-on: ubuntu-latest needs: build - container: my-custom-container:latest steps: - name: Checkout uses: actions/checkout@v3 - - name: Restore Cache - uses: actions/cache@v3 + - name: Setup Rust Environment + uses: actions-rs/toolchain@v1 with: - path: ~/.cargo - key: ${{ needs.setup-environment.outputs.cache-key }} + toolchain: stable + override: true - name: Run Tests run: cargo test --verbose @@ -100,6 +96,7 @@ jobs: 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 'sudo systemctl start rotstaging' + env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_HOST: ${{ secrets.SSH_HOST }} @@ -113,7 +110,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - + - name: Download Artifacts uses: actions/download-artifact@v3 with: @@ -129,6 +126,7 @@ jobs: 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' + env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_HOST: ${{ secrets.SSH_HOST }} From fd3ed5a27251d667af7291604b26ac9c5017e5f8 Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 18 Nov 2023 21:56:25 +0100 Subject: [PATCH 07/22] push --- .gitea/workflows/action.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index 4b9bb5c..150dc75 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -17,6 +17,15 @@ jobs: runs-on: ubuntu-latest steps: + - name: Install Dependencies + run: | + sudo apt-get update -qq + sudo apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg + curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /tmp/nodesource.gpg + echo "deb [signed-by=/tmp/nodesource.gpg] https://deb.nodesource.com/node_16.x $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/nodesource.list + sudo apt-get update + sudo apt-get install -y nodejs npm + - name: Checkout uses: actions/checkout@v3 @@ -27,15 +36,6 @@ jobs: target: $CARGO_TARGET override: true - - name: Install Dependencies - run: | - sudo apt-get update -qq - sudo apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /tmp/nodesource.gpg - echo "deb [signed-by=/tmp/nodesource.gpg] https://deb.nodesource.com/node_16.x $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/nodesource.list - sudo apt-get update - sudo apt-get install -y nodejs npm - - name: Run Test DB Script run: ./test_db.sh From 70ead9a970c8749d70772fdd4725b27ebf7c5975 Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 18 Nov 2023 21:57:57 +0100 Subject: [PATCH 08/22] push --- .gitea/workflows/action.yml | 58 ++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index 150dc75..90def89 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -15,27 +15,17 @@ env: jobs: build: runs-on: ubuntu-latest + container: rust:latest steps: - - name: Install Dependencies + - name: Setup Environment run: | - sudo apt-get update -qq - sudo apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /tmp/nodesource.gpg - echo "deb [signed-by=/tmp/nodesource.gpg] https://deb.nodesource.com/node_16.x $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/nodesource.list - sudo apt-get update - sudo apt-get install -y nodejs npm + rustup target add $CARGO_TARGET + apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y - name: Checkout uses: actions/checkout@v3 - - name: Setup Rust Environment - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: $CARGO_TARGET - override: true - - name: Run Test DB Script run: ./test_db.sh @@ -56,30 +46,39 @@ jobs: test: runs-on: ubuntu-latest - needs: build + container: rust:latest steps: + - name: Setup Environment + run: | + apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y + - name: Checkout uses: actions/checkout@v3 - - name: Setup Rust Environment - uses: actions-rs/toolchain@v1 + - name: Run Test DB Script + run: ./test_db.sh + + - name: Download Artifacts + uses: actions/download-artifact@v3 with: - toolchain: stable - override: true + name: build-artifacts - name: Run Tests run: cargo test --verbose deploy-staging: runs-on: ubuntu-latest - needs: test + needs: [build, test] if: github.ref == 'refs/heads/staging' - steps: + - name: Setup Environment + run: | + apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y + - name: Checkout uses: actions/checkout@v3 - + - name: Download Artifacts uses: actions/download-artifact@v3 with: @@ -95,8 +94,7 @@ jobs: 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 'sudo 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 }} @@ -104,13 +102,16 @@ jobs: deploy-main: runs-on: ubuntu-latest - needs: test + needs: [build, test] if: github.ref == 'refs/heads/main' - steps: + - name: Setup Environment + run: | + apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y + - name: Checkout uses: actions/checkout@v3 - + - name: Download Artifacts uses: actions/download-artifact@v3 with: @@ -125,8 +126,7 @@ jobs: 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' 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' - + ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rot' env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_HOST: ${{ secrets.SSH_HOST }} From 8251d3b6484f9ec5a9fa3421069ed8ec32284c3c Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 18 Nov 2023 22:22:36 +0100 Subject: [PATCH 09/22] push --- .gitea/workflows/action.yml | 57 +++++++++---------------------------- 1 file changed, 14 insertions(+), 43 deletions(-) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index 90def89..e91235a 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -13,37 +13,6 @@ env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} jobs: - build: - runs-on: ubuntu-latest - container: rust:latest - - steps: - - name: Setup Environment - run: | - rustup target add $CARGO_TARGET - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y - - - name: Checkout - uses: actions/checkout@v3 - - - name: Run Test DB Script - run: ./test_db.sh - - - name: Build - run: | - cargo build --release --target $CARGO_TARGET - strip target/$CARGO_TARGET/release/rot - cd frontend && npm install && npm run build - - - name: Upload Artifacts - uses: actions/upload-artifact@v3 - with: - name: build-artifacts - path: | - target/$CARGO_TARGET/release/rot - static - retention-days: 1 - test: runs-on: ubuntu-latest container: rust:latest @@ -59,10 +28,10 @@ jobs: - name: Run Test DB Script run: ./test_db.sh - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - name: build-artifacts + - name: Build + run: | + cargo build + cd frontend && npm install && npm run build - name: Run Tests run: cargo test --verbose @@ -79,10 +48,11 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - name: build-artifacts + - name: Build + run: | + cargo build --release --target $CARGO_TARGET + strip target/$CARGO_TARGET/release/rot + cd frontend && npm install && npm run build - name: Deploy to Staging run: | @@ -112,10 +82,11 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - name: build-artifacts + - name: Build + run: | + cargo build --release --target $CARGO_TARGET + strip target/$CARGO_TARGET/release/rot + cd frontend && npm install && npm run build - name: Deploy to Main run: | From b0562299d678c234b470fc217d58d51311470e61 Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 18 Nov 2023 22:35:25 +0100 Subject: [PATCH 10/22] push --- .gitea/workflows/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index e91235a..90c8d71 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -38,6 +38,7 @@ jobs: deploy-staging: runs-on: ubuntu-latest + container: rust:latest needs: [build, test] if: github.ref == 'refs/heads/staging' steps: @@ -72,6 +73,7 @@ jobs: deploy-main: runs-on: ubuntu-latest + container: rust:latest needs: [build, test] if: github.ref == 'refs/heads/main' steps: From 1e9339642f964b540d6e6a78c4b60764be6ca625 Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 18 Nov 2023 22:36:13 +0100 Subject: [PATCH 11/22] push --- .gitea/workflows/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index 90c8d71..f35907d 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -39,7 +39,7 @@ jobs: deploy-staging: runs-on: ubuntu-latest container: rust:latest - needs: [build, test] + needs: [test] if: github.ref == 'refs/heads/staging' steps: - name: Setup Environment @@ -74,7 +74,7 @@ jobs: deploy-main: runs-on: ubuntu-latest container: rust:latest - needs: [build, test] + needs: [test] if: github.ref == 'refs/heads/main' steps: - name: Setup Environment From 35f6dd2a384bc76e17b9b6cf417db0ee3d9bda4d Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 19 Nov 2023 09:04:51 +0100 Subject: [PATCH 12/22] push --- .gitea/workflows/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index f35907d..9e099fc 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -20,6 +20,7 @@ jobs: steps: - name: Setup Environment run: | + rustup target add $CARGO_TARGET apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y - name: Checkout @@ -44,6 +45,7 @@ jobs: steps: - name: Setup Environment run: | + rustup target add $CARGO_TARGET apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y - name: Checkout @@ -79,6 +81,7 @@ jobs: steps: - name: Setup Environment run: | + rustup target add $CARGO_TARGET apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y - name: Checkout From bf50f952dc549124457a6a5ddbf37328f666f5c2 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 19 Nov 2023 09:21:50 +0100 Subject: [PATCH 13/22] push --- .gitea/workflows/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index 9e099fc..e39f2f2 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -20,7 +20,6 @@ jobs: steps: - name: Setup Environment run: | - rustup target add $CARGO_TARGET apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y - name: Checkout From fb2e4a72edbc56fc885dd9bf84e6955f4e1ac028 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 19 Nov 2023 09:47:08 +0100 Subject: [PATCH 14/22] push --- .gitea/workflows/action.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index e39f2f2..0272ffd 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -50,6 +50,9 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Run Test DB Script + run: ./test_db.sh + - name: Build run: | cargo build --release --target $CARGO_TARGET @@ -86,6 +89,9 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Run Test DB Script + run: ./test_db.sh + - name: Build run: | cargo build --release --target $CARGO_TARGET From a799edc78becffa2db0f66dba3c2c45ab555eaaf Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 19 Nov 2023 10:14:44 +0100 Subject: [PATCH 15/22] push --- .gitea/workflows/action.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index 0272ffd..17e6867 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -1,10 +1,6 @@ name: CI/CD Pipeline -on: - push: - branches: - - main - - staging +on: push env: CARGO_TARGET: x86_64-unknown-linux-musl @@ -61,6 +57,7 @@ jobs: - name: Deploy to Staging run: | + apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/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/ @@ -100,6 +97,7 @@ jobs: - name: Deploy to Main run: | + apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y 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/ From c3d341d4396ffb4d505ac7fb4ea4347f87e00d02 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 19 Nov 2023 18:03:14 +0100 Subject: [PATCH 16/22] push --- .gitea/workflows/action.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index 17e6867..bc6273f 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -57,8 +57,17 @@ jobs: - name: Deploy to Staging run: | - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y + apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg + mkdir -p /etc/apt/keyrings + curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --batch --no-tty --dearmor -o /etc/apt/keyrings/nodesource.gpg + echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list + apt-get update + apt-get install nodejs -y + apt-get install npm -y + + ssh-keyscan -H $SSH_HOST >> ~/.ssh/known_hosts scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/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/ From de75f5398add4439bfcdd17dbdccc0d27724320d Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 19 Nov 2023 18:56:29 +0100 Subject: [PATCH 17/22] push --- .gitea/workflows/action.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index bc6273f..bef1a1c 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -41,7 +41,22 @@ jobs: - name: Setup Environment run: | rustup target add $CARGO_TARGET - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y + apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg + + # Handling NodeSource GPG key + curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key -o nodesource.gpg.key + if [ -f /etc/apt/keyrings/nodesource.gpg ]; then + rm /etc/apt/keyrings/nodesource.gpg + fi + gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg nodesource.gpg.key + + # Adding NodeSource repository + echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list + + # Installing Node.js and npm + apt-get update + apt-get install nodejs -y + apt-get install npm -y - name: Checkout uses: actions/checkout@v3 From 922716e1b76370703b50b3309daca4e0e5b70c01 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 19 Nov 2023 19:36:19 +0100 Subject: [PATCH 18/22] push --- .gitea/workflows/action.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index bef1a1c..b5f9f42 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -72,10 +72,6 @@ jobs: - name: Deploy to Staging run: | - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg - mkdir -p /etc/apt/keyrings - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --batch --no-tty --dearmor -o /etc/apt/keyrings/nodesource.gpg - echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list apt-get update apt-get install nodejs -y apt-get install npm -y From a5aee6c6ed9db01a3a0c3bca1252a3e1984ac934 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 19 Nov 2023 20:14:08 +0100 Subject: [PATCH 19/22] push --- .gitea/workflows/action.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index b5f9f42..a752bf5 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -72,10 +72,7 @@ jobs: - name: Deploy to Staging run: | - apt-get update - apt-get install nodejs -y - apt-get install npm -y - + mkdir ~/.ssh ssh-keyscan -H $SSH_HOST >> ~/.ssh/known_hosts scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/rot-updating From 4c54ebf6c31e37a3820ff303a550909326ff04e5 Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 19 Nov 2023 21:13:50 +0100 Subject: [PATCH 20/22] push --- .gitea/workflows/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index a752bf5..9e06e12 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -74,6 +74,9 @@ jobs: run: | mkdir ~/.ssh ssh-keyscan -H $SSH_HOST >> ~/.ssh/known_hosts + 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 staging-diff.sql $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ From fea5b6f3d86d1ddfd35d78312f969ad9fb692f3e Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 19 Nov 2023 21:41:46 +0100 Subject: [PATCH 21/22] push --- templates/index.html.tera | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/index.html.tera b/templates/index.html.tera index 6968066..3651d77 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -8,7 +8,7 @@ {{ macros::alert(message=flash.1, type=flash.0, class="sm:col-span-2 lg:col-span-3") }} {% endif %} -

Ausfahrten

+

Ausfahrten!

{% include "includes/buttons" %} From 9694fe6512f1acfbe2c22c98bf8341a382152e1b Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 19 Nov 2023 22:01:14 +0100 Subject: [PATCH 22/22] push --- .gitea/workflows/action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index 9e06e12..b5719b2 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -117,7 +117,11 @@ jobs: - name: Deploy to Main run: | - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y + mkdir ~/.ssh + ssh-keyscan -H $SSH_HOST >> ~/.ssh/known_hosts + 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/