- Create
.travis.yml
file in the base dir - Enter the following content:
language: elixir
elixir:
- 1.2
otp_release:
- 18.0
sudo: false
- Commit
- Goto travisci.com and enable your project
- Profit!
Sources:
- https://github.com/bitborn/tweet.py/blob/master/Readme.md
- https://www.digitalocean.com/community/questions/dokku-add-new-ssh-key
###On your local machine:
Generate a new key pair
ssh-keygen
This will prompt for a two things, namely:
- The output path (use
/home/<username>/.ssh/<app_name>
) - A passphrase (leave it empty)
Now copy the key to the server
cat ~/.ssh/<app_name>.pub | ssh <mydomain> "sudo sshcommand acl-add dokku <app_name>"
Now we can test pushing a project
Since we're not using the default key pair. We'll have to do a bit of local configuration.
Add the following to ~/.ssh/config
Host <app_name>.<mydomain>
HostName <app_name>.<mydomain>
User root
PreferredAuthentications publickey
IdentityFile ~/.ssh/<app_name>
Note that we're using the private key not <app_name>.pub
Add a remote to the project
git remote add dokku dokku@<app_name>.<mydomain>:<app_name>
Then push
git push dokku master
Install the travis gem
gem install travis
Create a travis directory
mkdir .travis
Create a pem file
openssl rsa -in ~/.ssh/<app_name> -outform pem > .travis/<app_name>.pem
Hide it from git
echo .travis/<app_name>.pem >> .gitignore
Log into travis
travis login --auto
Encrypt the key
travis encrypt-file .travis/<app_name>.pem --add
For some reason travis adds the encrypted key to the root directory lets move that
mv <app_name>.pem.enc .travis
Edit the .travis.yml
file to reflect the move.
Change -in <app_name>.pem.enc
to -in .travis/<app_name>.pem.enc
Add a after_success:
section like so
- chmod 600 .travis/<app_name>.pem
- mkdir -p ~/.ssh
- cp .travis/<app_name>.pem ~/.ssh
- cat .travis/host >> ~/.ssh/config
- git remote add production dokku@<mydomain>:<app_name>
- test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && git push dokku master
Then create a .travis/host
to make travis use the correct key:
Host <server address>
StrictHostKeyChecking no
IdentityFile ~/.ssh/<app_name>.pem
Then register your project on travis-ci.org and push away.