-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
more to do per #3
- Loading branch information
Bridget Almas
committed
Aug 10, 2018
1 parent
235f960
commit aeed7eb
Showing
5 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
classes: | ||
- role::ats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
certifi==2018.1.18 | ||
chardet==3.0.4 | ||
click==6.7 | ||
dateparser==0.7.0 | ||
Flask==0.12.2 | ||
Flask-SQLAlchemy==2.3.2 | ||
idna==2.6 | ||
itsdangerous==0.24 | ||
Jinja2==2.10 | ||
MarkupSafe==1.0 | ||
python-dateutil==2.7.1 | ||
pytz==2018.3 | ||
regex==2018.2.21 | ||
requests==2.18.4 | ||
six==1.11.0 | ||
SQLAlchemy==1.2.5 | ||
tzlocal==1.5.1 | ||
urllib3==1.22 | ||
Werkzeug==0.14.1 | ||
flask-cors==3.0.3 | ||
gunicorn==19.4.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
class profile::ats { | ||
include profile::ssl | ||
include profile::python3 | ||
|
||
$app_root = '/usr/local/alpheios-translation-service' | ||
$repos = 'https://github.com/alpheios-project/alpheios-translation-service' | ||
|
||
vcsrepo { $app_root: | ||
ensure => latest, | ||
revision => 'master', | ||
provider => git, | ||
source => $repos, | ||
notify => Python::Virtualenv[$app_root], | ||
} | ||
|
||
file { "/etc/gunicorn.d": | ||
ensure => directory, | ||
} | ||
|
||
file { "${app_root}/requirements.txt": | ||
ensure => file, | ||
source => 'puppet:///modules/profile/ats/requirements.txt', | ||
require => Vcsrepo[$app_root], | ||
notify => Python::Virtualenv[$app_root], | ||
} | ||
|
||
|
||
file { "${app_root}/app.py": | ||
ensure => file, | ||
content => epp('profile/ats/app.py.epp', { | ||
}), | ||
require => Vcsrepo[$app_root], | ||
notify => Python::Virtualenv[$app_root], | ||
} | ||
|
||
python::virtualenv { $app_root: | ||
ensure => present, | ||
version => '3', | ||
requirements => "${app_root}/requirements.txt", | ||
venv_dir => "${app_root}/venv", | ||
cwd => $app_root, | ||
notify => Exec['restart-ats-gunicorn'], | ||
require => File['/etc/gunicorn.d'], | ||
} | ||
|
||
python::gunicorn { 'ats-vhost': | ||
ensure => present, | ||
virtualenv => "${app_root}/venv", | ||
dir => $app_root, | ||
timeout => 120, | ||
bind => 'localhost:5000', | ||
appmodule => 'app:app', | ||
owner => 'www-data', | ||
group => 'www-data', | ||
} | ||
|
||
exec { 'restart-ats-gunicorn': | ||
command => '/usr/sbin/service gunicorn restart', | ||
refreshonly => true, | ||
require => Python::Gunicorn['ats-vhost'], | ||
} | ||
|
||
$proxy_pass = { | ||
'path' => '/', | ||
'url' => 'http://localhost:5000/', | ||
} | ||
|
||
$headers = [ | ||
"set Access-Control-Allow-Origin '*'", | ||
"set Access-Control-Allow-Methods 'GET, POST, OPTIONS'" | ||
] | ||
|
||
apache::vhost { 'ats': | ||
servername => 'ats.alpheios.net', | ||
port => '80', | ||
docroot => '/var/www/vhost', | ||
proxy_pass => [ $proxy_pass ], | ||
headers => $headers, | ||
} | ||
|
||
apache::vhost { 'ats-ssl': | ||
servername => 'ats.alpheios.net', | ||
port => '443', | ||
docroot => '/var/www/vhost', | ||
proxy_pass => [ $proxy_pass ], | ||
headers => $headers, | ||
ssl => true, | ||
ssl_cert => '/etc/ssl/certs/STAR_alpheios.net.crt', | ||
ssl_key => '/etc/ssl/private/Alpheios.key', | ||
ssl_chain => '/etc/ssl/certs/ca-bundle-client.crt', | ||
} | ||
|
||
firewall { '100 ATS Service Access': | ||
proto => 'tcp', | ||
dport => ['80','443'], | ||
action => 'accept', | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env python | ||
from flask import Flask | ||
from atservices import create_app | ||
|
||
app,db = create_app() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class role::ats { | ||
include profile::common | ||
include profile::ats | ||
} |