Skip to content

Connects our puny dev machines with Amazon's giant cloud.

Notifications You must be signed in to change notification settings

uamuzibora/bifrost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Bifrost

Connects our puny dev machines with Amazon's giant cloud.

Command line interface for Uamuzi Bora test instances on EC2.

Prerequisites

  • Python 2.7.x
  • Protip: Consider using Pythonz if this means you'll end up with multiple Python installs.
  • Pip - in order to install Boto & PyGithub.
  • $ curl https://python-distribute.org/distribute_setup.py | python
  • $ curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
  • Boto: $ pip install boto
  • PyGithub: $ pip install PyGithub
  • Optional: Mosh - If you want to use Mosh over SSH to connect to instances.
  • The UamuziBora keypair for EC2 - contact @kenners for this.
  • Your AWS credentials available in your environment (again, contact @kenners for this)
AWS_SECRET_ACCESS_KEY=xxxxxxxxxx
AWS_ACCESS_KEY_ID=xxxxxxxxxxx
export AWS_SECRET_ACCESS_KEY
export AWS_ACCESS_KEY_ID

or better: define them in your .bash_profile or .zshrc e.g.

export AWS_ACCESS_KEY_ID='xxxxxxxxxx'
export AWS_SECRET_ACCESS_KEY='xxxxxxx'

Install

Recommendation at this stage is to clone the repo and then add it to your path, ensuring that the git config variable github.user is set to your Github username and that the sshKeyPath points to wherever you put UamuziBora.pem.

  1. $ git clone [email protected]:uamuzibora/bifrost.git
  2. $ export PATH=/path/to/bifrost/directory:$PATH
  3. $ git config --global github.user "<your Github username>"
  4. Update the sshKeyPath variable in bifrost.py
  5. Cue the funky music...
  • e.g. $ bifrost --start=head

Usage

NB: <commit id> refers to the first 7 letters of the SHA hash of a Git commit in Nafasi

$ bifrost --start=<commit id> Starts of an EC2 instance of that commit. You may specify 'head'.

$ bifrost --stop Stops and terminates (if running) all instances belonging to you.

$ bifrost --list Lists all running Uamuzi Bora instances belonging to you.

$ bifrost --ssh Starts an SSH session with your instance.

$ bifrost --mosh Starts a Mosh session with your instance. Especially for @andrewlkho.

$ bifrost --dump Dumps the MySQL db of the instance associated with the commit and SCPs it to your current working directory as openmrs.sql.

$ bifrost --view Opens your system's default browser at the root URL of your OpenMRS install on the instance.

Tip: ignoring SSH host keys

Each time you fire up a new instance, the host will change. This means that when you ssh in, you'll be asked to confirm another host key. This ends up cluttering your known_hosts file (which is difficult to reverse if you have HashKnownHosts turned on). The solution is to put this in your ~/.ssh/config:

Host *.amazonaws.com
    UserKnownHostsFile /dev/null
    StrictHostKeyChecking no

Please understand the security implications of this before doing so.

About

Connects our puny dev machines with Amazon's giant cloud.

Resources

Stars

Watchers

Forks

Packages

No packages published