Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Commit

Permalink
Fix cron job path, improve logging & other tweaks
Browse files Browse the repository at this point in the history
- Fix the cron job path to use /srv.
- Install without prompt when explicitly passed 'install' command.
- Improve success / error detection in the logging code, and move help
  messages to the end.
  • Loading branch information
gwicke committed Dec 23, 2015
1 parent 8489845 commit eda07f9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 21 deletions.
5 changes: 1 addition & 4 deletions cron/mediawiki-containers
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/bin/sh

# Update the installation..
/usr/local/src/mediawiki-containers/install.sh

# And restart the containers..
service mediawiki-containers restart
/srv/mediawiki-containers/mediawiki-containers install
48 changes: 31 additions & 17 deletions mediawiki-containers
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

set -e

# Simple shell script to start up MediaWiki + containers.
# Alternative to docker-compose, with automatic docker subnet detection to make
# this work on jessie or sid.
# Containerized MediaWiki install & startup.

# Minimal installation on Debian 8.0 Jessie, Ubuntu 15.04+ or newer:
# curl https://raw.githubusercontent.com/wikimedia/mediawiki-containers/master/mediawiki-containers | sudo bash

BASEDIR=/srv/mediawiki-containers
DATADIR="$BASEDIR/data"
Expand Down Expand Up @@ -113,15 +114,17 @@ usage() {
}

install() {
while true; do
read -p "Proceed to install / update mediawiki-containers? (y/n): " \
yn </dev/tty
case $yn in
[Yy]* ) break;;
[Nn]* ) echo "Okay, aborting."; exit 1;;
* ) echo "Please answer 'y' or 'n'.";;
esac
done
if [ "$1" != 'install' ]; then
while true; do
read -p "Proceed to install / update mediawiki-containers? (y/n): " \
yn </dev/tty
case $yn in
[Yy]* ) break;;
[Nn]* ) echo "Okay, aborting."; exit 1;;
* ) echo "Please answer 'y' or 'n'.";;
esac
done
fi
# User answered 'y'; proceed to install.

# Make sure we have git.
Expand All @@ -139,15 +142,26 @@ install() {
service mediawiki-containers restart

echo
echo "Your wiki should soon be available at http://$MEDIAWIKI_DOMAIN/."
echo 'Following startup via `journalctl -f -u mediawiki-containers`.'
echo
journalctl -f -u mediawiki-containers | sed '/: Done in /q'
# Get the last line, too
lastline=$(journalctl -u mediawiki-containers | tail -1 | grep AH00558)
if [ -z "$lastline" ];then
echo "Apache startup apparently didn't finish properly."
echo "Output of journalctl -u mediawiki-containers:"
journalctl -u mediawiki-containers
else
echo $lastline
echo
echo "Congratulations! Your wiki should now be available at http://$MEDIAWIKI_DOMAIN/."
fi
echo
echo 'To follow the startup progress, run'
echo 'For detailed information / logs, try'
echo ' - `docker logs -f mediawiki` for MediaWiki,'
echo ' - `docker logs -f mysql` for MySQL,'
echo ' - `docker logs -f mediawiki-node-services` for services.'
echo
echo 'Following startup via `journalctl -f`.'
journalctl -f | sed '/: AH00558: apache2: /q'
}

if [ "$1" == "stop" ]; then
Expand All @@ -162,7 +176,7 @@ elif [ "$1" == "restart" ]; then
elif [ -z "$1" -o "$1" == "install" ]; then
echo "Welcome to MediaWiki-containers!"
echo
install
install "$1"
exit 0
else
echo "Invalid parameter $1"
Expand Down

0 comments on commit eda07f9

Please sign in to comment.