forked from vrk-kpa/opendata
-
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.
Added datapusher and related configuration
- Loading branch information
Showing
8 changed files
with
101 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
- ckan-restart | ||
- drupal | ||
- data | ||
- datapusher | ||
handlers: | ||
- name: restart sshd | ||
service: name=ssh state=restarted |
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 @@ | ||
datapusher_max_content_length: "{{ 500 * 1024 * 1024 }}" #500MB |
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,27 @@ | ||
- name: Download Datapusher | ||
git: | ||
repo: https://github.com/6aika/datapusher.git | ||
dest: "{{ cache_path }}/datapusher.git" | ||
bare: yes | ||
|
||
- name: Install Datapusher | ||
pip: name="git+file://{{ cache_path }}/datapusher.git@master#egg=datapusher" virtualenv={{ datapusherenv }} extra_args="--exists-action=s -e" | ||
|
||
- name: Install Datapusher requirements | ||
pip: requirements={{ datapusherenv }}/src/datapusher/requirements.txt virtualenv={{ datapusherenv }} state=latest | ||
|
||
- name: Link datapusher sources | ||
command: "{{ datapusherenv }}/bin/python setup.py develop chdir={{ datapusherenv }}/src/datapusher" | ||
|
||
- name: Copy Datapusher site file | ||
template: src={{ item.src }} dest={{ item.dest }} mode={{ item.mode }} owner={{ item.owner }} group={{ item.group }} | ||
with_items: | ||
- { src: datapusher.j2, dest: /etc/apache2/sites-available/datapusher.conf, mode: "0644", owner: root, group: root} | ||
- { src: datapusher.wsgi.j2, dest: /etc/ckan/default/datapusher.wsgi, mode: "0640", owner: root, group: "{{ www_group }}" } | ||
- { src: datapusher_settings.py.j2, dest: /etc/ckan/default/datapusher_settings.py, mode: "0640", owner: root, group: "{{ www_group }}" } | ||
|
||
- name: Enable Datapusher configuration | ||
file: src=/etc/apache2/sites-available/datapusher.conf dest=/etc/apache2/sites-enabled/datapusher.conf state=link owner=root group=root | ||
|
||
- name: Restart Apache | ||
service: name=apache2 state=restarted |
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,23 @@ | ||
<VirtualHost *:8800> | ||
|
||
ServerName ckan | ||
|
||
# this is our app | ||
WSGIScriptAlias / /etc/ckan/default/datapusher.wsgi | ||
|
||
# pass authorization info on (needed for rest api) | ||
WSGIPassAuthorization On | ||
|
||
# Deploy as a daemon (avoids conflicts between CKAN instances) | ||
WSGIDaemonProcess datapusher display-name=demo processes=1 threads=15 | ||
|
||
WSGIProcessGroup datapusher | ||
|
||
ErrorLog /var/log/apache2/datapusher.error.log | ||
CustomLog /var/log/apache2/datapusher.custom.log combined | ||
|
||
<Directory "/" > | ||
Require all granted | ||
</Directory> | ||
|
||
</VirtualHost> |
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,14 @@ | ||
import os | ||
import sys | ||
import hashlib | ||
|
||
activate_this = os.path.join('/usr/lib/ckan/datapusher/bin/activate_this.py') | ||
execfile(activate_this, dict(__file__=activate_this)) | ||
|
||
import ckanserviceprovider.web as web | ||
os.environ['JOB_CONFIG'] = '/etc/ckan/default/datapusher_settings.py' | ||
web.init() | ||
|
||
import datapusher.jobs as jobs | ||
|
||
application = web.app |
32 changes: 32 additions & 0 deletions
32
ansible/roles/datapusher/templates/datapusher_settings.py.j2
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,32 @@ | ||
import uuid | ||
|
||
DEBUG = False | ||
TESTING = False | ||
SECRET_KEY = str(uuid.uuid4()) | ||
USERNAME = str(uuid.uuid4()) | ||
PASSWORD = str(uuid.uuid4()) | ||
|
||
NAME = 'datapusher' | ||
|
||
# database | ||
|
||
SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/job_store.db' | ||
|
||
# webserver host and port | ||
|
||
HOST = '0.0.0.0' | ||
PORT = 8800 | ||
|
||
# logging | ||
|
||
#FROM_EMAIL = 'server-error@example.com' | ||
#ADMINS = ['yourname@example.com'] # where to send emails | ||
|
||
#LOG_FILE = '/tmp/ckan_service.log' | ||
STDERR = True | ||
|
||
{% if deployment_environment_id == "vagrant" %} | ||
SSL_VERIFY = 'False' | ||
{% endif %} | ||
|
||
MAX_CONTENT_LENGTH = {{ datapusher_max_content_length }} |
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 |
---|---|---|
|
@@ -35,6 +35,7 @@ | |
- drupal | ||
- clamav | ||
- data | ||
- datapusher | ||
handlers: | ||
- name: restart sshd | ||
service: name=ssh state=restarted |
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