Compare commits

...

7 commits

Author SHA1 Message Date
cdddc1c952 better ci done 2024-01-08 10:05:04 -05:00
9b958a1fc9 tell us what's happening in the woodpecker UI
All checks were successful
ci/woodpecker/push/build-and-deploy Pipeline was successful
2024-01-08 10:00:14 -05:00
534864fd10 lazygit
All checks were successful
ci/woodpecker/push/build-and-deploy Pipeline was successful
2024-01-08 09:52:40 -05:00
ac32443f1c move ssh setup to script
All checks were successful
ci/woodpecker/push/build-and-deploy Pipeline was successful
we want to see the output of the deploy steps in the UI
doesn't happen if it's a scipt
not sure this will work
2024-01-08 09:48:18 -05:00
6ce4bf46bd variable expansion hard
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-01-08 09:35:59 -05:00
554c10b6f6 fix scp
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2024-01-08 09:31:22 -05:00
e703c27d4b do ci better hopefully
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2024-01-08 09:27:22 -05:00
3 changed files with 64 additions and 35 deletions

View file

@ -1,35 +0,0 @@
when:
branch:
include: [ main ]
steps:
build:
image: debian:bookworm-slim
commands:
- apt update
# - rm -rf data/
# - rm -rf in-progress
- apt -yq install racket ca-certificates
- yes Y | raco pkg install --no-docs csv-reading
- raco exe sorrel.dev.rkt
- raco distribute dist sorrel.dev
deploy:
image: alpine:latest
secrets: [ deploy_ssh_key ]
commands:
- apk add openssh
- mkdir ~/.ssh
- printf '%s\n' "$${DEPLOY_SSH_KEY}" > ~/.ssh/deploy_ssh_key
- printf "Host turtle.hup.is\n\tIdentityFile ~/.ssh/deploy_ssh_key\n\tUserKnownHostsFile=/dev/null\n\tStrictHostKeyChecking=no\n" > ~/.ssh/config
- chmod -R u=rwX,go= ~/.ssh
- mkdir oxaliq
- mv dist oxaliq/.
- mv source oxaliq/.
- mv static oxaliq/.
- scp -r oxaliq deploy@turtle.hup.is:~/
- ssh deploy@turtle.hup.is 'sudo rm -rf /srv/oxaliq || true && sudo mv oxaliq /srv/. && sudo systemctl restart sorreldotdev.service'
when:
# Only try to deploy if previous step is successful
status: success

View file

@ -0,0 +1,32 @@
when:
branch:
include: [ main ]
steps:
build:
image: debian:bookworm-slim
commands:
- apt update
- apt -yq install racket ca-certificates
- yes Y | raco pkg install --no-docs csv-reading
- raco exe sorrel.dev.rkt
- raco distribute dist sorrel.dev
deploy:
image: alpine:latest
secrets:
- deploy_ssh_key
commands:
- echo "SETTING UP SSH"
- apk add openssh-client
- mkdir -p $HOME/.ssh
- ssh-keyscan -t ed25519 turtle.hup.is >> $HOME/.ssh/known_hosts
- echo "$DEPLOY_SSH_KEY" > $HOME/.ssh/id_ed25519
- chmod 0600 $HOME/.ssh/id_ed25519
- echo "SSH SETUP DONE"
- echo "RUNNING DEPLOY SCRIPT"
- ./.woodpecker/deploy.sh
when:
# Only try to deploy if previous step is successful
status: success

32
.woodpecker/deploy.sh Executable file
View file

@ -0,0 +1,32 @@
#!/bin/sh -e
# hello variables
host=deploy@turtle.hup.is
# organize the files
echo "ORGANIZING THE FILES NICELY"
mkdir oxaliq
mv dist oxaliq/.
mv source oxaliq/.
mv static oxaliq/.
# put them on the deployment target
echo "COPYING FILES TO DEPLOYMENT TARGET"
scp -r oxaliq "$host":~/
# do everything on the server that's necessary to run the new thing
# TODO make this not remove the old-working version until
# the new version is confirmed working
echo "SETTING OWNERSHIP AND PERMISSIONS"
ssh $host 'sudo chown -R sorreldotdev:sorreldotdev oxaliq/'
ssh $host 'sudo chmod -R 755 oxaliq/'
echo "REPLACING PREVIOUS DEPLOYMENT"
ssh $host 'sudo rm -rf /srv/oxaliq || true'
ssh $host 'sudo mv oxaliq /srv/.'
echo "RESTARTING SERVICE"
ssh $host 'sudo systemctl restart sorreldotdev.service'
echo "SUCCESS!"
exit 0