This repository has been archived by the owner on May 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathstartup.sh
70 lines (49 loc) · 1.9 KB
/
startup.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
#!/bin/sh
set -e
# Ensure the latest sources from this container lives in the volume.
# Working dir is /var/www/seat from the container.
find . -maxdepth 1 ! -name . -exec rm -r {} \; && \
tar cf - --one-file-system -C /usr/src/seat . | tar xf -
# Wait for the database
while ! mysqladmin ping --host=${DB_HOST} --port=${DB_PORT} --user=${DB_USERNAME} --password=${DB_PASSWORD} --silent; do
echo "MariaDB container might not be ready yet... sleeping..."
sleep 10
done
# Startup routines
echo "Starting first-run routines..."
# Create an .env if needed
php -r "file_exists('.env') || copy('.env.example', '.env');"
# Run any migrations
php artisan migrate
# Update the SDE
php artisan eve:update:sde -n
# Run the schedule seeder
php artisan db:seed --class=Seat\\Services\\database\\seeds\\ScheduleSeeder
echo "Completed first run routines..."
# Plugin support. The docker-compose.yml has the option
# for setting SEAT_PLUGINS environment variable. Read
# that here and split by commas.
echo "Installing and updating plugins..."
plugins=`echo -n ${SEAT_PLUGINS} | sed 's/,/ /g'`
# If we have any plugins to process, do that.
if [ ! "$plugins" == "" ]; then
echo "Installing plugins: ${SEAT_PLUGINS}"
# Why are we doing it like this?
# ref: https://github.com/composer/composer/issues/1874
# Require the plugins from the environment variable.
composer require ${plugins} --no-update
# Update the plugins.
composer update ${plugins} --no-scripts --no-dev --no-ansi --no-progress
# Publish assets and migrations and run them.
php artisan vendor:publish --force --all
php artisan migrate
fi
echo "Completed plugins processing"
echo "Performing permissions fixups"
chown -R www-data:www-data .
find . -type d -print0 | xargs -0 chmod 775
find . -type f -print0 | xargs -0 chmod 664
echo "Dumping the autoloader"
composer dump-autoload
echo "Done. Starting php-fpm"
php-fpm -F