Sometimes, you’ll deploy your app, navigate to its URL, and it’s just not running right. Fortunately, the Clusternator gives you some tools to help you troubleshoot.
Using these commands will require some one-time setup on your part.
Get set up
Both of these tools require you to set up your machine to connect to your running app over SSH. Clusternator makes it easy to wrangle your SSH keys to the right place.
Add an SSH public key to your app
Run the following command:
$ clusternator generate-ssh-key -n key-name
This will ask you some questions and then generate two files:
The first file is the public ssh key that will eventually end up inside your app’s containers.
The second file is the private key that should only reside on your local machine; this is your ssh authentication credential and should not be shared with anyone.
It should however be added to your local machine’s
ssh-agent by running the following command:
$ ssh-add ~/.ssh/key-name
Deploy the updated keys
You can now deploy the public key to your app. This is done by pushing the encrypted
bundle up to github and letting circle-ci deploy it onto your application’s machine.
Run the following commands:
$ clusternator make-private -p $(clusternator project shared-key)
$ clusternator private-checksum
$ git commit -am 'Deploying ssh key'
$ git push
Then wait for circle-ci to do its thing.
Tailing your app’s logs
Once the setup above has been completed, you’ll be able to see any output from your app in real time.
clusternator log as follows:
$ clusternator log
? Choose a Box to Log (Use arrow keys)
❯ Deployment master (22.214.171.124/running)
The clusternator will prompt you for the specific instance whose logs you’d like to view. This is especially handy if you have a number of PRs and other deployments in your CI pipeline.
Connecting to your app’s instance
Sometimes you need more sophisticated troubleshooting capabilities. Clusternator makes is easy
to locate your apps instances and connect to the with
```sh $ clusternator ssh Fri 8 Apr 2016 12:20:40 EDT ? Choose a Box to Log Deployment master (126.96.36.199/running) Last login: Thu Apr 7 22:01:10 2016 from 188.8.131.52
|_||( __ \ Amazon ECS-Optimized Amazon Linux AMI 2015.09.d|
For documentation visit, http://aws.amazon.com/documentation/ecs [ec2-user@ip-10-0-26-91 ~]$ ```
Some handy things you can do once you’re in to the instance:
docker psshow active docker containers
docker ps-a show all docker containers including stopped/crashed ones
docker logs <hash-from-docker-ps>/
docker logs --follow <hash-from-docker-ps>