-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathlocalhost_deploy.sh
More file actions
executable file
·63 lines (46 loc) · 1.97 KB
/
localhost_deploy.sh
File metadata and controls
executable file
·63 lines (46 loc) · 1.97 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
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# localhost build of toolkit for devving.
## TODO:
#toolkit_dev_app | WARNINGS:
#toolkit_dev_app | wagtailcore.WorkflowState: (models.W036) MariaDB does not support unique constraints with conditions.
#toolkit_dev_app | HINT: A constraint won't be created. Silence this warning if you don't care about it.
## TODO:
# rsync -avz feeldsparror.cubecinema.com:/opt/stacks/toolkit-staging/data/docker-entrypoint-initdb.d/* ./var/docker-entrypoint-initdb.d
# rsync -avz feeldsparror.cubecinema.com:/opt/stacks/toolkit-staging/data/media/diary/* ./media/diary/
## TODO: an automated way of getting DB and media files
# Exit on any error
set -e
# vars
PASSCODE=monkey
GOOD_OPT=false
while ! $GOOD_OPT; do
read -p "To build a local version of the toolkit using your system's docker install, type in the following passcode (or \"exit\" or Ctrl+C to end without deploying).
$PASSCODE
" PASSCODE_ATTEMPT
case $PASSCODE_ATTEMPT in
"$PASSCODE" )
GOOD_OPT=true
;;
exit)
echo 'Laters.'
exit
;;
esac
if ! $GOOD_OPT; then
echo "That didn't *exactly* match \"$PASSCODE\" or \"exit\"."
fi
done
DEPLOY_ENV=dev
# create a symbolic link for settings.py. This shouldn't get checked in anywhere.
if [ -L ./toolkit/settings.py ]; then
rm ./toolkit/settings.py
fi
ln -s ./settings_"${DEPLOY_ENV}".py ./toolkit/settings.py
# pass in the $UID of the current user to re-use as internal uid, for bind mounts
docker build --build-arg ENV_NAME="$DEPLOY_ENV" --build-arg TOOLKIT_UID="$UID" --tag toolkit:"$DEPLOY_ENV" .
## run django tests against the image
## ideally, this would be run on each repo *commit*, not when starting up dev tools. But that requires more of a ci/cd pipeline.
## TODO: make this a feature toggle so it can be switched off (or on) if preferred.
docker run -t --rm --entrypoint "/site/runtests_container.sh" toolkit:dev
# --detach
docker compose -f ./docker-compose-"$DEPLOY_ENV".yml up