Working on #1 - FDA import process works. 3 hours for first import, 1.25 hours on subsequent updates.

This commit is contained in:
2013-10-27 18:35:35 -04:00
parent e0232aa02d
commit 0a7bf8f174
21 changed files with 759 additions and 472 deletions

View File

@@ -1,32 +1,32 @@
MAJOR:=$(shell bash -c 'source version.sh ; echo $$MAJOR')
BUILD:=$(shell bash -c 'source version.sh ; echo $$BUILD')
MODULEPATH:=$(shell puppet config print modulepath)
ifeq ($(MODULEPATH),)
$(error "I can't figure out your puppet modulepath, this will cause all kinds of bad things to happen with 'make install' and 'make uninstall'")
endif
PUPPET_DEPS=$(find mercy -type f)
PUPPET_DIST=mercy/pkg/akesterson-mercy-$(MAJOR).$(BUILD).tar.gz
.PHONY: clean
clean:
rm pkg/*
rm Modulefile
mercy/Modulefile: Modulefile.template.sh version.sh
source version.sh && bash Modulefile.template.sh > Modulefile
$(PUPPET_DIST): $(PUPPET_DEPS) mercy/Modulefile
rm -f $(PUPPET_DIST)
mkdir -p $$(dirname $(PUPPET_DIST))
echo 'We would use puppet module tool here but we dont because it doesnt work on windows buildhosts and cant upload from the command line anyway'
tar --exclude=mercy/Modulefile --exclude=mercy/pkg -czvf $(PUPPET_DIST) mercy/
dist: $(PUPPET_DIST)
all: $(PUPPET_DIST)
install: $(PUPPET_DIST)
tar -zxvf $(PUPPET_DIST) -C $(MODULEPATH)
uninstall:
MAJOR:=$(shell bash -c 'source version.sh ; echo $$MAJOR')
BUILD:=$(shell bash -c 'source version.sh ; echo $$BUILD')
MODULEPATH:=$(shell puppet config print modulepath)
ifeq ($(MODULEPATH),)
$(error "I can't figure out your puppet modulepath, this will cause all kinds of bad things to happen with 'make install' and 'make uninstall'")
endif
PUPPET_DEPS=$(find mercy -type f)
PUPPET_DIST=mercy/pkg/akesterson-mercy-$(MAJOR).$(BUILD).tar.gz
.PHONY: clean
clean:
rm pkg/*
rm Modulefile
mercy/Modulefile: Modulefile.template.sh version.sh
source version.sh && bash Modulefile.template.sh > Modulefile
$(PUPPET_DIST): $(PUPPET_DEPS) mercy/Modulefile
rm -f $(PUPPET_DIST)
mkdir -p $$(dirname $(PUPPET_DIST))
echo 'We would use puppet module tool here but we dont because it doesnt work on windows buildhosts and cant upload from the command line anyway'
tar --exclude=mercy/Modulefile --exclude=mercy/pkg -czvf $(PUPPET_DIST) mercy/
dist: $(PUPPET_DIST)
all: $(PUPPET_DIST)
install: $(PUPPET_DIST)
tar -zxvf $(PUPPET_DIST) -C $(MODULEPATH)
uninstall:
rm -fr $(MODULEPATH)/mercy

View File

@@ -1,12 +1,12 @@
#!/bin/bash
cat <<EOF
name 'akesterson-mercy'
version '${MAJOR}-${BUILD}'
dependency 'apache/apache'
summary 'Puppet module for deploying the mercy web application'
description 'Puppet module for deploying the mercy web application'
project_page http://github.com/akesterson/mercy/tree/master/puppet
license 'MIT'
author 'Andrew Kesterson <andrew@aklabs.net>'
EOF
#!/bin/bash
cat <<EOF
name 'akesterson-mercy'
version '${MAJOR}-${BUILD}'
dependency 'apache/apache'
summary 'Puppet module for deploying the mercy web application'
description 'Puppet module for deploying the mercy web application'
project_page http://github.com/akesterson/mercy/tree/master/puppet
license 'MIT'
author 'Andrew Kesterson <andrew@aklabs.net>'
EOF

View File

@@ -1,49 +1,49 @@
mercy
=====
A puppet module for installing the Mercy Flask application
Requirements
============
This puppet module assumes that you have:
* A RabbitMQ broker that we can use for Celery tasks
* Working apache on localhost, with mod_wsgi enabled and with a puppet service we can notify
* Working python 2.7 and pip on localhost
* Working postgres with a username, password, and database for mercy to use
Aside from that, the module has no dependencies.
Usage
=========
class { 'mercy':
# ---- These are required, they have no defaults
environment => 'dev|production',
version => 'absent|latest|MAJOR-MINOR',
ensure => 'running|stopped'.
rabbitmq_uri => 'RABBITMQ_BROKER_URI',
# ---- Everything below is optional
process_user => 'mercy',
process_group => 'mercy',
process_threads => 5,
servername => $::fqdn,
rabbitmq_user => 'mercy',
rabbitmq_pw => 'mercy',
rabbitmq_vhost => 'mercy',
vhost_dir => '/etc/apache/httpd/conf.d',
apache_service => 'httpd',
port => 443,
postgres_uri => 'localhost',
postgres_user => 'mercy',
postgres_pw => 'mercy',
postgres_db => 'mercy'
}
If 'environment' is dev, then the mercy application will be installed via a tarball located in ./mercy/files/mercy-${ensure}.tar.gz. If 'environment' is production, then mercy will be installed via pip and ensured at the given version.
Events
======
This puppet module will notify your apache service whenever the vhost is modified, or the mercy application version is updated, since an apache graceful restart will be required in either case.
mercy
=====
A puppet module for installing the Mercy Flask application
Requirements
============
This puppet module assumes that you have:
* A RabbitMQ broker that we can use for Celery tasks
* Working apache on localhost, with mod_wsgi enabled and with a puppet service we can notify
* Working python 2.7 and pip on localhost
* Working postgres with a username, password, and database for mercy to use
Aside from that, the module has no dependencies.
Usage
=========
class { 'mercy':
# ---- These are required, they have no defaults
environment => 'dev|production',
version => 'absent|latest|MAJOR-MINOR',
ensure => 'running|stopped'.
rabbitmq_uri => 'RABBITMQ_BROKER_URI',
# ---- Everything below is optional
process_user => 'mercy',
process_group => 'mercy',
process_threads => 5,
servername => $::fqdn,
rabbitmq_user => 'mercy',
rabbitmq_pw => 'mercy',
rabbitmq_vhost => 'mercy',
vhost_dir => '/etc/apache/httpd/conf.d',
apache_service => 'httpd',
port => 443,
postgres_uri => 'localhost',
postgres_user => 'mercy',
postgres_pw => 'mercy',
postgres_db => 'mercy'
}
If 'environment' is dev, then the mercy application will be installed via a tarball located in ./mercy/files/mercy-${ensure}.tar.gz. If 'environment' is production, then mercy will be installed via pip and ensured at the given version.
Events
======
This puppet module will notify your apache service whenever the vhost is modified, or the mercy application version is updated, since an apache graceful restart will be required in either case.

View File

@@ -1,22 +1,22 @@
class mercy(
$environment,
$version,
$ensure,
$rabbitmq_uri,
$process_user => 'mercy',
$process_group => 'mercy',
$process_threads => 5,
$servername => $::fqdn,
$rabbitmq_user => 'mercy',
$rabbitmq_pw => 'mercy',
$rabbitmq_vhost => 'mercy',
$vhost_dir => '/etc/apache/httpd/conf.d',
$apache_service => 'httpd',
$port => 443,
$postgres_uri => 'localhost',
$postgres_user => 'mercy',
$postgres_pw => 'mercy',
$postgres_db => 'mercy')
{
include 'mercy::params'
}
class mercy(
$environment,
$version,
$ensure,
$rabbitmq_uri,
$process_user => 'mercy',
$process_group => 'mercy',
$process_threads => 5,
$servername => $::fqdn,
$rabbitmq_user => 'mercy',
$rabbitmq_pw => 'mercy',
$rabbitmq_vhost => 'mercy',
$vhost_dir => '/etc/apache/httpd/conf.d',
$apache_service => 'httpd',
$port => 443,
$postgres_uri => 'localhost',
$postgres_user => 'mercy',
$postgres_pw => 'mercy',
$postgres_db => 'mercy')
{
include 'mercy::params'
}

View File

@@ -1,4 +1,4 @@
class mercy::params
{
}
class mercy::params
{
}

View File

@@ -1,12 +1,12 @@
<VirtualHost * :<%= scope.lookupvar('::mercy::port') %>>
ServerName <%= scope.lookupvar('::fqdn') %>
WSGIDaemonProcess mercy user=<%= scope.lookupvar('::mercy::process_user') %> group=<%= scope.lookupvar('::mercy::process_group') %> threads=<%= scope.lookupvar('::mercy::process_threads') %>
WSGIScriptAlias / /opt/mercy/scripts/mercy.wsgi
<Directory /opt/mercy>
WSGIProcessGroup mercy
WSGIApplicationGroup %{GLOBAL}
Order deny, allow
Allow from all
</Directory>
<VirtualHost * :<%= scope.lookupvar('::mercy::port') %>>
ServerName <%= scope.lookupvar('::fqdn') %>
WSGIDaemonProcess mercy user=<%= scope.lookupvar('::mercy::process_user') %> group=<%= scope.lookupvar('::mercy::process_group') %> threads=<%= scope.lookupvar('::mercy::process_threads') %>
WSGIScriptAlias / /opt/mercy/scripts/mercy.wsgi
<Directory /opt/mercy>
WSGIProcessGroup mercy
WSGIApplicationGroup %{GLOBAL}
Order deny, allow
Allow from all
</Directory>
</VirtualHost>

View File

@@ -1,49 +1,49 @@
# A generic, single database configuration.
[alembic]
# path to migration scripts
script_location = /opt/mercy/alembic
# template used to generate migration files
# file_template = %%(rev)s_%%(slug)s
# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false
sqlalchemy.url = postgresql://<%= scope.lookupvar('::mercy::postgres_user') %>:<%+ scope.lookupvar('::mercy::postgres_pw') %>@<%= scope.lookupvar('::mercy::postgres_uri') %>/<%= scope.lookupvar('::mercy::postgres_db') %>
# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
qualname =
[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
# A generic, single database configuration.
[alembic]
# path to migration scripts
script_location = /opt/mercy/alembic
# template used to generate migration files
# file_template = %%(rev)s_%%(slug)s
# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false
sqlalchemy.url = postgresql://<%= scope.lookupvar('::mercy::postgres_user') %>:<%+ scope.lookupvar('::mercy::postgres_pw') %>@<%= scope.lookupvar('::mercy::postgres_uri') %>/<%= scope.lookupvar('::mercy::postgres_db') %>
# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
qualname =
[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S