-
Notifications
You must be signed in to change notification settings - Fork 36
/
create
executable file
·61 lines (48 loc) · 1.88 KB
/
create
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
53
54
55
56
57
58
59
60
61
#!/bin/sh
set -eu
cd $(dirname $0)
# Create a combined .env file
touch .env
rm .env
cat default.env >> .env
# Ensure there is a trailing new line before appending the next chunk
# Avoid `sed -i -e '$a\'` because of compat with BSD sed (macOS).
# `sed -i '' -e '$a\'` could work there, but that doesn't work on GNU sed.
# Just use echo instead. We always re-create the target, so appending
# unconditionally won't cause indefinite growth.
# https://github.com/addshore/mediawiki-docker-dev/issues/18
echo >> .env
touch local.env
cat local.env >> .env
echo >> .env
# Pull latest version of specified containers
echo "Pulling latest containers"
docker-compose pull
# Start Containers
echo "Containers are starting"
docker-compose up -d
# Change owners
docker-compose exec "web" chown application:application //var/www/mediawiki
docker-compose exec "web" chown application:application //var/www/mediawiki/LocalSettings.php
# Add document root index file (NOTE: docker-compose lacks a "cp" command)
docker cp config/mediawiki/index.php "$(docker-compose ps -q web)"://var/www/index.php
docker-compose exec "web" chown application:application //var/www/index.php
echo "Waiting for the db servers to finish starting"
echo "Sometimes this can take some time..."
docker-compose exec "web" //srv/wait-for-it.sh db-master:3306
docker-compose exec "web" //srv/wait-for-it.sh db-slave:3306
# Reset local hosts file
touch .hosts
rm .hosts
./hosts-add proxy.mw.localhost
./hosts-add phpmyadmin.mw.localhost
./hosts-add graphite.mw.localhost
echo "Setting up log directory"
docker-compose exec "web" mkdir -p //var/log/mediawiki
docker-compose exec "web" chown application:application //var/log/mediawiki
echo "Setting up images directory"
docker-compose exec "web" chown application:application //var/www/mediawiki/images/docker
# Add the default site
./addsite default
# Done
echo "Your development environment is running"