ciinabox (CI in a Box) pronounced ciin a box is a set of automation for building and managing a bunch of CI tools in AWS using the Elastic Container Service (ECS).
Right Now ciinabox supports deploying:
- jenkins
- private docker registry
- chef server
requires ruby 2.1+
- git clone https://github.com/base2Services/ciinabox-ecs.git
- cd ciinabox-ecs
- bundle install
- rake -T
- Initialize/Create a new ciinabox environment
$ rake ciinabox:init
Enter the name of ypur ciinabox:
myciinabox
Enter the id of your aws account you wish to use with ciinabox
111111111111
Enter the AWS region to create your ciinabox (e.g: ap-southeast-2):
us-west-2
Enter the name of the S3 bucket to deploy ciinabox to:
source.myciinabox.com
Enter top level domain (e.g tools.example.com), must exist in Route53 in the same AWS account:
myciinabox.com
# Enable active ciinabox by executing or override ciinaboxes base directory:
export CIINABOXES_DIR="ciinaboxes/"
export CIINABOX="myciinabox"
# or run
eval $(rake ciinabox:active[myciinabox])
You can override the default ciinaboxes directory by setting the CIINABOXES_DIR environment variable. Also the DNS domain you entered about must already exist in Route53
- check that your new ciinabox is the current active one
$ rake ciinabox:active
# Enable active ciinabox by executing or override ciinaboxes base directory:
export CIINABOXES_DIR="ciinaboxes/"
export CIINABOX="myciinabox"
# or run
eval $(rake ciinabox:active[myciinabox])
- Generate self-signed wild-card cert for your ciinabox
$ rake ciinabox:create_server_cert
Generating a 4096 bit RSA private key
.......................................................................................................................................++
....................++
writing new private key to 'ciinaboxes/myciinabox/ssl/ciinabox.key'
-----
- Create IAM server-certificates
$ rake ciinabox:upload_server_cert
Successfully uploaded server-certificates
- Create ciinabox S3 source deployment bucket
$ rake ciinabox:create_source_bucket
Successfully created S3 source deployment bucket source.myciinabox.com
- Create ssh ec2 keypair
$ rake ciinabox:generate_keypair
Successfully created ciinabox ssh keypair
- Generate ciinabox cloudformation templates
$ rake ciinabox:generate
Writing to output/ciinabox.json
using extras [[:yaml, "ciinaboxes/myciinabox/config/default_params.yml"], [:yaml, "config/services.yml"], [:ruby, "ext/helper.rb"]]
Loading YAML file ciinaboxes/myciinabox/config/default_params.yml
Setting local variable ciinabox_version to 0.1
Setting local variable ciinabox_name to myciinabox
......
......
$ ls -al output/
total 72
drwxr-xr-x 9 ciinabox staff 306 9 Sep 21:52 .
drwxr-xr-x 14 ciinabox staff 476 19 Oct 10:26 ..
-rw-r--r-- 1 ciinabox staff 0 7 Sep 14:30 .gitkeep
-rw-r--r-- 1 ciinabox staff 1856 19 Oct 13:27 ciinabox.json
-rw-r--r-- 1 ciinabox staff 6096 19 Oct 13:27 ecs-cluster.json
-rw-r--r-- 1 ciinabox staff 1358 9 Sep 17:39 ecs-service-elbs.json
-rw-r--r-- 1 ciinabox staff 3250 19 Oct 13:27 ecs-services.json
drwxr-xr-x 4 ciinabox staff 136 9 Sep 21:53 services
-rw-r--r-- 1 ciinabox staff 13218 19 Oct 13:27 vpc.json
This will render the cloudformation templates locally in the output directory
- Deploy/upload cloudformation templates to source deployment bucket
$ rake ciinabox:deploy
upload: output/vpc.json to s3://source.myciinabox.com/ciinabox/0.1/vpc.json
upload: output/ecs-services.json to s3://source.myciinabox.com/ciinabox/0.1/ecs-services.json
upload: output/ciinabox.json to s3://source.myciinabox.com/ciinabox/0.1/ciinabox.json
upload: output/services/jenkins.json to s3://source.myciinabox.com/ciinabox/0.1/services/jenkins.json
upload: output/ecs-service-elbs.json to s3://source.myciinabox.com/ciinabox/0.1/ecs-service-elbs.json
upload: output/ecs-cluster.json to s3://source.myciinabox.com/ciinabox/0.1/ecs-cluster.json
Successfully uploaded rendered templates to S3 bucket source.myciinabox.com
- Create/Lanuch ciinabox environment
$ rake ciinabox:create
Starting updating of ciinabox environment
# checking status using
$ rake ciinabox:status
allday ciinabox is in state: CREATE_IN_PROGRESS
# When your ciinabox environment is ready the status will be
allday ciinabox is alive!!!!
ECS cluster private ip:10.xx.xx.xx
You can access jenkins using http://jenkins.myciinabox.com
Runs a cloudformation update on the current ciinabox environment. You can use this task if you've modified the default_params.yml config file for your ciinabox and you want to apply these changes to your ciinabox.
A common update would be to lock down ip access to your ciinabox environment
- edit ciinaboxes/myciinabox/config/default_params.yml
....
#Environment Access
#add list of public IP addresses you want to access the environment from
#default to public access probably best to change this
opsAccess:
- my-public-ip
- my-my-other-ip
#add list of public IP addresses for your developers to access the environment
#default to public access probably best to change this
devAccess:
- my-dev-teams-ip
....
- update your ciinabox
$ rake ciinabox:generate
$ rake ciinabox:deploy
$ rake ciinabox:update
$ rake ciinabox:status
Tears down your ciinabox environment. But why would you want to :)
Displays the current active ciinabox environment and allows you to change to a different one
Not Yet implemented...pull-request welcome
Not Yet implemented...pull-request welcome