forked from alexjustesen/speedtest-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
61 lines (50 loc) · 1.63 KB
/
entrypoint.sh
File metadata and controls
61 lines (50 loc) · 1.63 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
#!/usr/bin/env sh
if [ $# -gt 0 ];then
# If we passed a command, run it as root
exec "$@"
else
echo ""
echo ""
echo "🐇 Configuring Speedtest Tracker..."
if [ ${DB_CONNECTION:="sqlite"} == "sqlite" ]; then
# Check for database
if [ ! -f /app/database.sqlite ]; then
echo "🙄 Database file not found, creating..."
touch /app/database.sqlite
else
echo "✅ Database exists"
fi
fi
# Check for config yaml file
if [ ! -f /app/config.yml ]; then
echo "🙄 Config file not found, creating..."
cp /var/www/html/config.example.yml /app/config.yml
else
echo "✅ Config file exists"
fi
# Check for app key
if grep -E "APP_KEY=[0-9A-Za-z:+\/=]{1,}" /var/www/html/.env > /dev/null; then
echo "✅ App key exists"
else
echo "⏳ Generating app key..."
php /var/www/html/artisan key:generate --no-ansi -q
fi
# Link storage
echo "📦 Linking storage..."
php /var/www/html/artisan storage:link --no-ansi -q
# Build cache
echo "💰 Building the cache..."
php /var/www/html/artisan config:cache --no-ansi -q
php /var/www/html/artisan route:cache --no-ansi -q
# Migrate database
echo "🚛 Migrating the database..."
php /var/www/html/artisan migrate --force --no-ansi -q
# Fix permissions again, just in case
echo "🔑 Fixing permissions..."
chown -R webuser:webgroup /var/www/html
# App install done, show a message
echo "✅ All set, starting Speedtest Tracker container..."
echo ""
echo ""
exec /init
fi