mirror of
https://github.com/siemens-mobile-hacks/siepatchwiki.git
synced 2026-11-25 23:57:17 +00:00
Initial set up
This commit is contained in:
commit
fd122d4ea9
10 changed files with 326 additions and 0 deletions
4
.env.example
Normal file
4
.env.example
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
VIRTUAL_HOST=siepatchwiki.test
|
||||
LETSENCRYPT_HOST=siepatchwiki.test
|
||||
LETSENCRYPT_EMAIL=test@example.com
|
||||
GENERATE_HTTPS_LINKS=0
|
||||
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.env
|
||||
mediawiki
|
||||
data
|
||||
189
LocalSettings.php
Normal file
189
LocalSettings.php
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
<?php
|
||||
# This file was automatically generated by the MediaWiki 1.43.0
|
||||
# installer. If you make manual changes, please keep track in case you
|
||||
# need to recreate them later.
|
||||
#
|
||||
# See includes/MainConfigSchema.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 = "Siemens Mobile Hacks";
|
||||
$wgMetaNamespace = "Siemens_Mobile_Hacks";
|
||||
|
||||
## 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 = "";
|
||||
|
||||
## The protocol and server name to use in fully-qualified URLs
|
||||
$wgServer = "http://siepatchwiki.test";
|
||||
|
||||
## The URL path to static resources (images, scripts, etc.)
|
||||
$wgResourceBasePath = $wgScriptPath;
|
||||
|
||||
## The URL paths to the logo. Make sure you change this from the default,
|
||||
## or else you'll overwrite your logo when you upgrade!
|
||||
$wgLogos = [
|
||||
'1x' => "$wgResourceBasePath/img/logo.jpg",
|
||||
'icon' => "$wgResourceBasePath/img/logo.jpg",
|
||||
];
|
||||
|
||||
## UPO means: this is also a user preference option
|
||||
|
||||
$wgEnableEmail = true;
|
||||
$wgEnableUserEmail = true; # UPO
|
||||
|
||||
$wgEmergencyContact = "";
|
||||
$wgPasswordSender = "";
|
||||
|
||||
$wgEnotifUserTalk = false; # UPO
|
||||
$wgEnotifWatchlist = false; # UPO
|
||||
$wgEmailAuthentication = true;
|
||||
|
||||
## Database settings
|
||||
$wgDBtype = "sqlite";
|
||||
$wgDBserver = "";
|
||||
$wgDBname = "siepatch";
|
||||
$wgDBuser = "";
|
||||
$wgDBpassword = "";
|
||||
|
||||
# SQLite-specific settings
|
||||
$wgSQLiteDataDir = "/data";
|
||||
$wgObjectCaches[CACHE_DB] = [
|
||||
'class' => SqlBagOStuff::class,
|
||||
'loggroup' => 'SQLBagOStuff',
|
||||
'server' => [
|
||||
'type' => 'sqlite',
|
||||
'dbname' => 'wikicache',
|
||||
'tablePrefix' => '',
|
||||
'variables' => [ 'synchronous' => 'NORMAL' ],
|
||||
'dbDirectory' => $wgSQLiteDataDir,
|
||||
'trxMode' => 'IMMEDIATE',
|
||||
'flags' => 0
|
||||
]
|
||||
];
|
||||
$wgLocalisationCacheConf['storeServer'] = [
|
||||
'type' => 'sqlite',
|
||||
'dbname' => "{$wgDBname}_l10n_cache",
|
||||
'tablePrefix' => '',
|
||||
'variables' => [ 'synchronous' => 'NORMAL' ],
|
||||
'dbDirectory' => $wgSQLiteDataDir,
|
||||
'trxMode' => 'IMMEDIATE',
|
||||
'flags' => 0
|
||||
];
|
||||
$wgJobTypeConf['default'] = [
|
||||
'class' => 'JobQueueDB',
|
||||
'claimTTL' => 3600,
|
||||
'server' => [
|
||||
'type' => 'sqlite',
|
||||
'dbname' => "{$wgDBname}_jobqueue",
|
||||
'tablePrefix' => '',
|
||||
'variables' => [ 'synchronous' => 'NORMAL' ],
|
||||
'dbDirectory' => $wgSQLiteDataDir,
|
||||
'trxMode' => 'IMMEDIATE',
|
||||
'flags' => 0
|
||||
]
|
||||
];
|
||||
$wgResourceLoaderUseObjectCacheForDeps = true;
|
||||
|
||||
# Shared database table
|
||||
# This has no effect unless $wgSharedDB is also set.
|
||||
$wgSharedTables[] = "actor";
|
||||
|
||||
## Shared memory settings
|
||||
$wgMainCacheType = CACHE_ACCEL;
|
||||
$wgMemCachedServers = [];
|
||||
|
||||
## To enable image uploads, make sure the 'images' directory
|
||||
## is writable, then set this to true:
|
||||
$wgEnableUploads = false;
|
||||
#$wgUseImageMagick = true;
|
||||
#$wgImageMagickConvertCommand = "/usr/bin/convert";
|
||||
|
||||
# InstantCommons allows wiki to use images from https://commons.wikimedia.org
|
||||
$wgUseInstantCommons = false;
|
||||
|
||||
# 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;
|
||||
|
||||
# Site language code, should be one of the list in ./includes/languages/data/Names.php
|
||||
$wgLanguageCode = "en";
|
||||
|
||||
# Time zone
|
||||
$wgLocaltimezone = "UTC";
|
||||
|
||||
## 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";
|
||||
|
||||
$wgSecretKey = "ea457abddb0fa57ecfb5eec830659f1d3d3b4da9415205b54d462a9243541ba5";
|
||||
|
||||
# Changing this will log out all existing sessions.
|
||||
$wgAuthenticationTokenVersion = "1";
|
||||
|
||||
# Site upgrade key. Must be set to a string (default provided) to turn on the
|
||||
# web installer while LocalSettings.php is in place
|
||||
$wgUpgradeKey = "33762ec359a83929";
|
||||
|
||||
## 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 = "";
|
||||
$wgRightsText = "";
|
||||
$wgRightsIcon = "";
|
||||
|
||||
# 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, e.g. 'vector' or 'monobook':
|
||||
$wgDefaultSkin = "minerva";
|
||||
|
||||
# Enabled skins.
|
||||
# The following skins were automatically enabled:
|
||||
wfLoadSkin( 'MinervaNeue' );
|
||||
wfLoadSkin( 'MonoBook' );
|
||||
wfLoadSkin( 'Timeless' );
|
||||
wfLoadSkin( 'Vector' );
|
||||
|
||||
|
||||
# End of automatically generated settings.
|
||||
# Add more configuration options below.
|
||||
|
||||
wfLoadExtension( 'VisualEditor' );
|
||||
$wgGroupPermissions['user']['writeapi'] = true;
|
||||
wfLoadExtension( 'WikiEditor' );
|
||||
//wfLoadExtension( 'DiscussionTools' );
|
||||
// Optional: Set VisualEditor as the default editor for anonymous users
|
||||
// otherwise they will have to switch to VE
|
||||
$wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";
|
||||
|
||||
// Optional: Don't allow users to disable it
|
||||
$wgHiddenPrefs[] = 'visualeditor-enable';
|
||||
|
||||
// Optional: Enable VisualEditor's experimental code features
|
||||
$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;
|
||||
|
||||
// Activate ONLY the 2017 wikitext editor by default
|
||||
$wgDefaultUserOptions['visualeditor-autodisable'] = true;
|
||||
$wgDefaultUserOptions['visualeditor-newwikitext'] = 1;
|
||||
4
README.md
Normal file
4
README.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
1. Make sure docker-compose is installed and invoked as `docker-compose`
|
||||
2. `cp .env.example .env` and edit accordingly
|
||||
3. `./init.sh`
|
||||
4. Put the database into /data directory, images into /data/images
|
||||
25
docker-compose.yml
Normal file
25
docker-compose.yml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
services:
|
||||
nginx:
|
||||
build: nginx
|
||||
restart: always
|
||||
volumes:
|
||||
- ./mediawiki/:/app
|
||||
- ./data/images:/app/images
|
||||
- ./img/:/img
|
||||
links:
|
||||
- "php-fpm"
|
||||
environment:
|
||||
VIRTUAL_HOST: ${VIRTUAL_HOST}
|
||||
LETSENCRYPT_HOST: ${LETSENCRYPT_HOST}
|
||||
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL}
|
||||
php-fpm:
|
||||
build: php-fpm
|
||||
volumes:
|
||||
- ./mediawiki:/app
|
||||
- ./data/images:/app/images
|
||||
- ./data:/data
|
||||
restart: always
|
||||
networks:
|
||||
default:
|
||||
name: nginx-proxy
|
||||
external: true
|
||||
BIN
img/logo.jpg
Normal file
BIN
img/logo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
22
init.sh
Executable file
22
init.sh
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
if [ -d mediawiki ]; then
|
||||
echo "\"mediawiki\" directory alrady exists, skipping mediawiki installation"
|
||||
else
|
||||
mkdir mediawiki|| (echo "Failed to create \"mediawiki\" directory" && exit 1)
|
||||
curl https://releases.wikimedia.org/mediawiki/1.43/mediawiki-1.43.0.tar.gz -o /tmp/mediawiki-1.43.0.tar.gz || (echo "Failed to download mediawiki" && exit 1)
|
||||
tar -xvf /tmp/mediawiki-1.43.0.tar.gz -C ./mediawiki --strip-components=1 || (echo "Failed to extract mediawiki" && exit 1)
|
||||
fi
|
||||
set -a && source .env && set +a
|
||||
cp LocalSettings.php mediawiki/
|
||||
ESCAPED_VIRTUAL_HOST="$(printf '%s' "$VIRTUAL_HOST" | sed 's/[.\*\+\?\(\)\|\^\$\[\]{}\\]/\\&/g')"
|
||||
if [ "$GENERATE_HTTPS_LINKS" == "1" ]; then
|
||||
PREFIX='https'
|
||||
else
|
||||
PREFIX='http'
|
||||
fi
|
||||
sed -i "s,http://siepatchwiki\.test,${PREFIX}://${ESCAPED_VIRTUAL_HOST},g" mediawiki/LocalSettings.php
|
||||
mkdir -p data/deleted-files
|
||||
mkdir -p data/images
|
||||
chmod -R 777 data || true
|
||||
docker-compose up -d
|
||||
2
nginx/Dockerfile
Normal file
2
nginx/Dockerfile
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
FROM nginx:1.27.4-alpine
|
||||
COPY default.conf /etc/nginx/conf.d/default.conf
|
||||
64
nginx/default.conf
Normal file
64
nginx/default.conf
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /app;
|
||||
index index.php;
|
||||
charset utf-8;
|
||||
error_log /dev/stdout info;
|
||||
#Cloudflare support
|
||||
set_real_ip_from 103.21.244.0/22;
|
||||
set_real_ip_from 103.22.200.0/22;
|
||||
set_real_ip_from 103.31.4.0/22;
|
||||
set_real_ip_from 104.16.0.0/12;
|
||||
set_real_ip_from 108.162.192.0/18;
|
||||
set_real_ip_from 141.101.64.0/18;
|
||||
set_real_ip_from 162.158.0.0/15;
|
||||
set_real_ip_from 172.64.0.0/13;
|
||||
set_real_ip_from 173.245.48.0/20;
|
||||
set_real_ip_from 188.114.96.0/20;
|
||||
set_real_ip_from 190.93.240.0/20;
|
||||
set_real_ip_from 197.234.240.0/22;
|
||||
set_real_ip_from 198.41.128.0/17;
|
||||
set_real_ip_from 2400:cb00::/32;
|
||||
set_real_ip_from 2606:4700::/32;
|
||||
set_real_ip_from 2803:f800::/32;
|
||||
set_real_ip_from 2405:b500::/32;
|
||||
set_real_ip_from 2405:8100::/32;
|
||||
set_real_ip_from 2c0f:f248::/32;
|
||||
set_real_ip_from 2a06:98c0::/29;
|
||||
|
||||
# use any of the following two
|
||||
real_ip_header CF-Connecting-IP;
|
||||
#real_ip_header X-Forwarded-For;
|
||||
|
||||
error_page 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
location /images {
|
||||
try_files $uri =404;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
}
|
||||
location /img {
|
||||
alias /img/;
|
||||
try_files $uri =404;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
}
|
||||
|
||||
location ~ /vendor/ { deny all; }
|
||||
location ~ /cache/ { deny all; }
|
||||
location ~ /tests/ { deny all; }
|
||||
location ~ /maintenance/ { deny all; }
|
||||
location ~ /languages/ { deny all; }
|
||||
location ~ /includes/ { deny all; }
|
||||
location ~ /mw-config/ { deny all; }
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass php-fpm:9000;
|
||||
fastcgi_intercept_errors on;
|
||||
fastcgi_param SCRIPT_FILENAME /app/$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
||||
13
php-fpm/Dockerfile
Normal file
13
php-fpm/Dockerfile
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
FROM php:8.3-fpm-alpine3.20
|
||||
RUN apk add php83-sqlite3 git diffutils
|
||||
RUN mkdir /data && chmod 777 /data
|
||||
RUN set -ex \
|
||||
&& apk --no-cache add icu-dev libjpeg-turbo-dev libpng-dev freetype-dev zlib-dev \
|
||||
&& apk --no-cache add --virtual .build-deps $PHPIZE_DEPS \
|
||||
&& docker-php-ext-configure intl \
|
||||
&& docker-php-ext-configure gd --with-jpeg --with-freetype \
|
||||
&& docker-php-ext-install -j"$(nproc)" intl gd \
|
||||
&& pecl install apcu \
|
||||
&& docker-php-ext-enable apcu \
|
||||
&& apk del .build-deps
|
||||
CMD ["php-fpm"]
|
||||
Loading…
Add table
Reference in a new issue