-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-changes.sh
More file actions
executable file
·54 lines (45 loc) · 1.6 KB
/
Copy pathdeploy-changes.sh
File metadata and controls
executable file
·54 lines (45 loc) · 1.6 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
#!/bin/bash
# Script to deploy all changes, clear caches and restart Apache
# Run with sudo to ensure Apache can be restarted
# Example: sudo ./deploy-changes.sh
echo "===== Pulling latest changes from Git ====="
git pull origin main
echo "===== Clearing Laravel caches ====="
# Laravel cache clearing
php artisan cache:clear
php artisan view:clear
php artisan route:clear
php artisan config:clear
php artisan event:clear
php artisan optimize:clear
echo "===== Restarting Apache ====="
# Restart Apache to apply .htaccess changes
if command -v systemctl &> /dev/null; then
systemctl restart apache2 || service apache2 restart
else
service apache2 restart
fi
echo "===== Verifying database connection ====="
# Ensure the database is properly connected
php artisan db:monitor
echo "===== Creating admin user if needed ====="
# Run a small PHP script to ensure the admin user exists
php -r '
require __DIR__ . "/vendor/autoload.php";
$app = require_once __DIR__ . "/bootstrap/app.php";
$app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();
$user = \App\Models\User::firstOrCreate(
["username" => "admin"],
[
"name" => "Administrator",
"email" => "admin@example.com",
"password" => \Illuminate\Support\Facades\Hash::make("password"),
"workflow_preference" => "superuser"
]
);
echo "Admin user created or verified: " . $user->username . "\n";
'
echo "===== Deployment complete ====="
echo "The auto-login solution has been deployed."
echo "The application now bypasses login and uses an admin account automatically."
echo "Visit the site at: https://demo.zephyrus.care"