-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshellto
More file actions
executable file
·52 lines (50 loc) · 2.48 KB
/
Copy pathshellto
File metadata and controls
executable file
·52 lines (50 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
#
# Open a shell in the container with MediaWiki running.
# Skips installation (assumes ./fresh_install or ./install has been run first) and fails
# fast with a clear error when src/ has no MediaWiki checkout.
# MediaWiki will be available at http://127.0.0.1:9413
# Container logs (Apache, MySQL, MediaWiki debug logs) land in this run's log directory —
# the "logs:" line printed at startup names it.
#
# Usage: ./shellto
# ENVIRONMENT=0 ./shellto
#
set -euo pipefail # exit on error, undefined vars, or pipe failures
_QUIBBLE_OUTPUT_MANAGED=1 # interactive command: don't redirect output to log file
. "$(dirname "$0")"/lib/setup # source shared setup (docker checks, shared vars, output capture, trace into the log)
. "$(dirname "$0")"/lib/print_quibble_command # provides print_quibble_command function
# Fail fast when there is no MediaWiki checkout to serve: Quibble would otherwise start
# MySQL, attempt its wiki install, and die a minute later with a confusing Python
# traceback ("Could not open input file: maintenance/install.php"). That file is exactly
# what Quibble's install step runs, so its absence is the reliable "no MediaWiki here"
# marker. $QUIBBLE_SRC (set by lib/setup) honors ENVIRONMENT=N, so the message names the
# right directory (src, src_0, ...).
if [ ! -f "$QUIBBLE_SRC"/maintenance/install.php ]; then
echo "Error: $QUIBBLE_SRC/ has no MediaWiki install ($QUIBBLE_SRC/maintenance/install.php is missing). Run ./fresh_install first." >&2
exit 1
fi
# Build the docker command in an array so we can both print and execute it.
# -it: interactive terminal (so you can type commands in the shell)
# --rm: remove container on exit
# --entrypoint=quibble-with-supervisord: use Quibble's supervisord entrypoint
# -p 9413:9413: expose MediaWiki port from container to host
# "${QUIBBLE_VOLUMES[@]}": mount shared volumes (cache, log, ref, src)
# --skip-zuul: don't clone repos (already in src/)
# --skip-deps: don't install dependencies (already installed)
# --command bash: open a bash shell instead of running tests
cmd=(
docker run -it --rm
--entrypoint=quibble-with-supervisord
-p 9413:9413
"${QUIBBLE_VOLUMES[@]}"
"$QUIBBLE_IMAGE"
--skip-zuul
--skip-deps
--command bash
)
# Pretty-print the command (one option per line, framed by a '#' banner) so it stands
# out in busy logs. shellto is interactive (output not redirected to a log), so this
# appears on the terminal immediately before the container starts.
print_quibble_command "${cmd[@]}"
"${cmd[@]}"