Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Custom Deployment documentation #437

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 16 additions & 13 deletions docs/user/deployment/custom.md
Expand Up @@ -6,25 +6,28 @@ permalink: custom/

You can easily deploy to your own server the way you would deploy from your local machine by adding a custom [`after_success`](/docs/user/build-configuration/#Define-custom-build-lifecycle-commands) step.

### FTP
### FTP, SFTP, SCP, etc.

env:
global:
- "FTP_USER=user"
- "FTP_PASSWORD=password"
after_success:
"wget -r ftp://server.com/ --user $FTP_USER --password $FTP_PASSWORD"
- "DEPLOY_URL=ftp://user:password@example.com"
after_success: |
if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then
find . -type f -exec curl --ftp-create-dirs -T {} $DEPLOY_URL/{}
fi

The env variables `FTP_USER` and `FTP_PASSWORD` can also be [encrypted](/docs/user/encryption-keys/).
The deploy URL can also be [encrypted](/docs/user/encryption-keys/).

### Git

This should also work with services you can deploy to via git.

after_success:
- chmod 600 .travis/deploy_key.pem # this key should have push access
- ssh-add .travis/deploy_key.pem
- git remote add deploy DEPLOY_REPO_URI_GOES_HERE
- git push deploy
env:
global:
- "DEPLOY_URL=git@example.com:repo.git"
after_success: |
if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then
chmod 600 .travis/deploy_key.pem # this key should have push access
ssh-add .travis/deploy_key.pem
git push $DEPLOY_URL
fi

See ["How can I encrypt files that include sensitive data?"](/docs/user/travis-pro/#How-can-I-encrypt-files-that-include-sensitive-data%3F) if you don't want to commit the private key unencrypted to your repository.