Skip to content

Commit 97994e8

Browse files
authored
[Feature] Refactored container startup process (BREAKING CHANGE) (alexjustesen#1445)
1 parent b77c840 commit 97994e8

File tree

5 files changed

+14
-77
lines changed

5 files changed

+14
-77
lines changed

.env.production

Lines changed: 0 additions & 23 deletions
This file was deleted.

config/app.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
'force_https' => env('FORCE_HTTPS', false),
1212

1313
'aliases' => Facade::defaultAliases()->merge([
14-
// 'ExampleClass' => App\Example\ExampleClass::class,
1514
'TimeZoneHelper' => App\Helpers\TimeZoneHelper::class,
1615
])->toArray(),
1716

config/services.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
return [
44

55
'telegram-bot-api' => [
6-
'token' => env('TELEGRAM_BOT_TOKEN', 'YOUR BOT TOKEN HERE'),
6+
'token' => env('TELEGRAM_BOT_TOKEN'),
77
],
88

99
];

config/speedtest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,25 @@
33
use Carbon\Carbon;
44

55
return [
6-
/**
7-
* Build information
8-
*/
6+
97
'build_date' => Carbon::parse('2024-04-16'),
108

119
'build_version' => 'v0.19.0',
1210

1311
/**
14-
* General
12+
* General settings.
1513
*/
1614
'content_width' => env('CONTENT_WIDTH', '7xl'),
1715

1816
'public_dashboard' => env('PUBLIC_DASHBOARD', false),
1917

2018
/**
21-
* Polling
19+
* Polling settings.
2220
*/
2321
'dashboard_polling' => env('DASHBOARD_POLLING', '60s'),
2422

2523
'notification_polling' => env('NOTIFICATION_POLLING', '60s'),
2624

2725
'results_polling' => env('RESULTS_POLLING', null),
26+
2827
];

docker/deploy/etc/s6-overlay/scripts/laravel-automations

Lines changed: 9 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ chmod -R 755 /config
1313
chown -R webuser:webgroup /config
1414
chmod -R 755 $WEBUSER_HOME/storage
1515
chown -R webuser:webgroup $WEBUSER_HOME/storage
16-
echo "✅ Permissions fixed."
16+
echo "✅ Done."
1717
echo ""
1818

1919
if [ ${DB_CONNECTION:="sqlite"} = "sqlite" ]; then
@@ -33,69 +33,31 @@ if [ ${DB_CONNECTION:="sqlite"} = "sqlite" ]; then
3333
fi
3434
done
3535

36-
echo "✅ Database symlink created."
36+
echo "✅ Done."
3737
echo ""
3838
fi
3939

40-
# Check for env file
41-
if [ ! -f /config/.env ]; then
42-
echo "🙄 Environment file not found, creating..."
43-
s6-setuidgid webuser cp $WEBUSER_HOME/.env.production /config/.env
44-
echo "✅ Environment file created."
45-
else
46-
echo "✅ Environment file exists."
47-
fi
48-
49-
echo ""
50-
51-
# create symlinks
52-
echo "🔗 Creating symlinks for config and log files..."
53-
symlinks=( \
54-
/var/www/html/.env \
55-
)
56-
57-
for i in "${symlinks[@]}"
58-
do
59-
if [[ -e "$i" && ! -L "$i" ]]; then
60-
rm -rf "$i"
61-
fi
62-
if [[ ! -L "$i" ]]; then
63-
ln -s /config/"$(basename "$i")" "$i"
64-
fi
65-
done
66-
67-
echo "✅ Symlinks created."
68-
echo ""
69-
7040
# Check for app key
7141
if [ ! ${APP_KEY} ]; then
72-
if grep -E "APP_KEY=[0-9A-Za-z:+\/=]{1,}" $WEBUSER_HOME/.env > /dev/null; then
73-
echo "✅ An application key exists."
74-
else
75-
echo "⏳ Generating an application key..."
76-
export APP_KEY=$(s6-setuidgid webuser php $WEBUSER_HOME/artisan key:generate --show)
77-
echo "⚠️ An application key was generated at start up, no environment variable was set."
78-
echo "👀 To set an application key that persists, read the docs: https://docs.speedtest-tracker.dev/"
79-
fi
80-
else
81-
echo "✅ An application key environment variable exists."
42+
echo "⚠️ An application key is missing!"
43+
echo "👀 To set an application key, read the docs: https://docs.speedtest-tracker.dev/"
8244
fi
8345

8446
echo ""
8547

8648
# Refresh cache
87-
echo "💰 Building the cache..."
88-
s6-setuidgid webuser php $WEBUSER_HOME/artisan view:clear --no-ansi -q
49+
echo "💰 Refreshing the cache..."
50+
s6-setuidgid webuser php $WEBUSER_HOME/artisan filament:cache-components --no-ansi -q
8951
s6-setuidgid webuser php $WEBUSER_HOME/artisan optimize --no-ansi -q
90-
echo "✅ Cache set."
52+
echo "✅ Done."
9153
echo ""
9254

9355
# Migrate database
9456
echo "🚛 Migrating the database..."
9557
s6-setuidgid webuser php $WEBUSER_HOME/artisan migrate --force --no-ansi -q
96-
echo "✅ Database migrated."
58+
echo "✅ Done."
9759
echo ""
9860

9961
# App install done, show a message
100-
echo "✅ All set, Speedtest Tracker started."
62+
echo "✅ All set, Speedtest Tracker has started!"
10163
echo ""

0 commit comments

Comments
 (0)