Reworked the .gitlab-ci.yml completely
Now using rsync and a ssh_config file for connecting, cleaning up everything Next time use a feature branch so the commits can be squashed easier! small fix 2 test small fix 3 apk fix rsync ssh fix script fix script fix 2 script fix 3 script fix 4 stackoverflow fix explicit ssh key maybe this fix? aaa maybe this debug debug 2 debug 3 now? order is important people persm ??? spaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaace one last change? home tilde bad now?! know what to change final different file structure test, progress minifying output
This commit is contained in:
parent
1bdbcb25cd
commit
7922f2c617
1 changed files with 12 additions and 6 deletions
|
@ -22,28 +22,34 @@ build-site:
|
||||||
expire_in: 1 day
|
expire_in: 1 day
|
||||||
|
|
||||||
deploy-site:
|
deploy-site:
|
||||||
image: node:lts
|
|
||||||
stage: deploy
|
stage: deploy
|
||||||
only:
|
only:
|
||||||
- main
|
- main
|
||||||
before_script:
|
before_script:
|
||||||
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
- 'which rsync || ( apk update && apk add rsync )'
|
||||||
|
- 'which ssh-agent || ( apk update && apk add openssh-client)'
|
||||||
- eval $(ssh-agent -s)
|
- eval $(ssh-agent -s)
|
||||||
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
|
|
||||||
- mkdir -p ~/.ssh
|
- mkdir -p ~/.ssh
|
||||||
- chmod 700 ~/.ssh
|
- chmod 700 ~/.ssh
|
||||||
|
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' >> ~/.ssh/key_firq
|
||||||
|
- chmod 600 ~/.ssh/key_firq
|
||||||
|
- echo "Host $DEPLOY_HOST" >> ~/.ssh/config
|
||||||
|
- echo $'\n\tIdentityFile ~/.ssh/key_firq' >> ~/.ssh/config
|
||||||
|
- echo $'\n\tStrictHostKeyChecking no\n\tIdentitiesOnly yes\n' >> ~/.ssh/config
|
||||||
|
- chmod 644 ~/.ssh/config
|
||||||
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
|
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
|
||||||
- chmod 644 ~/.ssh/known_hosts
|
- chmod 644 ~/.ssh/known_hosts
|
||||||
|
- echo "SSH setup completed"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- echo "Getting artifacts"
|
- echo "Getting artifacts"
|
||||||
- ls public
|
- ls public
|
||||||
- echo "Stopping screen session and cleaning"
|
- echo "Stopping screen session and cleaning"
|
||||||
- ssh $DEPLOY_USER@$DEPLOY_HOST -o StrictHostKeyChecking=no IdentitiesOnly=yes "screen -X -S website-firq-npx kill; rm -r -f public/*;"
|
- ssh $DEPLOY_USER@$DEPLOY_HOST "screen -X -S website-firq-npx kill; rm -r -f public/*;"
|
||||||
- echo "Copying to proxmox machine"
|
- echo "Copying to proxmox machine"
|
||||||
- rsync -e "ssh -o StrictHostKeyChecking=no IdentitiesOnly=yes" -a --progress public/ $DEPLOY_USER@$DEPLOY_HOST:~/public
|
- rsync -az --stats public $DEPLOY_USER@$DEPLOY_HOST:~/.
|
||||||
- echo "Restarting screen session"
|
- echo "Restarting screen session"
|
||||||
- ssh $DEPLOY_USER@$DEPLOY_HOST -o StrictHostKeyChecking=no IdentitiesOnly=yes "screen -S website-firq-npx -dm npx serve public/ -p 9000 -c serve.json"
|
- ssh $DEPLOY_USER@$DEPLOY_HOST "screen -S website-firq-npx -dm npx serve public/ -p 9000 -c serve.json"
|
||||||
- echo "Website is up on https://firq.dev/"
|
- echo "Website is up on https://firq.dev/"
|
||||||
|
|
||||||
success_notification:
|
success_notification:
|
||||||
|
|
Loading…
Reference in a new issue