Skip to content

Commit

Permalink
👷 SSH fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
samdenty committed Jan 4, 2018
1 parent c8f3e20 commit 7bf2921
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ cache:
yarn: true
before_install:
- echo $PWD&&ls
- openssl aes-256-cbc -K $encrypted_642a931f3ecb_key -iv $encrypted_642a931f3ecb_iv -in sshkey.enc -out sshkey -d
- chmod 400 sshkey
- chmod -R +x travis
- (cd travis && yarn && node travis)
after_success:
- cd travis
- echo -e "-----BEGIN RSA PRIVATE KEY-----\n${sshkey//'#'/$'\n'}\n-----END RSA PRIVATE KEY-----\n" > sshkey
- chmod 400 sshkey
- node travis success
- ssh -i ../sshkey -o "StrictHostKeyChecking no" -t $sshuser@$sshhost "cd \"$sshdir\" && npm run pull"
- if [ -z "$sshcmd" ]; then sshcmd="cd \"$sshdir\" && npm run pull"; fi
- ssh -i sshkey -o "StrictHostKeyChecking no" -t $sshuser@$sshhost "$sshcmd"
after_failure:
- (cd travis && node travis failure)
notifications:
Expand Down
8 changes: 5 additions & 3 deletions travis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ Injectify supports continuous integration via the use of TravisCI. This basicall
| Name | Value |
| ------- | ---------------------------------------------------------------------------------------- |
| sshhost | The IP address of your VPS |
| sshdir | The root directory in which the Injectify is stored |
| sshuser | The user to login into your VPS |
| sshkey | The root directory in which the Injectify is stored |
| sshdir | (Optional) The root directory in which the Injectify is stored |
| sshcmd | (Optional) A custom bash script to run instead of the default |
| webhook | (Optional) A [Discord](https://discordapp.com/) webhook URL |

![Environment Variables](https://i.imgur.com/G8L6T2v.png)
![Environment Variables](https://i.imgur.com/DgrUZtT.png)

## Adding the SSH key
Follow the [official guide](https://docs.travis-ci.com/user/encrypting-files/) on how to install the command-line tool and add an encrypted file. Make sure you replace `$encrypted_642a931f3ecb_key` in `.travis.yml` with your generated variable
Extract the BASE64 encoded private key, replacing all newlines with `#` and set it as the `sshkey` environment variable

## Discord integration
If you specify the webhook URL, you'll get build status messages on your Discord server. Refer to [Intro to webhooks](https://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks) for help on how to create a webhook.
Expand Down

0 comments on commit 7bf2921

Please sign in to comment.