An open API service indexing awesome lists of open source software.

https://github.com/amrabed/docker-ec2

Automatically run and test an application using Docker image running on different Amazon AWS EC2 instances
https://github.com/amrabed/docker-ec2

amazon-aws docker ec2-instance shell vagrant

Last synced: 7 months ago
JSON representation

Automatically run and test an application using Docker image running on different Amazon AWS EC2 instances

Awesome Lists containing this project

README

          

Docker-EC2

This script automates the process of running and testing an application using Docker image running on different Amazon AWS EC2 instances, provided by the user

Quick Start



  1. Download the files from here
  2. Update the fields of the Vagrantfile in the vagrant/ folder to match your own AWS credentials
  3. Run the script: ./docker-ec2 -h

How It Works


The script:


  1. Reads needed information provided in the input file, the VagrantFile, and the command line options

  2. Connects to the list of instance types provided

  3. Installs Docker on each instance

  4. Starts the application by running the provided command on the provided Docker app image

  5. Tests the application by running the provided test command on the provided Docker test image

  6. Copies test results back to local machine (requires SSH port enabled on test image)

Usage




Usage: ./docker-ec2 input_file [-k] [-i instance1[:instance2[:...]]]
or
./docker-ec2 -h (for help)

-i - List of EC2 instance types (default: m1.small)
-k - Keep instances from previous runs (default: false)
-h - Print this message

Input File


PLEASE NOTE THAT running Docker-EC2 using the sample input file may result in costs on your Amazon AWS account. Please read and modify the file as needed to match your preferences before running the script


The input file 'sample.in' provides an example input file showing the format and the full list of supported specs for application and test


app.image (required): The Docker image for the application under test


app.command (required): The command to be run on the Docker image to start the application


app.port : The application port (e.g. 80 for HTTP server)


app.instances : The list of EC2 instance types (separated by commas ',' or colons ':' )

test.image : The Docker image for the test


test.command : The command to be run on the Docker image to start the test


test.port : The port at which the test results are accessible (e.g. 22 for SSH/SCP)

Instance Types


Instance types can be specified either by using the input file using the app.instances specifier, or using the -i commend line option.


If both are specified, the command line option overrides the input file specification.


If none is specified, a default 'm1.small' is assumed.

Clean Up


By default, each run cleans all traces of previous runs, i.e. deletes created workspace folder (including output files), and terminates any running EC2 instances


To disable the auto-cleanup feature of the script, use the -k option. Using this option, output files created from subsequent runs may override files from previous runs (if they share the same instance types). However, running EC2 instances will be re-used.


To manually clean traces from previous runs, and/or terminate running EC2 instances, use the clean script as follows:



Usage: ./clean [-n] [all|log|output|instance]
or
./clean -h (for help)

all - Delete all generated files and folders
log - Delete log files only
output - Delete output folders only
instance - Delete instance folders only (default)

-n - Do NOT terminate EC2 instance(s)
-h - Display this message

To Do



  • Fix problem where app/test terminates (does not run as a service)

  • Automate plotting of received results

  • Allow test to be run on a separate instance type

  • Handle hashing in input file

  • Add Code Documentation

  • Update this file