-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathinstall.sh
88 lines (71 loc) · 2.42 KB
/
install.sh
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
DEVELOPMENT=false
INITIAL_DOCKER_INSTALL=false
for ARG in "$@"; do
shift
if [[ "$ARG" == "--dev" ]]; then
DEVELOPMENT=true
fi
if [[ "$ARG" == "--initial-docker-install" ]]; then
INITIAL_DOCKER_INSTALL=true
fi
done
echo "=================================================================================";
if $DEVELOPMENT; then
echo "Beginning development CDash installation..."
else
echo "Beginning production CDash installation..."
fi
error_handler() {
echo "
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* INSTALLATION FAILURE! *
* *
* An error occurred while installing CDash and CDash was not able to recover *
* automatically. If you believe that this is a problem with CDash, please *
* report the error here: *
* *
* -> https://github.com/Kitware/CDash/issues/new *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
"
exit 1
}
trap error_handler ERR
# Temporarily change to the root of the CDash source tree.
SCRIPT_DIR=$(dirname "$0")
pushd "$SCRIPT_DIR" > /dev/null
# This has to happen before we enable maintenance mode because maintenance mode expects these directories to exist.
echo "Creating storage directories..."
php artisan storage:mkdirs
echo "Enabling maintenance mode..."
php artisan down --render="maintenance" --refresh=5
if $INITIAL_DOCKER_INSTALL; then
echo "Skipping vendor installation..."
else
echo "Updating vendor dependencies..."
if $DEVELOPMENT; then
npm install
composer install
else
npm install --omit=dev
composer install --no-dev --optimize-autoloader
fi
fi
echo "Waiting for database to come online..."
until php artisan db:monitor ; do sleep 1; done
echo "Running migrations..."
php artisan migrate --force
echo "Clearing caches..."
php artisan view:cache
php artisan lighthouse:cache
if $INITIAL_DOCKER_INSTALL; then
echo "Skipping website build..."
else
echo "Building the website..."
npm run prod --stats-children
fi
echo "Bringing CDash back online..."
php artisan up
popd > /dev/null
echo "done."