Skip to content

Commit

Permalink
Merge branch 'master' of github.com:revmischa/udo
Browse files Browse the repository at this point in the history
  • Loading branch information
revmischa committed Jul 1, 2015
2 parents 02129b1 + 097354a commit da43474
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 8 deletions.
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -28,7 +28,7 @@ def read(*filenames, **kwargs):

setup(
name='udo',
version='1.0.6',
version='1.1.1',
url='http://github.com/revmischa/udo',
license='Anyone But RMS',
author='Mischa Spiegelmock',
Expand Down
20 changes: 17 additions & 3 deletions udo.sample.yml
Expand Up @@ -33,19 +33,33 @@ slack:
username: UdoBot
channel: '#notdevops'

# add some additional cloud-init script commands
# (see script/cloud-init.sh)
cloud_init: |


### CLOUD-INIT

# note: cloud_init_* is baked into LaunchConfigurations.
# to apply changes you must reload your LaunchConfigurations
# or use the 'update-lc' command

# add some additional cloud-init script commands before installing packages
cloud_init_pre: |
touch /root/myapp_init
# install AWS CLI tools
yum install -y aws-cli
# run after your packages are installed
# note: it's a good idea to install the CodeDeploy agent last, because
# autoscaling lifecycle hooks to deploy on instance creation will do a
# deploy straight away, so you want your dependencies in place when that happens
cloud_init_post: |
# install CodeDeploy agent
cd /home/ec2-user
aws s3 cp s3://aws-codedeploy-us-west-2/latest/install . --region us-west-2
chmod +x ./install
./install auto
rm install
# CodeDeploy
# 'application' and 'group' should reference existing configurations
# http://docs.aws.amazon.com/codedeploy/latest/userguide/welcome.html
Expand Down
20 changes: 16 additions & 4 deletions udo/launchconfig.py
Expand Up @@ -24,6 +24,9 @@ class LCTemplate(Template):
# Initialize a base system, provision via RPM installation
# Read by LaunchConfig
CLUSTER_NAME="@cluster_name"
ROLE_NAME="@role_name"
# Our stuff goes in here
BOOTSTRAP_DIR=/root/.udo
mkdir -p $BOOTSTRAP_DIR
Expand All @@ -50,12 +53,15 @@ class LCTemplate(Template):
# load up repo metadata
yum makecache
# your stuff from cloud_init config
# pre-package-setup
@cloud_init_pre
######
# install updates
yum update -y
# your stuff from cloud_init config
@cloud_init_extra
## install packages
# base system
if [[ -n "@base_packages" ]]; then
Expand All @@ -66,6 +72,8 @@ class LCTemplate(Template):
yum install -y @role_packages
fi
# custom post-init hook
@cloud_init_post
# might not be a bad idea to reboot after updating everything?
Expand Down Expand Up @@ -104,7 +112,11 @@ def cloud_init_script(self):
cloud_init_config['repo_url'] = self.role_config.get('repo_url') or ''

# append extra commands from config
cloud_init_config['cloud_init_extra'] = _cfg.get('cloud_init') or ''
cloud_init_config['cloud_init_pre'] = _cfg.get('cloud_init') or _cfg.get('cloud_init_pre') or ''
cloud_init_config['cloud_init_post'] = _cfg.get('cloud_init_post') or ''

cloud_init_config['cluster_name'] = _self.cluster_name or ''
cloud_init_config['role_name'] = self.role_name or ''

cloud_init = cloud_init_template.substitute(**cloud_init_config)
return cloud_init
Expand Down
6 changes: 6 additions & 0 deletions udo/main.py
Expand Up @@ -175,6 +175,12 @@ def deploy(self, *args):
elif action == 'stop':
dep = deploy.Deploy()
dep.stop_deployment()
elif len(args) == 1:
# let's just assume we wanna create a deployment
group = action
commit_id = args.pop(0)
dep = deploy.Deploy()
dep.create(group, commit_id)
else:
print "Unknown deploy command: {}".format(action)

Expand Down

0 comments on commit da43474

Please sign in to comment.