Skip to content

Commit

Permalink
Updated all APB examples to list dependencies in their metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
dymurray committed Jul 19, 2017
1 parent 89fd44b commit 6756d83
Show file tree
Hide file tree
Showing 13 changed files with 2,521 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM ansibleplaybookbundle/apb-base
# MAINTAINER {{ $MAINTAINER }}

LABEL "com.redhat.apb.version"="0.1.0"
LABEL "com.redhat.apb.spec"=\
"aWQ6IDY0Mjk3ZTg4LTY1N2MtNDZhYi1iYjUwLTJhZjdmODRlNWVjNgpuYW1lOiBweXppcC1kZW1v\
LWRiLWFwYgppbWFnZTogYW5zaWJsZXBsYXlib29rYnVuZGxlL3B5emlwLWRlbW8tZGItYXBiCmRl\
c2NyaXB0aW9uOiBQeXRob24gWmlwIERlbW8gRGF0YWJhc2UgQVBCIEltcGxlbWVudGF0aW9uCmJp\
bmRhYmxlOiBUcnVlCmFzeW5jOiBvcHRpb25hbAptZXRhZGF0YToKICBkaXNwbGF5TmFtZTogUHl6\
aXAgRGVtbyBEYXRhYmFzZSAoQVBCKQogIGxvbmdEZXNjcmlwdGlvbjogQSBkYXRhYmFzZSB3aXRo\
IEdJUyBzdXBwb3J0IGFuZCBzZWVkZWQgZGF0YSBmb3IgYSBkZW1vbnN0cmF0aW9uIHB5dGhvbiB3\
ZWJhcHAsIGh0dHBzOi8vZ2l0aHViLmNvbS9mdXNvci9weS16aXAtZGVtbwogIGltYWdlVXJsOiAK\
ICBkb2N1bWVudGF0aW9uVXJsOiBodHRwczovL2dpdGh1Yi5jb20vZnVzb3IvYXBiLWV4YW1wbGVz\
L3RyZWUvbWFzdGVyL3B5emlwLWRlbW8tZGItYXBiCiAgZGVwZW5kZW5jaWVzOgogICAgLSBkb2Nr\
ZXIuaW8vZmFiaWFudmYvcG9zdGdyZXNxbDpwb3N0Z2lzCiAgICAKcGFyYW1ldGVyczoKICAtIGRh\
dGFiYXNlX25hbWU6CiAgICAgIGRlZmF1bHQ6IGFkbWluCiAgICAgIHR5cGU6IHN0cmluZwogICAg\
ICB0aXRsZTogRGF0YWJhc2UgTmFtZQogICAgICAKICAtIGRhdGFiYXNlX3Bhc3N3b3JkOgogICAg\
ICBkZWZhdWx0OiBhZG1pbgogICAgICB0eXBlOiBzdHJpbmcKICAgICAgZGVzY3JpcHRpb246IEEg\
cmFuZG9tIGFscGhhbnVtZXJpYyBzdHJpbmcgaWYgbGVmdCBibGFuawogICAgICB0aXRsZTogRGF0\
YWJhc2UgUGFzc3dvcmQKICAgICAgCiAgLSBkYXRhYmFzZV91c2VyOgogICAgICBkZWZhdWx0OiBh\
ZG1pbgogICAgICB0aXRsZTogRGF0YWJhc2UgVXNlcgogICAgICB0eXBlOiBzdHJpbmcKICAgICAg\
bWF4bGVuZ3RoOiA2MwogICAgICAKICAKcmVxdWlyZWQ6CiAgLSBkYXRhYmFzZV9uYW1lCiAgLSBk\
YXRhYmFzZV91c2VyCiAg"

COPY roles /opt/ansible/roles
COPY playbooks /opt/apb/actions

RUN yum install -y postgresql && yum clean all

USER apb
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# pyzip-demo-db-apb
A Demo Database APB for the [Python Zipcode App](https://github.com/fusor/py-zip-demo)

## What it does
Deploys a demo database container with seeded [data](./roles/provision-pyzip-demo-db-apb/files/)

## Parameters
Name | Default Value | Required | Description
---|---|---|---
database_name | admin | Yes | database name
database_user | admin | Yes | database username
database_password | admin | No | database password

## Environment Variables
Name | Default Value | Description
---|---|---
NAMESPACE | pyzip-demo-db-apb | Namespace to deploy the cluster in
DBSERVICE_NAME | dbservice | Service name for database
37 changes: 37 additions & 0 deletions apb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
id: 64297e88-657c-46ab-bb50-2af7f84e5ec6
name: pyzip-demo-db-apb
image: ansibleplaybookbundle/pyzip-demo-db-apb
description: Python Zip Demo Database APB Implementation
bindable: True
async: optional
metadata:
displayName: Pyzip Demo Database (APB)
longDescription: A database with GIS support and seeded data for a demonstration python webapp, https://github.com/fusor/py-zip-demo
imageUrl:
documentationUrl: https://github.com/fusor/apb-examples/tree/master/pyzip-demo-db-apb
dependencies:
- docker.io/fabianvf/postgresql:postgis

parameters:
- database_name:
default: admin
type: string
title: Database Name

- database_password:
default: admin
type: string
description: A random alphanumeric string if left blank
title: Database Password

- database_user:
default: admin
title: Database User
type: string
maxlength: 63


required:
- database_name
- database_user

28 changes: 28 additions & 0 deletions playbooks/deprovision.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
- name: Deprovision pyzip-demo-db-apb from openshift
hosts: localhost
gather_facts: false
connection: local
post_tasks:
- k8s_v1_persistent_volume_claim:
name: postgresql
namespace: '{{ namespace }}'
state: absent
- openshift_v1_deployment_config:
name: postgresql
namespace: '{{ namespace }}'
replicas: 0
state: absent
- k8s_v1_service:
name: '{{ postgresql_service_name }}'
namespace: '{{ namespace }}'
state: absent
- openshift_v1_image_stream:
name: postgresql
namespace: '{{ namespace }}'
state: absent
roles:
- role: ansible.kubernetes-modules
install_python_requirements: no
vars:
namespace: '{{ namespace }}'
postgresql_service_name: '{{ postgresql_service_name }}'
9 changes: 9 additions & 0 deletions playbooks/provision.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- name: Deploy pyzip-demo-db-apb to openshift
hosts: localhost
gather_facts: false
connection: local
roles:
- role: ansible.kubernetes-modules
install_python_requirements: no
- role: provision-pyzip-demo-db-apb
playbook_debug: false
41 changes: 41 additions & 0 deletions roles/provision-pyzip-demo-db-apb/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Provision PyZip-Demo-DB-APB
===

Automates the deployment of Python pyzip-demo-db-apb to Openshift.


Requirements
------------

Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.

Role Variables
--------------

A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.

Dependencies
------------

A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.

Example Playbook
----------------

Running provision-pyzip-demo-db-apb is easy! Here's a sample playbook:

- hosts: localhost
gather_facts: no
connection: local
roles:
- { role: provision-pyzip-demo-db-apb }

License
-------

BSD

Author Information
------------------

An optional section for the role authors to include contact information, or a website (HTML is not allowed).
9 changes: 9 additions & 0 deletions roles/provision-pyzip-demo-db-apb/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# defaults for provision-pyzip-demo-db-apb

playbook_debug: no
namespace: "{{ lookup('env','NAMESPACE') | default('pyzip-demo-apb', true) }}"
dbservice_name: "{{ lookup('env','DBSERVICE_NAME') | default('dbservice', true) }}"
database_name: "{{ lookup('env','POSTGRESQL_DATABASE') | default('admin', true) }}"
database_password: "{{ lookup('env','POSTGRESQL_PASSWORD') | default('admin', true) }}"
database_user: "{{ lookup('env','POSTGRESQL_USER') | default('admin', true) }}"
16 changes: 16 additions & 0 deletions roles/provision-pyzip-demo-db-apb/files/airports.ddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
CREATE TABLE airports
(
name character varying(256),
code character varying(256) NOT NULL,
passengers int,
the_geom geometry(Geometry,4326),
CONSTRAINT airports_pk PRIMARY KEY (code )
)
WITH (
OIDS=FALSE
);

CREATE INDEX geom_index_airports
ON airports
USING gist
(the_geom );
Loading

0 comments on commit 6756d83

Please sign in to comment.