aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles')
-rw-r--r--ansible/roles/mw-backend/files/etc/apache2/sites-enabled/000-default.conf6
-rw-r--r--ansible/roles/mw-backend/tasks/main.yml35
-rw-r--r--ansible/roles/mw-backend/templates/etc/mediawiki/LocalSettings.php.j218
3 files changed, 52 insertions, 7 deletions
diff --git a/ansible/roles/mw-backend/files/etc/apache2/sites-enabled/000-default.conf b/ansible/roles/mw-backend/files/etc/apache2/sites-enabled/000-default.conf
index 3823cf1..0af172a 100644
--- a/ansible/roles/mw-backend/files/etc/apache2/sites-enabled/000-default.conf
+++ b/ansible/roles/mw-backend/files/etc/apache2/sites-enabled/000-default.conf
@@ -4,11 +4,15 @@
ServerName mw.trygvis.io
ServerAdmin webmaster@trygvis.io
- DocumentRoot /var/lib/mediawiki
+ DocumentRoot /var/www/mw.trygvis.io
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
+ Alias /w /var/lib/mediawiki
+ Alias /wiki /var/lib/mediawiki/index.php
+ RedirectMatch permanent ^/$ /wiki/Main_Page
+
<Directory /var/lib/mediawiki/>
Options +FollowSymLinks
AllowOverride All
diff --git a/ansible/roles/mw-backend/tasks/main.yml b/ansible/roles/mw-backend/tasks/main.yml
index 5d04793..66d1aa7 100644
--- a/ansible/roles/mw-backend/tasks/main.yml
+++ b/ansible/roles/mw-backend/tasks/main.yml
@@ -1,4 +1,21 @@
---
+- name: misc setup
+ tags:
+ - mw-backend
+ - misc
+ block:
+ - name: /etc/hosts
+ copy:
+ dest: /etc/hosts
+ content: |
+ 127.0.0.1 localhost
+ 127.0.1.1 mw.trygvis.io mw
+
+ # The following lines are desirable for IPv6 capable hosts
+ ::1 localhost ip6-localhost ip6-loopback
+ ff02::1 ip6-allnodes
+ ff02::2 ip6-allrouters
+
- name: apt setup
tags:
- mw-backend
@@ -64,8 +81,16 @@
- php-gd
- php-apcu
- mediawiki
+ - name: /var/www/mw.trygvis.io
+ tags: apache-config
+ file:
+ state: directory
+ path: "/var/www/mw.trygvis.io"
+ owner: root
+ group: root
- name: apache config
notify: reload apache
+ tags: apache-config
copy:
src: etc/apache2/sites-enabled/000-default.conf
dest: /etc/apache2/sites-enabled/000-default.conf
@@ -95,6 +120,16 @@
with_items:
- /opt/mediawiki
- /opt/mediawiki/semantic-media-wiki
+ - name: symlink smw into mw extensions
+ file:
+ state: link
+ dest: "/var/lib/mediawiki/extensions/{{ item }}"
+ src: "/opt/mediawiki/semantic-media-wiki/extensions/{{ item }}"
+ owner: root
+ group: root
+ with_items:
+ - SemanticMediaWiki
+ - SemanticResultFormats
- name: composer config
copy:
src: opt/mediawiki/semantic-media-wiki/composer.json
diff --git a/ansible/roles/mw-backend/templates/etc/mediawiki/LocalSettings.php.j2 b/ansible/roles/mw-backend/templates/etc/mediawiki/LocalSettings.php.j2
index 4c3bd24..7526d05 100644
--- a/ansible/roles/mw-backend/templates/etc/mediawiki/LocalSettings.php.j2
+++ b/ansible/roles/mw-backend/templates/etc/mediawiki/LocalSettings.php.j2
@@ -26,7 +26,8 @@ $wgMetaNamespace = "Project";
## For more information on customizing the URLs
## (like /w/index.php/Page_title to /wiki/Page_title) please see:
## https://www.mediawiki.org/wiki/Manual:Short_URL
-$wgScriptPath = "";
+$wgScriptPath = "/w";
+$wgArticlePath = "/wiki/$1";
## The protocol and server name to use in fully-qualified URLs
$wgServer = "https://mw.trygvis.io";
@@ -129,10 +130,7 @@ wfLoadSkin( 'Vector' );
# The following extensions were automatically enabled:
wfLoadExtension( 'Cite' );
wfLoadExtension( 'ParserFunctions' );
-
-
-require_once "/opt/mediawiki/semantic-media-wiki/vendor/autoload.php";
-
+wfLoadExtension( 'SemanticMediaWiki' );
# End of automatically generated settings.
# Add more configuration options below.
@@ -161,8 +159,11 @@ $wgUseCategoryBrowser = true;
// Define constants for my additional namespaces.
define("NS_CHIP", 3000); // This MUST be even.
define("NS_CHIP_TALK", 3001); // This MUST be the following odd integer.
+define("NS_BOARD", 3002); // This MUST be even.
+define("NS_BOARD_TALK", 3003); // This MUST be the following odd integer.
+
+enableSemantics( 'https://mw.trygvis.io/wiki/', true );
-enableSemantics( 'https://mw.trygvis.io/', true );
$smwgShowFactbox = SMW_FACTBOX_NONEMPTY;
// Add "Chip" namespace
@@ -171,5 +172,10 @@ $wgExtraNamespaces[NS_CHIP_TALK] = "Chip_talk"; // Note underscores in the names
$wgContentNamespaces[] = NS_CHIP;
$smwgNamespacesWithSemanticLinks[NS_CHIP] = true;
+$wgExtraNamespaces[NS_BOARD] = "Board";
+$wgExtraNamespaces[NS_BOARD_TALK] = "Board_talk"; // Note underscores in the namespace name.
+$wgContentNamespaces[] = NS_BOARD;
+$smwgNamespacesWithSemanticLinks[NS_BOARD] = true;
+
# https://www.mediawiki.org/wiki/Manual:$wgSMTP
$wgSMTP = array('host' => '10.0.3.1', 'auth' => false);