Skip to content

Commit 3f5994a

Browse files
committed
Add Binder playbook
Over Ubuntu 14.04, with stable/0.8.x and qa/0.9.x options.
1 parent 745e555 commit 3f5994a

File tree

9 files changed

+483
-0
lines changed

9 files changed

+483
-0
lines changed

playbooks/binder-trusty/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/roles
2+
/.vagrant
3+
/src

playbooks/binder-trusty/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# AtoM Playbook
2+
3+
The provided playbook installs AtoM on a local Vagrant virtual machine.
4+
5+
## Requirements
6+
7+
- Vagrant 1.8.0 or newer
8+
- Ansible 2.0.0 or newer
9+
10+
## How to use
11+
12+
Dowload the Ansible roles
13+
14+
$ ansible-galaxy install -f -p roles/ -r requirements.yml
15+
16+
Create the virtual machine and provision it:
17+
18+
$ vagrant up
19+
20+
To ssh to the VM, run:
21+
22+
$ vagrant ssh
23+
24+
If you want to forward your SSH agent too, run:
25+
26+
$ vagrant ssh -- -A
27+
28+
To (re-)provision the VM, using Vagrant:
29+
30+
$ vagrant provision
31+
32+
To (re-)provision the VM, using Ansible commands directly:
33+
34+
$ ansible-playbook singlenode.yml
35+
--inventory-file=".vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory" \
36+
--user="vagrant" \
37+
--private-key=".vagrant/machines/atom-local/virtualbox/private_key" \
38+
--extra-vars="atom_dir=/vagrant/src atom_environment_type=development" \
39+
--verbose
40+
41+
To (re-)provision the VM, passing your own arguments to `Ansible`:
42+
43+
$ ANSIBLE_ARGS="--tags=elasticsearch,percona,memcached,gearman,nginx" vagrant provision

playbooks/binder-trusty/Vagrantfile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5+
VAGRANTFILE_API_VERSION = "2"
6+
7+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8+
9+
config.vm.box = ENV.fetch("VAGRANT_BOX", "ubuntu/trusty64")
10+
11+
{
12+
"binder-local" => {
13+
"ip" => "192.168.168.195",
14+
"memory" => "2048",
15+
"cpus" => "2",
16+
},
17+
}.each do |short_name, properties|
18+
19+
# Define guest
20+
config.vm.define short_name do |host|
21+
host.vm.network "private_network", ip: properties.fetch("ip")
22+
host.vm.hostname = "#{short_name}.myapp.dev"
23+
end
24+
25+
# Set the amount of RAM and virtual CPUs for the virtual machine
26+
config.vm.provider :virtualbox do |vb|
27+
vb.customize ["modifyvm", :id, "--memory", properties.fetch("memory")]
28+
vb.customize ["modifyvm", :id, "--cpus", properties.fetch("cpus")]
29+
end
30+
31+
end
32+
33+
config.vm.synced_folder "src/atom", "/usr/share/nginx/atom", create: true
34+
35+
# Ansible provisioning
36+
config.vm.provision :ansible do |ansible|
37+
ansible.playbook = "./singlenode-qa.yml"
38+
ansible.host_key_checking = false
39+
ansible.extra_vars = {
40+
"atom_user" => "vagrant",
41+
"atom_group" => "vagrant",
42+
"atom_environment_type" => "development",
43+
"atom_flush_data" => "yes",
44+
"elasticsearch_network_bind_host" => "0.0.0.0",
45+
"es_config" => {
46+
"network.host" => "0.0.0.0"
47+
}
48+
}
49+
ansible.verbose = 'v'
50+
ansible.raw_arguments = ENV['ANSIBLE_ARGS']
51+
end
52+
53+
end

playbooks/binder-trusty/ansible.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[defaults]
2+
nocows=1
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
- src: "https://github.com/geerlingguy/ansible-role-java"
3+
version: "master"
4+
name: "geerlingguy.java"
5+
path: "roles/"
6+
7+
- src: "https://github.com/elastic/ansible-elasticsearch"
8+
version: "master"
9+
name: "elastic.elasticsearch"
10+
path: "roles/"
11+
12+
- src: "https://github.com/artefactual-labs/ansible-elasticsearch"
13+
version: "master"
14+
name: "artefactual.elasticsearch"
15+
path: "roles/"
16+
17+
- src: "https://github.com/artefactual-labs/ansible-percona"
18+
version: "master"
19+
name: "artefactual.percona"
20+
path: "roles/"
21+
22+
- src: "https://github.com/artefactual-labs/ansible-memcached"
23+
version: "master"
24+
name: "artefactual.memcached"
25+
path: "roles/"
26+
27+
- src: "https://github.com/artefactual-labs/ansible-gearman"
28+
version: "master"
29+
name: "artefactual.gearman"
30+
path: "roles/"
31+
32+
- src: "https://github.com/artefactual-labs/ansible-nginx"
33+
version: "master"
34+
name: "artefactual.nginx"
35+
path: "roles/"
36+
37+
- src: "https://github.com/artefactual-labs/ansible-atom"
38+
version: "master"
39+
name: "artefactual.atom"
40+
path: "roles/"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
- hosts: "binder-local"
3+
4+
pre_tasks:
5+
6+
- include_vars: "vars-singlenode-0.8.yml"
7+
tags:
8+
- "always"
9+
10+
roles:
11+
12+
- role: "artefactual.elasticsearch"
13+
become: "yes"
14+
tags:
15+
- "elasticsearch"
16+
17+
- role: "artefactual.percona"
18+
become: "yes"
19+
tags:
20+
- "percona"
21+
22+
- role: "artefactual.memcached"
23+
become: "yes"
24+
tags:
25+
- "memcached"
26+
27+
- role: "artefactual.gearman"
28+
become: "yes"
29+
tags:
30+
- "gearman"
31+
32+
- role: "artefactual.nginx"
33+
become: "yes"
34+
tags:
35+
- "nginx"
36+
37+
- role: "artefactual.atom"
38+
become: "yes"
39+
tags:
40+
- "atom"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
- hosts: "binder-local"
3+
4+
pre_tasks:
5+
6+
- include_vars: "vars-singlenode-qa.yml"
7+
tags:
8+
- "always"
9+
10+
- name: "Installing PPA for Java 8"
11+
apt_repository:
12+
repo: "ppa:openjdk-r/ppa"
13+
become: "yes"
14+
tags:
15+
- "always"
16+
17+
roles:
18+
19+
- role: "geerlingguy.java"
20+
become: "yes"
21+
tags:
22+
- "java"
23+
24+
- role: "elastic.elasticsearch"
25+
become: "yes"
26+
tags:
27+
- "elasticsearch"
28+
29+
- role: "artefactual.percona"
30+
become: "yes"
31+
tags:
32+
- "percona"
33+
34+
- role: "artefactual.memcached"
35+
become: "yes"
36+
tags:
37+
- "memcached"
38+
39+
- role: "artefactual.gearman"
40+
become: "yes"
41+
tags:
42+
- "gearman"
43+
44+
- role: "artefactual.nginx"
45+
become: "yes"
46+
tags:
47+
- "nginx"
48+
49+
- role: "artefactual.atom"
50+
become: "yes"
51+
tags:
52+
- "atom"
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
---
2+
3+
# PLEASE NOTE THAT THE PASSWORD VALUES USED HERE ARE NOT SAFE
4+
5+
#
6+
# atom role
7+
#
8+
9+
atom_path: "/usr/share/nginx/atom"
10+
atom_repository_url: "https://github.com/artefactual/binder.git"
11+
atom_repository_version: "stable/0.8.x"
12+
atom_config_db_hostname: "127.0.0.1"
13+
atom_config_db_name: "atom"
14+
atom_config_db_username: "atom-user"
15+
atom_config_db_password: "ATOMPASSWORD"
16+
atom_config_db_port: "3306"
17+
atom_es_host: "127.0.0.1"
18+
atom_es_port: "9200"
19+
atom_es_batch_size: "100"
20+
atom_es_config_version: "2.1"
21+
atom_mysql_user_name: "atom-user"
22+
atom_mysql_user_pass: "ATOMPASSWORD"
23+
atom_mysql_user_priv: "atom.*:ALL,GRANT"
24+
atom_mysql_user_host: "%"
25+
atom_drmc: "yes"
26+
atom_drmc_es_scripts: "yes"
27+
atom_worker_old_config: "yes"
28+
atom_pool_php_envs:
29+
ATOM_DRMC_TMS_URL: "http://artefactual.mockable.io/tms"
30+
ARCHIVEMATICA_SS_HOST: "192.168.168.192"
31+
ARCHIVEMATICA_SS_PORT: "8000"
32+
ARCHIVEMATICA_SS_PIPELINE_UUID: "CHANGE_ME"
33+
ARCHIVEMATICA_SS_USER: "test"
34+
ARCHIVEMATICA_SS_API_KEY: "CHANGE_ME"
35+
36+
#
37+
# nginx role
38+
#
39+
40+
nginx_configs:
41+
atom_backend:
42+
- upstream atom {
43+
server unix:/var/run/php-fpm.atom.sock;
44+
}
45+
46+
nginx_sites:
47+
atom:
48+
- listen 80
49+
- set $atom_path {{ atom_path }}
50+
- root $atom_path
51+
- server_name _
52+
- client_max_body_size 72M
53+
- location /api/docs {
54+
index index.html;
55+
alias $atom_path/plugins/arDrmcPlugin/frontend/docs/build/html;
56+
}
57+
- set $alt_request_uri $request_uri
58+
- location /drmc/ {
59+
error_page 404 = @drmc;
60+
log_not_found off;
61+
set $alt_request_uri /drmc/index;
62+
}
63+
- location @drmc {
64+
rewrite ^/drmc/(.*)$ /index.php last;
65+
}
66+
- location / {
67+
try_files $uri /index.php?$args;
68+
}
69+
- location ~ /\. {
70+
deny all;
71+
return 404;
72+
}
73+
- location ~* (\.yml|\.ini|\.tmpl)$ {
74+
deny all;
75+
return 404;
76+
}
77+
- location ~* /(?:uploads|files)/.*\.php$ {
78+
deny all;
79+
return 404;
80+
}
81+
- location ~ ^/(index|qubit_dev)\.php(/|$) {
82+
include /etc/nginx/fastcgi_params;
83+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
84+
fastcgi_param REQUEST_URI $alt_request_uri;
85+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
86+
fastcgi_pass atom;
87+
}
88+
- location ~* \.php$ {
89+
deny all;
90+
return 404;
91+
}
92+
93+
#
94+
# elasticsearch role
95+
#
96+
97+
elasticsearch_version: "1.7.6"
98+
elasticsearch_heap_size: "1g"
99+
100+
#
101+
# percona role
102+
#
103+
104+
mysql_version_major: "5"
105+
mysql_version_minor: "5"
106+
107+
mysql_databases:
108+
- name: "atom"
109+
collation: "utf8_general_ci"
110+
encoding: "utf8"
111+
112+
mysql_users:
113+
- name: "{{ atom_mysql_user_name }}"
114+
pass: "{{ atom_mysql_user_pass }}"
115+
priv: "{{ atom_mysql_user_priv }}"
116+
host: "{{ atom_mysql_user_host }}"
117+
118+
mysql_root_password: "MYSQLROOTPASSWORD"
119+
mysql_bind_address: "0.0.0.0"

0 commit comments

Comments
 (0)