2017 © Pedro Peláez
 

library assembler

Easy construction and packaging of docker containers using simple configuration scripts.

image

indatus/assembler

Easy construction and packaging of docker containers using simple configuration scripts.

  • Wednesday, May 13, 2015
  • by jlaswell
  • Repository
  • 4 Watchers
  • 2 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Assembler

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads, (*1)

Assembler allows you to easily construct and package docker containers using existing config scripts. Currently you can build containers using saltstack only, but there are plans to add the ability to provision using any configuration management tool such as puppet, chef, and ansible., (*2)

Requirements

  • Docker
  • PHP 5.4+
  • Salt

Install

Via Composer, (*3)

``` bash $ composer create-project indatus/assembler, (*4)


## Usage Assembler uses [Robo](http://robo.li/) to run tasks on the command line. This allows Assembler to wrap docker commands, so you will need to have docker installed wherever you run it. There is a vagrant file in the root of this repo that will bootstrap `ubuntu/trusty64` with docker and php5 which will allow you to run assembler. Additionally you will need to configure an ssh forward agent by: ``` bash vi ~/.ssh/config

then append: ``` bash host 172.17.8.150 ForwardAgent yes, (*5)

then run if you do not already have an id_rsa key:
``` bash
ssh-add

then just call vagrant up., (*6)

If everything goes according to plan, you should be able to start running assembler., (*7)

Terminology

This project extends a metaphor from manufacturing to building and deploying applications. Docker containers are stocked, fabricated, loaded, and packaged based on settings specified in a product line., (*8)

Product Line

A product line is simply a yaml file specifying the raw goods or base services that your product needs to run., (*9)

Consider the following example: ``` yaml raw_goods: - mysql: - user: root - password: password - php suppliers: - git@github.com:saltstack-formulas/mysql.git - git@github.com:saltstack-formulas/php.git userData: config/provision.sh # optional, (*10)


The above yaml represents a product line that tells assembler you want a container with mysql that has a root user with a password of password. Additionally it tells assembler where to find those raw goods as suppliers. You will need salt states available for each of the raw goods to be provisioned onto the Docker container. ### Stocking You stock goods by running `assembler:stock` and specifying a product line to stock example below: ``` bash $ robo assembler:stock my_webserver --goods-path=./goods

The above command will find the my_webserver.yml file git clone the raw goods and automatically generate a top.sls file for use by salt, (*11)

Fabricating

You 'fabricate' containers based on a base image derived from a docker file for example:, (*12)

``` bash $ robo assembler:fabricate /path/to/dockerfile/ mybaseimagename, (*13)


The above command will build a base image based on the specified docker file. ### Loading You 'load' containers with the raw goods specified in your production line for example: ``` bash $ robo assembler:load mybaseimagename /path/to/goods/

The above command will load all of the goods from the specified path. The '/path/to/goods' would be the same path specified by --goods-path in the stock task., (*14)

Packaging

You 'package' containers that have been stocked, fabricated, and loaded. For example:, (*15)

``` bash $ robo assembler:package somecontainerid myrepo/name, (*16)


This will commit the specified containerid into a docker image additionally if you specify the --push flag the package command will actually push the committed image to myrepo/name. To push you will need to specify your username, password, and email for the dockerregistry you are pushing to. ### Making The make command will do everything in one fail swoop. For example: ``` bash $ robo assembler:make my_base_product

will stock, fabricate, load, and package your containers, (*17)

Shipping

The ship command will login to a Docker host server via SSH and pull a Docker image and run the container instance., (*18)

robo ship leftyhitchens/mysql:5.2 192.168.1.100 --ports="3306:3306" --remote_command="mysqld_safe" --sudo

The above command will login to the server 192.168.1.100 via SSH and execute the following commands as sudo:, (*19)

sudo docker pull leftyhitchens/mysql:5.2
sudo docker run -d --name leftyhitchens_mysql_5.2_<unit_timestamp> -p 3306:3306 mysqld_safe

Provisioning

Configuration

You can specify which cloud provider assembler needs to ship the container to via the provisioning.yaml file. You will keep your public api token for individual providers here, along with any default ssh keys you like to be installed on the newly provisioned box. There is an example file in the config directory here, or you can look at the example below. ``` yaml provider: digitalocean tokens: digitalocean: yoursuperlongapitoken111 ssh: keys: - 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 userData: config/provision.sh # optional, (*20)

`userData` key provides a path to a [DigitalOcean cloud config](http://cloudinit.readthedocs.org/en/latest/topics/examples.html)
script. This will be executed during your droplet's creation and can be used for provisioning.
## Running

You can provision a server on digital ocean using the 'provision' command as below:

robo provision myhostname, (*21)


The above will use the information in your config file to create a droplet on digital ocean with the specified hostname as 'my_host_name'. A .machine file will be created with the form .machinemyhostname and will contain data about the created machine below is an example ```yaml id: 5083234 hostname: myhostname region: nyc3 size: 512mb image: docker backups: false ipv6: false privatenetworking: false

You can destroy the cloud server using the 'destroy' command as below:, (*22)

robo destroy .machinemyhostname

Where the value .machinemyhostname is the path to the machine file provisioned before, (*23)

Testing

bash $ phpunit, (*24)

Contributing

Please see CONTRIBUTING for details., (*25)

Security

If you discover any security related issues, please email tbell@indatus.com, mbunch@indatus.com, or jlaswell@indatus.com instead of using the issue tracker., (*26)

License

The MIT License (MIT). Please see License File for more information., (*27)

The Versions

13/05 2015

dev-master

9999999-dev https://github.com/indatus/assembler

Easy construction and packaging of docker containers using simple configuration scripts.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Bell
by Michael Bunch
by John Laswell

container docker provisioning assembler indatus

13/05 2015

v1.3.0

1.3.0.0 https://github.com/indatus/assembler

Easy construction and packaging of docker containers using simple configuration scripts.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Bell
by Michael Bunch
by John Laswell

container docker provisioning assembler indatus

06/05 2015

dev-bug-hanging-ssh

dev-bug-hanging-ssh https://github.com/indatus/assembler

Easy construction and packaging of docker containers using simple configuration scripts.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Bell
by Michael Bunch
by John Laswell

container docker provisioning assembler indatus

30/04 2015

v1.2.0

1.2.0.0 https://github.com/indatus/assembler

Easy construction and packaging of docker containers using simple configuration scripts.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Bell
by Michael Bunch
by John Laswell

container docker provisioning assembler indatus

28/04 2015

v1.1.0

1.1.0.0 https://github.com/indatus/assembler

Easy construction and packaging of docker containers using simple configuration scripts.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Bell
by Michael Bunch
by John Laswell

container docker provisioning assembler indatus

27/04 2015

v1.0.0

1.0.0.0 https://github.com/indatus/assembler

Easy construction and packaging of docker containers using simple configuration scripts.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Bell
by Michael Bunch
by John Laswell

container docker provisioning assembler indatus