Skip to content
Permalink
Browse files
Enable deployment by rsync
The contents of this commit were generated by the following methodology.

1. `travis login`

2. Create a dedicated SSH key (no passphrase)
`ssh-keygen -t rsa -b 4096 -C 'build@travis-ci.org' -f ./deploy_rsa`

3. Get Travis to encrypt the file. `--add` automatically adds it to .travis. It prints out a helpful output reminding you to only commit the .enc version NOT the deploy_rsa itself!
`travis encrypt-file deploy_rsa --add`

https://docs.travis-ci.com/user/encrypting-files/

4. Copy the public key to the remote host
`ssh-copy-id -i deploy_rsa.pub <ssh-user>@<deploy-host>`

5. Delete the public key and the private key as they are no longer needed, you only need the encrypted key
`rm -f deploy_rsa deploy_rsa.pub`

6. I also encrypted the SSH user and host

`travis encrypt SOMEVAR="secretvalue" --add`

https://docs.travis-ci.com/user/encryption-keys

and deleted the FTP variables as they are no longer required

This heavily used the Travis documentation, supplemented by this blog post: https://oncletom.io/2016/travis-ssh-deploy/
  • Loading branch information
annashipman committed Nov 17, 2017
1 parent 6b37351 commit 3ed4b7c9d647d5c3cc5d90f746c9549883699a1d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
@@ -7,7 +7,10 @@ branches:
- master
env:
global:
- secure: wqjgRKbIko4dB5KinLhd/fQ8V538P36CVm74tVtlJcBtURb4Yv+Oa6MAOIwZOCjVW6K6f77Pqp2lEYBCvF/x/7gnDanSEXla9rZ/sNHKlJHvNWcqCiVRuoNAqLOr54ahjsT4jBEnT6MMHOYsddUwDduRkNLxQwqyb5LDsW5uVODjHt5KRmWWPVGu545ApnSNb5Cl1B/RLtyiuRJ1zBAFPLRI1TeH8/D04uhQXcr8SBkPjvE6gez/lUrlE3SLMU1nKHK3bPII+6eDbOJ1BN4aSVyH8hN0I60uSkkR2l0KcZx8qm/1ttWxzB2iHvJ2bKERLfmB+J8v1GrpZi/uWnq3S2uL5V3lmudGItf95/e0az1JywnHNb95skXEoyJ0sZqD6ugTcrX+jhFbQw3GdC4aa8yoNAk5z5fzQW4x2obwUttMnSsqZNHGgD7/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rk/95cUjnArt2I7gjcC+gSI+CbyAkYsBDaRP5kYZ/NmTibC8Zm+Tf1vt8lwrZKKQASEtpH/2nzVOZkdLFSZE7kp4stxkEkmCubvYPqzxSlAp13C8TjA9abfYjy6hyQg7xXZOplSJktvl0D3ogrCTKfdzvU3PG49ORhm4jELxTSS+mz0=
after_success:
- scripts/deploy.sh
before_install:
- openssl aes-256-cbc -K $encrypted_1ee39b83ab2f_key -iv $encrypted_1ee39b83ab2f_iv
-in deploy_rsa.enc -out deploy_rsa -d
BIN +3.17 KB deploy_rsa.enc
Binary file not shown.
@@ -1,4 +1,4 @@
#!/bin/bash
set -e

curl --ftp-create-dirs -T _site/README.md -u $FTP_USER:$FTP_PASSWORD ftp.gridhost.co.uk/public_html/tmp/
rsync -r --delete-after --quiet _site/ $SSH_USER@$DEPLOY_HOST:public_html/tmp/

0 comments on commit 3ed4b7c

Please sign in to comment.