forked from NatLibFi/Skosmos
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Vagrantfile and Ansible Playbook setup for deploying and running …
…Skosmos in virtual environment
- Loading branch information
Showing
12 changed files
with
354 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,25 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
Vagrant.configure(2) do |config| | ||
|
||
config.vm.box = "ubuntu/xenial64" | ||
config.vm.network "forwarded_port", guest: 80, host: 8040 | ||
config.vm.post_up_message = "Skosmos up and running at localhost:8040/Skosmos" | ||
|
||
config.vm.synced_folder "", "/var/www/html/Skosmos" | ||
|
||
config.vm.provider "virtualbox" do |vb| | ||
vb.memory = "4096" | ||
vb.cpus = "2" | ||
# disable creating a log file to root folder: | ||
vb.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ] | ||
end | ||
|
||
config.vm.provision "ansible" do |ansible| | ||
ansible.playbook = "ansible/playbook.yml" | ||
ansible.verbose = "vvv" | ||
ansible.compatibility_mode = "2.0" | ||
end | ||
|
||
end |
Binary file not shown.
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 @@ | ||
default |
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,16 @@ | ||
--- | ||
- hosts: all | ||
become: True | ||
gather_facts: False | ||
roles: | ||
- base | ||
- openjdk | ||
- fuseki | ||
- skosmos | ||
pre_tasks: | ||
- name: Install Python 2.7 for Ansible | ||
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal) | ||
changed_when: False | ||
- name: Install Zip and Unzip for Ansible | ||
raw: sudo apt-get install zip unzip | ||
- setup: # aka gather_facts |
Binary file not shown.
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,5 @@ | ||
|
||
- name: Add 'openjdk' repository | ||
apt_repository: | ||
repo: ppa:openjdk-r/ppa | ||
state: present |
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,5 @@ | ||
export FUSEKI_HOME=/opt/fuseki | ||
export FUSEKI_BASE=/etc/fuseki | ||
|
||
FUSEKI_USER=fuseki | ||
JAVA_OPTIONS="-Xmx2048M" |
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,93 @@ | ||
|
||
- name: Download Fuseki tarball | ||
get_url: | ||
url: https://archive.apache.org/dist/jena/binaries/apache-jena-fuseki-2.3.0.tar.gz | ||
dest: /home/vagrant/ | ||
mode: 755 | ||
|
||
- name: Extract Fuseki to opt/ | ||
command: chdir=/opt /bin/tar xzf /home/vagrant/apache-jena-fuseki-2.3.0.tar.gz | ||
args: | ||
warn: false | ||
|
||
- name: Create a symbolic link to /opt/fuseki | ||
file: | ||
src: /opt/apache-jena-fuseki-2.3.0 | ||
dest: /opt/fuseki | ||
state: link | ||
|
||
- name: Add a new user fuseki | ||
user: | ||
name: fuseki | ||
home: /opt/fuseki | ||
system: yes | ||
create_home: no | ||
|
||
- name: Create directories to /var/lib | ||
file: | ||
path: "/var/lib/fuseki/{{ item }}" | ||
state: directory | ||
owner: fuseki | ||
group: fuseki | ||
mode: 0775 | ||
with_items: | ||
- backups | ||
- databases | ||
- system | ||
- system_files | ||
|
||
- name: Create directories | ||
file: | ||
path: "{{ item }}" | ||
state: directory | ||
owner: fuseki | ||
group: fuseki | ||
mode: 0775 | ||
with_items: | ||
- /var/log/fuseki | ||
- /etc/fuseki | ||
|
||
- name: Link fuseki home | ||
file: | ||
src: "/var/lib/fuseki/{{ item }}" | ||
dest: /etc/fuseki/{{ item }} | ||
state: link | ||
with_items: | ||
- backups | ||
- databases | ||
- system | ||
- system_files | ||
|
||
- name: Link logs to /etc/fuseki/logs | ||
file: | ||
src: /var/log/fuseki | ||
dest: /etc/fuseki/logs | ||
state: link | ||
|
||
- name: Copy Fuseki config | ||
copy: | ||
src: files/fuseki | ||
dest: /etc/default/ | ||
|
||
# - name: Setup autostart | ||
# file: | ||
# src: /opt/fuseki/fuseki | ||
# dest: /etc/init.d/ | ||
# state: link | ||
|
||
- name: Setup autostart | ||
command: chdir=/etc/init.d ln -s /opt/fuseki/fuseki . | ||
args: | ||
warn: false | ||
ignore_errors: yes | ||
|
||
- name: Update services | ||
command: update-rc.d fuseki defaults | ||
|
||
- name: Start service Fuseki | ||
service: | ||
name: fuseki | ||
state: started | ||
|
||
# - name: Start Fuseki Service | ||
# command: service fuseki start && update-rc.d fuseki defaults |
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,5 @@ | ||
- name: Update apt-cache and then install openjdk-8-jre | ||
apt: | ||
name: openjdk-8-jre | ||
update_cache: yes | ||
state: present |
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,16 @@ | ||
<VirtualHost *:80> | ||
|
||
<Directory /var/www/html> | ||
Options Indexes FollowSymLinks MultiViews | ||
AllowOverride All | ||
Order allow,deny | ||
allow from all | ||
</Directory> | ||
|
||
ServerAdmin webmaster@localhost | ||
DocumentRoot /var/www/html | ||
|
||
ErrorLog ${APACHE_LOG_DIR}/error.log | ||
CustomLog ${APACHE_LOG_DIR}/access.log combined | ||
|
||
</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,130 @@ | ||
@prefix void: <http://rdfs.org/ns/void#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
@prefix dc: <http://purl.org/dc/terms/> . | ||
@prefix foaf: <http://xmlns.com/foaf/0.1/> . | ||
@prefix wv: <http://vocab.org/waiver/terms/norms> . | ||
@prefix sd: <http://www.w3.org/ns/sparql-service-description#> . | ||
@prefix skos: <http://www.w3.org/2004/02/skos/core#> . | ||
@prefix skosmos: <http://purl.org/net/skosmos#> . | ||
@prefix isothes: <http://purl.org/iso25964/skos-thes#> . | ||
@prefix mdrtype: <http://publications.europa.eu/resource/authority/dataset-type/> . | ||
@prefix : <#> . | ||
|
||
# Skosmos main configuration | ||
|
||
:config a skosmos:Configuration ; | ||
# SPARQL endpoint | ||
# a local Fuseki server is usually on localhost:3030 | ||
#skosmos:sparqlEndpoint <http://localhost:3030/ds/sparql> ; | ||
# use the dev.finto.fi endpoint where the example vocabularies reside | ||
skosmos:sparqlEndpoint <http://api.dev.finto.fi/sparql> ; | ||
# sparql-query extension, or "Generic" for plain SPARQL 1.1 | ||
# set to "JenaText" instead if you use Fuseki with jena-text index | ||
skosmos:sparqlDialect "Generic" ; | ||
# whether to enable collation in sparql queries | ||
skosmos:sparqlCollationEnabled false ; | ||
# HTTP client configuration | ||
skosmos:sparqlTimeout 20 ; | ||
skosmos:httpTimeout 5 ; | ||
# customize the service name | ||
skosmos:serviceName "Skosmos" ; | ||
# customize the base element. Set this if the automatic base url detection doesn't work. For example setups behind a proxy. | ||
# skosmos:baseHref "http://localhost/Skosmos/" ; | ||
# interface languages available, and the corresponding system locales | ||
skosmos:languages ( | ||
[ rdfs:label "fi" ; rdf:value "fi_FI.utf8" ] | ||
[ rdfs:label "sv" ; rdf:value "sv_SE.utf8" ] | ||
[ rdfs:label "en" ; rdf:value "en_GB.utf8" ] | ||
) ; | ||
# how many results (maximum) to load at a time on the search results page | ||
skosmos:searchResultsSize 20 ; | ||
# how many items (maximum) to retrieve in transitive property queries | ||
skosmos:transitiveLimit 1000 ; | ||
# whether or not to log caught exceptions | ||
skosmos:logCaughtExceptions false ; | ||
# set to TRUE to enable logging into browser console | ||
skosmos:logBrowserConsole false ; | ||
# set to a logfile path to enable logging into log file | ||
# skosmos:logFileName "" ; | ||
# a default location for Twig template rendering | ||
skosmos:templateCache "/tmp/skosmos-template-cache" ; | ||
# customize the css by adding your own stylesheet | ||
skosmos:customCss "resource/css/stylesheet.css" ; | ||
# default email address where to send the feedback | ||
skosmos:feedbackAddress "" ; | ||
# email address to set as the sender for feedback messages | ||
skosmos:feedbackSender "" ; | ||
# email address to set as the envelope sender for feedback messages | ||
skosmos:feedbackEnvelopeSender "" ; | ||
# whether to display the ui language selection as a dropdown (useful for cases where there are more than 3 languages) | ||
skosmos:uiLanguageDropdown false ; | ||
# whether to enable the spam honey pot or not, enabled by default | ||
skosmos:uiHoneypotEnabled true ; | ||
# default time a user must wait before submitting a form | ||
skosmos:uiHoneypotTime 5 ; | ||
# plugins to activate for the whole installation (including all vocabularies) | ||
skosmos:globalPlugins () . | ||
|
||
# Skosmos vocabularies | ||
|
||
:ysa a skosmos:Vocabulary, void:Dataset ; | ||
dc:title "YSA - Yleinen suomalainen asiasanasto"@fi, | ||
"YSA - Allmän tesaurus på finska"@sv, | ||
"YSA - General Finnish thesaurus"@en ; | ||
dc:subject :cat_general ; | ||
dc:type mdrtype:THESAURUS ; | ||
void:uriSpace "http://www.yso.fi/onto/ysa/"; | ||
skosmos:groupClass skos:Collection; | ||
skosmos:language "fi"; | ||
skosmos:shortName "YSA"; | ||
skosmos:feedbackRecipient "vesa-posti@helsinki.fi" ; | ||
skosmos:showChangeList "true" ; | ||
void:dataDump <http://api.finto.fi/download/ysa/ysa-skos.ttl> ; | ||
void:sparqlEndpoint <http://api.dev.finto.fi/sparql> ; | ||
skosmos:sparqlGraph <http://www.yso.fi/onto/ysa/> | ||
. | ||
|
||
:yso a skosmos:Vocabulary, void:Dataset ; | ||
dc:title "YSO - Yleinen suomalainen ontologia"@fi, | ||
"ALLFO - Allmän finländsk ontologi"@sv, | ||
"YSO - General Finnish ontology"@en ; | ||
dc:subject :cat_general ; | ||
dc:type mdrtype:ONTOLOGY ; | ||
void:uriSpace "http://www.yso.fi/onto/yso/"; | ||
skosmos:language "fi", "sv", "en"; | ||
skosmos:defaultLanguage "fi"; | ||
skosmos:showTopConcepts "true"; | ||
skosmos:showStatistics "false"; | ||
skosmos:loadExternalResources "false"; | ||
skosmos:shortName "YSO", | ||
"ALLFO"@sv; | ||
skosmos:groupClass isothes:ConceptGroup ; | ||
skosmos:arrayClass isothes:ThesaurusArray ; | ||
void:dataDump <http://api.finto.fi/download/yso/yso-skos.ttl> ; | ||
void:sparqlEndpoint <http://api.dev.finto.fi/sparql> ; | ||
skosmos:sparqlGraph <http://www.yso.fi/onto/yso/> ; | ||
skosmos:mainConceptScheme <http://www.yso.fi/onto/yso/> | ||
. | ||
|
||
:categories a skos:ConceptScheme; | ||
skos:prefLabel "Skosmos Vocabulary Categories"@en | ||
. | ||
|
||
:cat_general a skos:Concept ; | ||
skos:topConceptOf :categories ; | ||
skos:inScheme :categories ; | ||
skos:prefLabel "Yleiskäsitteet"@fi, | ||
"Allmänna begrepp"@sv, | ||
"General concepts"@en | ||
. | ||
|
||
mdrtype:THESAURUS a skos:Concept ; | ||
skos:prefLabel "Тезаурус"@bg, "Tezaurus"@cs, "Tesaurus"@da, "Thesaurus"@de, "Θησαυρός"@el, "Thesaurus"@en, "Tesaurus"@et, "Tesaurus"@fi, "Thésaurus"@fr, "Pojmovnik"@hr, "Tezaurusz"@hu, "Tesauro"@it, "Tēzaurs"@lv, "Tezauras"@lt, "Teżawru"@mt, "Thesaurus"@nl, "Tesaurus"@no, "Tezaurus"@pl, "Tesauro"@pt, "Tezaur"@ro, "Synonymický slovník"@sk, "Tezaver"@sl, "Tesauro"@es, "Tesaurus"@sv | ||
. | ||
|
||
mdrtype:ONTOLOGY a skos:Concept ; | ||
skos:prefLabel "Онтология"@bg, "Ontologie"@cs, "Ontologi"@da, "Ontologie"@de, "Οντολογία"@el, "Ontology"@en, "Ontoloogia"@et, "Ontologia"@fi, "Ontologie"@fr, "Ontologija"@hr, "Ontológia"@hu, "Ontologia"@it, "Ontoloģija"@lv, "Ontologija"@lt, "Ontoloġija"@mt, "Ontologie"@nl, "Ontologi"@no, "Struktura pojęciowa"@pl, "Ontologia"@pt, "Ontologie"@ro, "Ontológia"@sk, "Ontologija"@sl, "Ontología"@es, "Ontologi"@sv | ||
. |
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,58 @@ | ||
|
||
- name: Install required Skosmos dependencies | ||
apt: | ||
name: "{{ item }}" | ||
state: present | ||
with_items: | ||
- apache2 | ||
- libapache2-mod-php7.0 | ||
- php-xml | ||
- php-mbstring | ||
- git | ||
|
||
- name: Copy modified Apache configuration file | ||
copy: | ||
src: files/000-default.conf | ||
dest: /etc/apache2/sites-enabled/000-default.conf | ||
|
||
- name: Enable Apache module mod_rewrite | ||
command: a2enmod rewrite | ||
|
||
- name: Restart Apache | ||
service: | ||
name: apache2 | ||
state: restarted | ||
|
||
- name: Download composer | ||
get_url: | ||
url: https://getcomposer.org/installer | ||
dest: /home/vagrant/composer-installer | ||
|
||
- name: Install composer | ||
shell: cat /home/vagrant/composer-installer | php -- --install-dir=/usr/local/bin | ||
|
||
- name: rename composer.phar to composer | ||
shell: mv /usr/local/bin/composer.phar /usr/local/bin/composer | ||
args: | ||
creates: /usr/local/bin/composer | ||
|
||
- name: Make composer executable | ||
file: | ||
path: /usr/local/bin/composer | ||
mode: a+x | ||
state: file | ||
|
||
- name: Install Skosmos PHP Dependencies | ||
command: chdir=/var/www/html/Skosmos composer install | ||
|
||
- name: Copy global and vocabulary-specific configurations | ||
copy: | ||
src: files/config.ttl.dist | ||
dest: /var/www/html/Skosmos/config.ttl | ||
|
||
- name: Generate locales, if necessary | ||
shell: "locale-gen {{ item }}" | ||
with_items: | ||
- en_GB.utf8 | ||
- fi_FI.utf8 | ||
- sv_SE.utf8 |