forked from oitcode/samarium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app-install.sh
107 lines (85 loc) · 2.43 KB
/
app-install.sh
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
##
## app-install.sh
##
## Author: Application developer
##
## Bash script to setup this laravel application. All you have to do is run
## this bash script, and your application will be completely setup. It will perform
## below actions:
##
## 1. Check if php dependencies are installed. If not installed then install them.
## 2. Check if composer and npm are installed. If not installed then install them.
## 2. Create required database and grant access to the database.
## 3. Download and install composer dependencies.
## 4. Download and install npm dependencies.
## 5. Run migrations.
## 6. Generate application key.
##
## Thank you for trying out this application!
##
echo '================================================================================'
echo 'Welcome'
echo '================================================================================'
##
## Do the required tasks for setting up a typical laravel application
## (which our application is!).
##
clear
echo '-- Setting up database'
echo -n 'Database name: '
read dbName
echo ''
echo ''
echo -n 'Database username: '
read dbUserName
echo -n 'Database password: '
read -s dbPassword
echo 'Need to execute'
sudo mysql -e "CREATE DATABASE $dbName;"
sudo mysql -e "CREATE USER ${dbUserName}@localhost IDENTIFIED BY '${dbPassword}';"
sudo mysql -e "GRANT ALL PRIVILEGES ON $dbName.* TO $dbUserName@localhost;"
clear
echo '-- Press any key to continue ...'
read z
clear
echo '-- Creating env file'
cp env.example .env
sed -i "s/DB_DATABASE=/DB_DATABASE=$dbName/" .env
sed -i "s/DB_USERNAME=/DB_USERNAME=$dbUserName/" .env
sed -i "s/DB_PASSWORD=/DB_PASSWORD=$dbPassword/" .env
clear
echo '-- Press any key to continue ...'
read z
clear
echo '-- Install composer dependencies'
composer install
clear
echo '-- Press any key to continue ...'
read z
clear
echo '-- Install npm dependencies'
npm install
npm run dev
clear
echo '-- Press any key to continue ...'
read z
clear
echo '-- Running migrations'
php artisan migrate
clear
echo '-- Press any key to continue ...'
read z
clear
echo '-- Generating application key'
php artisan key:generate
clear
echo '-- Creating storage links'
php artisan storage:link
clear
echo '-- Press any key to continue ...'
read z
clear
echo '================================================================================'
echo 'App install completed'
echo '================================================================================'