-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
42 lines (35 loc) · 886 Bytes
/
Copy pathstart.sh
File metadata and controls
42 lines (35 loc) · 886 Bytes
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
#!/bin/bash
# Wait for MySQL to be ready
until nc -z -v -w30 mysql 3306
do
echo "Waiting for MySQL to be ready..."
sleep 5
done
# Wait for Redis to be ready
until nc -z -v -w30 redis 6379
do
echo "Waiting for Redis to be ready..."
sleep 5
done
# Copy .env file if not exists
if [ ! -f .env ]; then
cp .env.example .env
fi
# Generate application key if not set
if ! grep -q "^APP_KEY=" .env || grep -q "^APP_KEY=$" .env; then
php artisan key:generate
fi
# Run database migrations
php artisan migrate --force
# Create admin user if not exists
php artisan tinker --execute="
if (!\App\Models\User::where('email', 'admin@example.com')->exists()) {
\App\Models\User::create([
'name' => 'Admin',
'email' => 'admin@example.com',
'password' => bcrypt('password')
]);
}
"
# Start the application
php artisan serve --host=0.0.0.0 --port=8000