GithubHelp home page GithubHelp logo

silky / a-flexible-staging-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jamesdavidson/a-flexible-staging-server

0.0 2.0 0.0 275 KB

Git push your Dockerfiles to EC2.

License: MIT License

Ruby 100.00%

a-flexible-staging-server's Introduction

A Flexible Staging Server

The Problem

Spinning up new EC2 instances is too cumbersome for rapid experimentation.

The Solution

A remote git repository which, upon receiving your code, builds and runs it in a lightweight Docker container.

The Implementation

This repository has a CloudFormation template, Ansible playbook and Ruby post receive hook for setting up such a service.

Disclaimer: the code in this repository, if used correctly, will add charges to your monthly bill from Amazon! That said however, the resources are neatly bundled up as a single CloudFormation and can be easily cleaned up (you just have to remember to do it).

Getting Started

Just install Python2 using your package manager, then install Pip using easy_install, then install Ansible and Boto using Pip.

{port|apt-get|brew|yum|pacman} install python2
easy_install pip
pip install ansible boto

Log in to the management console: http://console.aws.amazon.com/. Create a new keypair by uploading your public key (probably ~/.ssh/id_rsa.pub) and giving it a memorable name. I called mine mbp for MacBookPro.

If you choose to generate a new keypair instead, you can download it to your ~/.ssh folder. You may need to set restrictive permissions using a command along the lines of chmod 0600 ~/.ssh/keypair.pem. For convenience, also add this key to your SSH agent using a command such as ssh-add ~/.ssh/keypair.pem.

You will need an AWS token and secret in your ~/.boto file for py-boto, the open-source library that Ansible uses behind the scenes. See the boto wiki for more information: http://docs.pythonboto.org/en/latest/boto_config_tut.html.

If you have misplaced your credentials, you may need to generate new ones. You can do this in the IAM section of the management console: http://console.aws.amazon.com/iam.

Usage

Firstly, check the config options in src/parameters.yaml. Then, use Ansible to provision the CloudFormation (a single Linux instance, with all the security groups and access keys and stuff) and configure it to act as a git+docker server.

cd src && ansible-playbook setup.yaml

If the playbook runs successfully then you should see an IP address in the output stream. Use this to set up a git remote in your project's repository and then push some code which has a Dockerfile in its root directory. Wait as it gets built and assigned a random TCP port. You can then access the container at http://instance-ip:port/.

git remote add staging root@<hostname>:repo.git
git push --force staging <branch>
open http://ip-address:port/index.html

Notes

Requires: Ansible ~v1.4. License: MIT.

a-flexible-staging-server's People

Contributors

tspacek avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.