Compare commits

...

16 Commits

Author SHA1 Message Date
missytake
c78cddab7a Revert "expanding ~ doesn't work with -i"
This reverts commit 4c62714fbb.
2026-03-11 21:04:07 +01:00
missytake
4c62714fbb expanding ~ doesn't work with -i 2026-03-11 20:45:06 +01:00
missytake
7918984888 ci: use proper SSH key 2026-03-11 19:22:52 +01:00
missytake
3116da879f fix CHATMAIL_DOMAIN2 address 2026-03-10 14:21:02 +01:00
missytake
195142acc6 CI: fix SSH key path 2026-03-10 14:04:21 +01:00
missytake
8a5bb18a2b supply Hetzner API token 2026-03-10 14:00:56 +01:00
missytake
79eebe2762 use with syntax properly 2026-03-10 13:54:02 +01:00
missytake
d9de25e4fd checkout hetzner-relay repo properly 2026-03-10 13:53:02 +01:00
missytake
3eaadfbbee chatmail.ini is generated in hetzner-relay 2026-03-10 13:50:11 +01:00
missytake
d321f01d20 cmdeploy offline tests already run in ci.yml 2026-03-10 13:46:19 +01:00
missytake
94a645e441 don't upload hpk's key 2026-03-10 13:45:05 +01:00
missytake
3931dde099 CI: try to run hetzner-relay without importing reusable actions 2026-03-10 13:42:43 +01:00
missytake
8d08b98eda test example workflow 2026-03-10 13:34:29 +01:00
missytake
65b6eebdce retrigger workflow 2026-03-10 13:23:23 +01:00
missytake
1d0f4a4de4 fix repo URL 2026-03-10 13:20:29 +01:00
missytake
b2900cbc8c CI: use hetzner-relay github actions 2026-03-10 13:18:25 +01:00

View File

@@ -1,4 +1,4 @@
name: deploy on staging2.testrun.org, and run tests
name: deploy on allocated VPS and run tests
on:
push:
@@ -12,86 +12,27 @@ on:
- 'LICENSE'
jobs:
deploy:
name: deploy on staging2.testrun.org, and run tests
deploy-and-test:
name: deploy on allocated VPS, and run tests
runs-on: ubuntu-latest
timeout-minutes: 30
environment:
name: staging2.testrun.org
url: https://staging2.testrun.org/
concurrency: staging2.testrun.org
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
repository: chatmail/hetzner-relay
path: hetzner-relay
- uses: actions/checkout@v4
with:
path: relay
- name: prepare SSH
run: |
mkdir ~/.ssh
echo "${{ secrets.STAGING_SSH_KEY }}" >> ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan staging2.testrun.org > ~/.ssh/known_hosts
# save previous acme & dkim state
rsync -avz root@staging2.testrun.org:/var/lib/acme . || true
rsync -avz root@staging2.testrun.org:/etc/dkimkeys . || true
# store previous acme & dkim state on ns.testrun.org, if it contains useful certs
if [ -f dkimkeys/opendkim.private ]; then rsync -avz -e "ssh -o StrictHostKeyChecking=accept-new" dkimkeys root@ns.testrun.org:/tmp/ || true; fi
if [ "$(ls -A acme/certs)" ]; then rsync -avz -e "ssh -o StrictHostKeyChecking=accept-new" acme root@ns.testrun.org:/tmp/ || true; fi
# make sure CAA record isn't set
scp -o StrictHostKeyChecking=accept-new .github/workflows/staging.testrun.org-default.zone root@ns.testrun.org:/etc/nsd/staging2.testrun.org.zone
ssh root@ns.testrun.org sed -i '/CAA/d' /etc/nsd/staging2.testrun.org.zone
ssh root@ns.testrun.org nsd-checkzone staging2.testrun.org /etc/nsd/staging2.testrun.org.zone
ssh root@ns.testrun.org systemctl reload nsd
echo "${{ secrets.STAGING_SSH_KEY }}" >> ~/.ssh/staging.testrun.org
chmod 600 ~/.ssh/staging.testrun.org
- name: rebuild staging2.testrun.org to have a clean VPS
run: |
curl -X POST \
-H "Authorization: Bearer ${{ secrets.HETZNER_API_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{"image":"debian-12"}' \
"https://api.hetzner.cloud/v1/servers/${{ secrets.STAGING_SERVER_ID }}/actions/rebuild"
- run: pip install hetzner-relay/
- run: scripts/initenv.sh
- name: append venv/bin to PATH
run: echo venv/bin >>$GITHUB_PATH
- name: upload TLS cert after rebuilding
run: |
echo " --- wait until staging2.testrun.org VPS is rebuilt --- "
rm ~/.ssh/known_hosts
while ! ssh -o ConnectTimeout=180 -o StrictHostKeyChecking=accept-new -v root@staging2.testrun.org id -u ; do sleep 1 ; done
ssh -o StrictHostKeyChecking=accept-new -v root@staging2.testrun.org id -u
# download acme & dkim state from ns.testrun.org
rsync -e "ssh -o StrictHostKeyChecking=accept-new" -avz root@ns.testrun.org:/tmp/acme acme-restore || true
rsync -avz root@ns.testrun.org:/tmp/dkimkeys dkimkeys-restore || true
# restore acme & dkim state to staging2.testrun.org
rsync -avz acme-restore/acme root@staging2.testrun.org:/var/lib/ || true
rsync -avz dkimkeys-restore/dkimkeys root@staging2.testrun.org:/etc/ || true
ssh -o StrictHostKeyChecking=accept-new -v root@staging2.testrun.org chown root:root -R /var/lib/acme || true
- name: add hpk42 key to staging server
run: ssh root@staging2.testrun.org 'curl -s https://github.com/hpk42.keys >> .ssh/authorized_keys'
- name: run deploy-chatmail offline tests
run: pytest --pyargs cmdeploy
- run: |
cmdeploy init staging2.testrun.org
sed -i 's/#\s*mtail_address/mtail_address/' chatmail.ini
- run: cmdeploy run --verbose --skip-dns-check
- name: set DNS entries
run: |
cmdeploy dns --zonefile staging-generated.zone --verbose
cat staging-generated.zone >> .github/workflows/staging.testrun.org-default.zone
cat .github/workflows/staging.testrun.org-default.zone
scp .github/workflows/staging.testrun.org-default.zone root@ns.testrun.org:/etc/nsd/staging2.testrun.org.zone
ssh root@ns.testrun.org nsd-checkzone staging2.testrun.org /etc/nsd/staging2.testrun.org.zone
ssh root@ns.testrun.org systemctl reload nsd
- name: cmdeploy test
run: CHATMAIL_DOMAIN2=ci-chatmail.testrun.org cmdeploy test --slow
- name: cmdeploy dns
run: cmdeploy dns -v
- run: python3 hetzner-relay/main.py -i ~/.ssh/staging.testrun.org --dns --test --rebuild --run-id $GITHUB_RUN_ID --domain2 ci-chatmail.testrun.org --hetzner-api-token ${{ secrets.HETZNER_API_TOKEN }} relay/