Skip to content

Commit 626be6d

Browse files
committed
Merge branch 'active'
2 parents f680346 + 945a349 commit 626be6d

13 files changed

+207
-39
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
.hg/*
66
.svn/*
77
._*
8+
*.swp
9+
tmp
810

911
# Node
1012
node_modules

Dockerfile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Used to build Astrolet's base image.
2+
# This is an alternative to base.json - ultimately one will remain...
3+
# $ docker build --rm -t astrolet/ab . # = ansible base
4+
5+
# See https://github.com/phusion/baseimage-docker/blob/master/Changelog.md for
6+
# a list of version numbers.
7+
FROM phusion/baseimage:0.9.9
8+
9+
# Set correct environment variables.
10+
ENV HOME /root
11+
12+
# Only a temporary solution (for faster development)!
13+
# Uncomment this to enable the insecure key.
14+
RUN /usr/sbin/enable_insecure_key
15+
16+
# Regenerate SSH host keys. baseimage-docker does not contain any, so you
17+
# have to do that yourself. You may also comment out this instruction; the
18+
# init system will auto-generate one during boot.
19+
# RUN /etc/my_init.d/00_regen_ssh_host_keys.sh
20+
21+
# Install an SSH key of your choice.
22+
# ADD your_key /tmp/your_key
23+
# RUN cat /tmp/your_key >> /root/.ssh/authorized_keys && rm -f /tmp/your_key
24+
25+
# Use baseimage-docker's init system.
26+
CMD ["/sbin/my_init"]
27+
28+
# Ansible:
29+
RUN apt-get update
30+
RUN apt-get install -y sudo python-dev python-apt python-pycurl python-pip python-virtualenv
31+
RUN pip install -U ansible==1.5.3
32+
33+
# Clean up APT when done.
34+
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

README.md

+27-12
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
1-
# paddis -- packer ansible docker deployments, plus aws additives, and infrastructure serfdom
1+
# daps -- docker, ansible, processes & services
22

33
This is a devops project for infrastructure as code.
4+
5+
Not in active development... Though to be kept in mind,
6+
and hopefully taken further.
7+
8+
## Why
9+
410
[Culture is Defined by What You Cannot Say](http://thinkrelevance.com/blog/2014/02/17/culture-is-defined-by-what-you-cannot-say).
511

6-
* [DigitalOcean](https://digitalocean.com) cloud IaaS
7-
* [Packer](http://www.packer.io/) machine image, provisioning
8-
* [Docker](https://www.docker.io) process containers
9-
* [Ansible](http://www.ansible.com/home) provision docker containers
10-
* [Vagrant](http://www.vagrantup.com) develop [Docker on Ubuntu](https://github.com/angstwad/docker.ubuntu) Ansible playbook (otherwise optional)
11-
* [Serf](http://www.serfdom.io) decentralized orchestration / discovery
12+
## Ideas
13+
14+
Points of interest:
15+
16+
* [Packer](http://www.packer.io/) machine image builds + initial provisioning
17+
* [Docker](https://www.docker.io) process containers - a guaranteed must
18+
* [Baseimage](http://phusion.github.io/baseimage-docker/) a good starting point
19+
* [Ansible](http://www.ansible.com/home) provision / link docker containers
20+
* [Serf](http://www.serfdom.io) decentralized membership, events, queries
21+
* [Consul](http://www.consul.io) service discovery, configuration, health
1222
* [Dokku](https://github.com/progrium/dokku) `git push` deploy as if to Heroku
13-
* [Amazonica](https://github.com/mcohen01/amazonica) services:
14-
- [CloudWatch](http://aws.amazon.com/cloudwatch)
15-
- [CloudFront](http://aws.amazon.com/cloudfront)
16-
- [S3](http://aws.amazon.com/s3)
17-
- [Dynamo](http://aws.amazon.com/dynamodb)
23+
24+
Clouds and services:
25+
26+
* [DigitalOcean](https://digitalocean.com) or any better / more expensive clouds
27+
* [OpenShift](https://www.openshift.com) good for auto-scaling processing power
28+
* [Dynamo](http://aws.amazon.com/dynamodb) easy Datomic storage
29+
30+
## License
31+
32+
[MIT](http://orlin.mit-license.org)

base-docker.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"builders": [{
3+
"type": "docker",
4+
"image": "phusion/baseimage:0.9.9",
5+
"export_path": "packer/base-docker.tar",
6+
"run_command": ["run", "-d", "-i", "-t", "-v", "{{.Volumes}}", "{{.Image}}", "/sbin/my_init"]
7+
}],
8+
"provisioners": [{
9+
"type": "shell",
10+
"inline": [
11+
"apt-get update",
12+
"apt-get install -y sudo python-dev python-apt python-pycurl python-pip python-virtualenv",
13+
"pip install -U ansible==1.5.3",
14+
"apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*"
15+
]
16+
}],
17+
"post-processors": [
18+
[{ "type": "docker-import",
19+
"only": ["docker"],
20+
"keep_input_artifact": true,
21+
"repository": "astrolet/ab",
22+
"tag": "latest"
23+
}]
24+
]
25+
}

base.json

-24
This file was deleted.

bin/daps

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env coffee
2+
3+
daps = require("commander")
4+
{exe, run} = require("childish-process")
5+
6+
7+
# docker images | grep {repositoryID}
8+
imageID = (line) ->
9+
line.match(/^\S+\s+\S+\s+(\S+)/)[1]
10+
11+
# docker ps | grep {repositoryID}
12+
containerID = (line) ->
13+
line.match(/^(\S+)/)[1]
14+
15+
# docker inspect {containerID} | grep IPAddress
16+
containerIP = (line) ->
17+
line.match(/([^"]+)",?\s*$/)[1]
18+
19+
20+
daps.usage("[command] [options]")
21+
22+
daps.version(require("../package.json").version)
23+
24+
daps
25+
.command("build [repo]")
26+
.description("docker build the Dockerfile base image <repository>")
27+
.action (repo = "astrolet/ab") ->
28+
run "docker build --rm -t #{repo} ."
29+
30+
daps
31+
.command("ssh [repo]")
32+
.description("docker run a transient <repository> container and produce a command to ssh with")
33+
.action (repo = "phusion/baseimage") ->
34+
exe "docker ps | grep #{repo}", (stdout) ->
35+
exe "docker inspect #{containerID(stdout)} | grep IPAddress", (stdout) ->
36+
process.stdout.write "ssh -i tmp/insecure_key root@#{containerIP(stdout)}"
37+
38+
daps
39+
.command("blank")
40+
.description("a command that does nothing, used to test the daps bash script with")
41+
.action -> process.stdout.write '\n' # the last \n gets stripped with $() on the bash side
42+
43+
44+
daps.parse(process.argv)

bin/daps.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
BON_NAME="daps"
4+
BON_SCRIPT="bin/daps"
5+
BON_HELP="--help"
6+
BON_HELP_FILE="bin/help.txt"
7+
BON_EVALIST="ssh"
8+
# BON_CHECK_FILE="README.md"
9+
# BON_CHECK_GREP="^#\s\+daps\s\+"
10+
11+
source bon "$@"

bin/help.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

gulpfile.coffee

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
gulp = require("gulp")
2+
help = require("gulp-task-listing")
3+
4+
gulp.task "help", help
5+
6+
gulp.task "default", help
7+
8+
9+
gulp.task "init", ->
10+
console.log "will probably be a commander `daps init`, see trello card..."
11+
12+
# NOTE: there would probably be a need for gulp tasks eventually,
13+
# thus keeping this empty for now gulpfile...

gulpfile.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require('coffee-script/register')
2+
require('./gulpfile.coffee')

package.json

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "daps",
3+
"description": "docker ansible packer serf",
4+
"keywords": [
5+
"devops",
6+
"playground"
7+
],
8+
"version": "0.0.1",
9+
"repository": {
10+
"type": "git",
11+
"url": "git://github.com/orlin/daps.git"
12+
},
13+
"bugs": {
14+
"mail": "[email protected]",
15+
"url": "https://github.com/orlin/daps/issues"
16+
},
17+
"author": "Orlin M Bozhinov <[email protected]>",
18+
"contributors": [],
19+
"dependencies": {
20+
"bon": "*",
21+
"childish-process": "0.0.1",
22+
"coffee-script": "*",
23+
"commander": "*",
24+
"gulp": "*",
25+
"gulp-task-listing": "*",
26+
"install-g": "*"
27+
},
28+
"devDependencies": {},
29+
"bin": {
30+
"daps": "./bin/daps.sh"
31+
},
32+
"scripts": { "install": "./node_modules/.bin/install-g || true" },
33+
"engines": {
34+
"node": "0.10.x"
35+
},
36+
"licenses": [
37+
{
38+
"type": "MIT",
39+
"url": "http://orlin.mit-license.org"
40+
}
41+
]
42+
}

web.json web-docker.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
{
22
"builders": [{
33
"type": "docker",
4-
"image": "orlin/ubuntu-ansible:precise-1.5.x",
5-
"export_path": "packer/web-docker.tar"
4+
"image": "astrolet/ab",
5+
"export_path": "packer/web-docker.tar",
6+
"pull": false
67
}],
78
"provisioners": [{
89
"type": "ansible-local",
9-
"playbook_file": "web.yaml",
10+
"playbook_file": "web.yml",
1011
"staging_directory": "packer/tmp/ansible"
1112
}],
1213
"post-processors": [
1314
[{ "type": "docker-import",
15+
"only": ["docker"],
16+
"keep_input_artifact": true,
1417
"repository": "astrolet/web",
1518
"tag": "latest"
1619
}]

web.yaml web.yml

File renamed without changes.

0 commit comments

Comments
 (0)