-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup
45 lines (44 loc) · 1.58 KB
/
setup
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
#!/usr/bin/env bash
# Copy .env
if [ ! -f .env ]; then
cp .env.example .env
fi
# Clear config cache
php artisan config:clear
# Clear route cache
php artisan route:clear
# Generate APP_KEY
php artisan key:generate --force
# Migrate Database
php artisan migrate:fresh
# Run php artisan passport:install command and store the output in a variable
output=$(php artisan passport:install --force)
# Extract Personal Access Client ID and Secret from the output
client_id=$(echo "$output" | awk '/Client ID:/{print $3; exit}')
client_secret=$(echo "$output" | awk '/Client secret:/{print $3; exit}')
# Delete the existing PERSONAL_ACCESS_CLIENT_ID and PERSONAL_ACCESS_CLIENT_SECRET environment variables in .env and .env.testing
sed -i "/^PASSPORT_PERSONAL_ACCESS_CLIENT_ID=/d" .env
sed -i "/^PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET=/d" .env
# Add the new PERSONAL_ACCESS_CLIENT_ID and PERSONAL_ACCESS_CLIENT_SECRET environment variables in .env and .env.testing
echo "PASSPORT_PERSONAL_ACCESS_CLIENT_ID=${client_id}" >> .env
echo "PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET=${client_secret}" >> .env
# Cache Config
php artisan config:cache
# Cache Routes
php artisan route:cache
# Seed Database
php artisan db:seed
# Install Telescope module
php artisan telescope:install
php artisan telescope:publish
# Link storage
php artisan storage:link
# Install scribe
php artisan scribe:generate --force
# If .env does not exists
if [ ! -f .env.testing ]; then
# Copy .env to .env.testing
cp .env.testing.example .env.testing
fi
# Start Supervisor Service
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf