Initial import

This commit is contained in:
3wc 2020-09-05 01:59:00 +02:00
commit cee2c91e39
5 changed files with 123 additions and 0 deletions

6
.envrc Normal file
View File

@ -0,0 +1,6 @@
export DB_ROOT_PASSWD_VERSION=v1
export DB_PASSWD_VERSION=v1
export DOMAIN=mediawiki.swarm.autonomic.zone
export LETS_ENCRYPT_ENV=production
export STACK_NAME=mediawiki
export NGINX_CONF_VERSION=v1

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Revian Labs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

27
README.MD Normal file
View File

@ -0,0 +1,27 @@
# Mediawiki
Mediawiki [1.32.1](https://www.mediawiki.org/wiki/Release_notes/1.32.1).
Requires Docker version 1.11.2 and up
Based on [`mediawiki-ve-bundle`](https://hub.docker.com/r/revianlabs/mediawiki-ve-bundle).
1. Set up Docker Swarm
2. `cp .envrc.sample .envrc`
3. Edit `.envrc`
4. `direnv allow` (or `. .envrc`)
5. `. .helpers.sh` (don't forget the dot!)
6. `create-secrets` (note down the passwords!) FIXME: Current function doesn't
output passwords 😕
7. `docker stack deploy -c compose.yml mediawiki`
8. Go to the `$DOMAIN` you configured in #3
9. Click "Install", then follow the prompts. Enter the `root` and user passwords
you generated in #6
10. Download the `LocalSettings.php`, and copy it to the `mediawiki_mediawiki`
container, in `/var/www/html`, using e.g.
docker container cp ./local/path/to/LocalSettings.php <containerid>:/var/www/html/
## License
MIT License

63
compose.yml Normal file
View File

@ -0,0 +1,63 @@
---
version: '3.8'
services:
mariadb:
image: 'mariadb:10.5'
environment:
- MYSQL_USER=mediawiki
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_root_password
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
- MYSQL_DATABASE=mediawiki
volumes:
- 'mariadb:/var/lib/mysql'
secrets:
- db_root_password
- db_password
networks:
- internal
deploy:
restart_policy:
condition: on-failure
delay: "60s"
max_attempts: 3
window: 120s
mediawiki:
image: 'revianlabs/mediawiki-ve-bundle'
environment:
- DOMAIN=${DOMAIN}
volumes:
- 'mediawiki:/var/www/html'
- 'parsoid:/usr/lib/parsoid'
depends_on:
- mariadb
networks:
- proxy
- internal
deploy:
update_config:
failure_action: rollback
labels:
- "traefik.enable=true"
- "traefik.http.services.mediawiki.loadbalancer.server.port=80"
- "traefik.http.routers.mediawiki.rule=Host(`${DOMAIN}`)"
- "traefik.http.routers.mediawiki.entrypoints=web-secure"
- "traefik.http.routers.mediawiki.tls.certresolver=${LETS_ENCRYPT_ENV}"
volumes:
mariadb:
mediawiki:
parsoid:
networks:
proxy:
external: true
internal:
secrets:
db_root_password:
name: ${STACK_NAME}_db_root_passwd_${DB_ROOT_PASSWD_VERSION}
external: true
db_password:
name: ${STACK_NAME}_db_passwd_${DB_PASSWD_VERSION}
external: true

6
helpers.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
create-secrets () {
pwgen -n 32 1 | docker secret create "${STACK_NAME}_db_root_passwd_${DB_ROOT_PASSWD_VERSION}" -
pwgen -n 32 1 | docker secret create "${STACK_NAME}_db_passwd_${DB_PASSWD_VERSION}" -
}