Skip to content

Commit

Permalink
Deploy with reviews code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Nelson committed Jun 19, 2014
1 parent a8f6b61 commit 91ad847
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
.coverage
*.pyc
files/r*
32 changes: 24 additions & 8 deletions Makefile
@@ -1,5 +1,7 @@
#!/usr/bin/make
PYTHON := /usr/bin/env python
REVIEWS_CODE = ../.sourcecode/rnr-server/
REVIEWS_REVNO = 249

build: sync-charm-helpers test

Expand Down Expand Up @@ -29,18 +31,32 @@ sync-ansible-roles: /tmp/charm-ansible-roles /tmp/canonical-ansible-roles
@cp -a /tmp/charm-ansible-roles/wsgi-app ./roles
@cp -a /tmp/charm-ansible-roles/nrpe-external-master ./roles

deploy:
@echo Deploying charm-bootstrap-wsgi as wsgi-example with gunicorn.
@juju deploy --num-units 2 --repository=../.. local:precise/charm-bootstrap-wsgi wsgi-example
@juju set wsgi-example build_label=r1
deploy: create-tarball
@echo Deploying ubuntu-reviews r$(REVIEWS_REVNO) with gunicorn.
@juju deploy --num-units 2 --repository=../.. local:precise/ubuntu-reviews
@juju set ubuntu-reviews build_label=r$(REVIEWS_REVNO)
@juju deploy gunicorn
@juju deploy nrpe-external-master
@juju add-relation wsgi-example gunicorn
@juju add-relation wsgi-example nrpe-external-master
@juju add-relation ubuntu-reviews gunicorn
@juju add-relation ubuntu-reviews nrpe-external-master
@echo See the README for explorations after deploying.

curl:
juju run --service wsgi-example "curl -s http://localhost:8080"
juju run --service ubuntu-reviews "curl -s http://localhost:8080"

nagios:
juju run --service wsgi-example "egrep -oh /usr.*lib.* /etc/nagios/nrpe.d/check_* | sudo -u nagios -s bash"
juju run --service ubuntu-reviews "egrep -oh /usr.*lib.* /etc/nagios/nrpe.d/check_* | sudo -u nagios -s bash"

collect-code: $(REVIEWS_CODE)

$(REVIEWS_CODE):
@echo Grabbing the reviews server code
@mkdir -p ../.sourcecode
@cd ../.sourcecode && bzr branch -r $(REVIEWS_REVNO) lp:rnr-server

create-tarball: $(REVIEWS_CODE) files/r$(REVIEWS_REVNO)/rnr-server.tgz

files/r$(REVIEWS_REVNO)/rnr-server.tgz:
@echo Creating tarball of code for deploy
@mkdir -p files/r$(REVIEWS_REVNO)
@tar czf $@ -C $(REVIEWS_CODE) .
6 changes: 3 additions & 3 deletions metadata.yaml
@@ -1,6 +1,6 @@
name: charm-bootstrap-wsgi
summary: Bootstrap your wsgi service charm.
maintainer: Developer Account <Developer.Account@localhost>
name: ubuntu-reviews
summary: A review API service for Ubuntu click packages.
maintainer: Michael Nelson <michael.nelson@canonical.com>
description: |
<Multi-line description here>
categories:
Expand Down
6 changes: 3 additions & 3 deletions playbook.yml
Expand Up @@ -2,13 +2,13 @@
- hosts: localhost

vars:
- app_label: wsgi-app.example.com
- app_label: click-reviews.ubuntu.com

roles:
- role: wsgi-app
listen_port: 8080
wsgi_application: example_wsgi:application
code_archive: "{{ build_label }}/example-wsgi-app.tar.bzip2"
wsgi_application: wsgi:app
code_archive: "{{ build_label }}/rnr-server.tgz"
when: build_label != ''

- role: nrpe-external-master
Expand Down

0 comments on commit 91ad847

Please sign in to comment.