Compare commits

...

5 Commits
main ... wip

Author SHA1 Message Date
4607d17254
Assign variables correctly 2020-02-01 03:34:03 -05:00
a9f3c44c00
Semi-installation 2020-01-31 22:50:08 -05:00
73656718d6
TMP: install mediawiki CLI 2020-01-31 01:44:59 -05:00
c811a28e03
Added Local Settings and Short URLs
Install in /w for Short URLs, add LocalSettings.php template
and added rewrite rules
2020-01-30 22:32:40 -05:00
9a6e6a0d43
MediaWiki web GUI installer comes up 2020-01-30 20:10:42 -05:00
4 changed files with 295 additions and 3 deletions

View File

@ -0,0 +1,82 @@
- name: Install MySQL Support for Python
apt:
name: python-pymysql
state: present
- name: Create Database
mysql_db:
name: "{{ mw_db_name }}"
state: present
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Create Database User
mysql_user:
name: "{{ mw_db_user }}"
password: "{{ mw_db_pass }}"
priv: "{{ mw_db_name }}.*:ALL,GRANT"
state: present
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Install PHP Modules
apt:
name: ['php-xml', 'php-mbstring']
state: present
notify: Reload Apache2
- name: Create Public HTML Directory
file:
path: "{{ mw_dir }}/public_html"
state: directory
# https://www.mediawiki.org/wiki/Manual:Short_URL#Moving_a_wiki_from_/wiki_to_/w
- name: Create Directory /w for Short URLs
file:
path: "{{ mw_dir }}/public_html/w"
state: directory
- name: Create Logs Directory
file:
path: "{{ mw_dir }}/logs"
state: directory
- name: Download MediaWiki
get_url:
url: "https://releases.wikimedia.org/mediawiki/\
{{ mw_version | regex_replace('\\.\\d+$', '') }}/\
mediawiki-{{ mw_version }}.tar.gz"
dest: /tmp/mediawiki-{{ mw_version }}.tar.gz
- name: Extract MediaWiki
unarchive:
src: /tmp/mediawiki-{{ mw_version }}.tar.gz
dest: "{{ mw_dir }}/public_html/w"
owner: www-data
group: www-data
extra_opts: [--strip-components=1]
remote_src: yes
- name: Install MediaWiki
command: |
php maintenance/install.php --dbname="{{ mw_db_name }}" \
--dbuser="{{ mw_db_user }}" --dbpass="{{ mw_db_pass }}" \
--pass="{{ mw_admin_pass }}" "{{ mw_namespace }}" admin
args:
chdir: "{{ mw_dir }}/public_html/w"
creates: "{{ mw_dir }}/public_html/w/LocalSettings.php"
- name: "Enable Apache Module: rewrite"
apache2_module:
name: rewrite
state: present
- name: Apply Apache Configuration
template:
src: mediawiki.conf.j2
dest: /etc/apache2/sites-available/{{ mw_domain }}.conf
notify: Reload Apache2
- name: Enable Apache Website
shell: a2ensite {{ mw_domain }}
args:
creates: /etc/apache2/sites-enabled/{{ mw_domain }}.conf
notify: Reload Apache2

View File

@ -0,0 +1,186 @@
<?php
# This file was automatically generated by the MediaWiki 1.33.0
# installer. If you make manual changes, please keep track in case you
# need to recreate them later.
#
# See includes/DefaultSettings.php for all configurable settings
# and their default values, but don't forget to make changes in _this_
# file, not there.
#
# Further documentation for configuration settings may be found at:
# https://www.mediawiki.org/wiki/Manual:Configuration_settings
# Protect against web entry
if ( !defined( 'MEDIAWIKI' ) ) {
exit;
}
## Uncomment this to disable output compression
# $wgDisableOutputCompression = true;
$wgSitename = "{{ mw_sitename }}";
$wgMetaNamespace = "{{ mw_namespace }}";
## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## 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 = "/w";
$wgScriptExtension = ".php";
$wgArticlePath = "/wiki/$1";
## The protocol and server name to use in fully-qualified URLs
$wgServer = "http://{{ mw_domain }}";
## The URL path to static resources (images, scripts, etc.)
$wgResourceBasePath = $wgScriptPath;
## The URL path to the logo. Make sure you change this from the default,
## or else you'll overwrite your logo when you upgrade!
$wgLogo = "$wgResourceBasePath/resources/assets/wiki.png";
#$wgLogo = "/logo.png";
## UPO means: this is also a user preference option
$wgEnableEmail = false;
$wgEnableUserEmail = true; # UPO
$wgEmergencyContact = "apache@{{ mw_domain }}";
$wgPasswordSender = "apache@{{ mw_domain }}";
$wgEnotifUserTalk = false; # UPO
$wgEnotifWatchlist = false; # UPO
$wgEmailAuthentication = true;
## Database settings
$wgDBtype = "mysql";
$wgDBserver = "{{ mw_db_host }}";
$wgDBname = "{{ mw_db_name }}";
$wgDBuser = "{{ mw_db_user }}";
$wgDBpassword = "{{ mw_db_pass }}";
# MySQL specific settings
$wgDBprefix = "";
# MySQL table options to use during installation or update
$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";
## Shared memory settings
$wgMainCacheType = CACHE_ACCEL;
$wgMemCachedServers = [];
## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads = true;
$wgGenerateThumbnailOnParse = false;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";
# InstantCommons allows wiki to use images from https://commons.wikimedia.org
$wgUseInstantCommons = true;
# Periodically send a pingback to https://www.mediawiki.org/ with basic data
# about this MediaWiki instance. The Wikimedia Foundation shares this data
# with MediaWiki developers to help guide future development efforts.
$wgPingback = true;
## If you use ImageMagick (or any other shell command) on a
## Linux server, this will need to be set to the name of an
## available UTF-8 locale
$wgShellLocale = "C.UTF-8";
## Set $wgCacheDirectory to a writable directory on the web server
## to make your wiki go slightly faster. The directory should not
## be publicly accessible from the web.
#$wgCacheDirectory = "$IP/cache";
# Site language code, should be one of the list in ./languages/data/Names.php
$wgLanguageCode = "en";
$wgSecretKey = "{{ lookup('password', '/dev/null length=64 chars=hexdigits') }}";
# Changing this will log out all existing sessions.
$wgAuthenticationTokenVersion = "{{ lookup('password', '/dev/null length=64 chars=hexdigits') }}";
# Site upgrade key. Must be set to a string (default provided) to turn on the
# web installer while LocalSettings.php is in place
$wgUpgradeKey = "{{ lookup('password', '/dev/null length=16 chars=hexdigits') }}";
## For attaching licensing metadata to pages, and displaying an
## appropriate copyright notice / icon. GNU Free Documentation
## License and Creative Commons licenses are supported so far.
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "https://creativecommons.org/licenses/by-sa/4.0/";
$wgRightsText = "Creative Commons Attribution-ShareAlike";
$wgRightsIcon = "$wgResourceBasePath/resources/assets/licenses/cc-by-sa.png";
# Path to the GNU diff3 utility. Used for conflict resolution.
$wgDiff3 = "/usr/bin/diff3";
## Default skin: you can change the default skin. Use the internal symbolic
## names, ie 'vector', 'monobook':
$wgDefaultSkin = "vector";
# Enabled skins.
# The following skins were automatically enabled:
wfLoadSkin( 'MonoBook' );
wfLoadSkin( 'Timeless' );
wfLoadSkin( 'Vector' );
# Enabled extensions. Most of the extensions are enabled by adding
# wfLoadExtensions('ExtensionName');
# to LocalSettings.php. Check specific extension documentation for more details.
# The following extensions were automatically enabled:
wfLoadExtension( 'CodeEditor' );
wfLoadExtension( 'ConfirmEdit' );
wfLoadExtension( 'MultimediaViewer' );
wfLoadExtension( 'PdfHandler' );
wfLoadExtension( 'SpamBlacklist' );
wfLoadExtension( 'TitleBlacklist' );
wfLoadExtension( 'WikiEditor' );
# End of automatically generated settings.
# Add more configuration options below.
# IP restictions
if ($_SERVER['REMOTE_ADDR'] != '{{ mw_iplock }}') {
$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['*']['edit'] = false;
}
# MobileFrontend
#wfLoadExtension( 'MobileFrontend' );
#wfLoadSkin( 'Vector' );
#$wgMFDefaultSkinClass = 'SkinVector';
# VisualEditor
#wfLoadExtension( 'VisualEditor' );
# Syntax highlighting
#wfLoadExtension( 'SyntaxHighlight_GeSHi' );
// Enable by default for everybody
$wgDefaultUserOptions['visualeditor-enable'] = 1;
// Optional: Set VisualEditor as the default for anonymous users
// otherwise they will have to switch to VE
// $wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";
// Don't allow users to disable it
$wgHiddenPrefs[] = 'visualeditor-enable';
// OPTIONAL: Enable VisualEditor's experimental code features
// #$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;
$wgVirtualRestConfig['modules']['parsoid'] = [
'url' => 'http://localhost:8142',
];
$wgShowExceptionDetails = true;

View File

@ -0,0 +1,23 @@
<VirtualHost *:80>
ServerName {{ mw_domain }}
ServerAdmin {{ mw_admin_email }}
DocumentRoot {{ mw_dir }}/public_html
RewriteEngine On
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
RewriteRule ^/?$ %{DOCUMENT_ROOT}/w/index.php [L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?w/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2 [L,QSA,B]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?w/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]
ErrorLog {{ mw_dir }}/logs/error.log
CustomLog {{ mw_dir }}/logs/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

View File

@ -19,6 +19,7 @@
roles:
- ansible
- webserver
- wordpress
- nextcloud
- timetrex
#- wordpress
#- nextcloud
#- timetrex
- mediawiki