-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
init_recovered_server.sh
90 lines (76 loc) · 2.52 KB
/
init_recovered_server.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
#!/usr/bin/env bash
# TODO?
# Add root SSH key
# Increase PHP memory limit
# Create databases?
# Create users & permissions?
# create directories
tput setaf 2;
echo "Creating directories..."
tput sgr0;
# cache for image library
mkdir storage/app/public/imagecache
mkdir storage/app/public/expansions
mkdir storage/debugbar
# ensure any uploaded file may be accessed directly (symlinks public/storage to storage/app/public)
tput setaf 2;
echo "Ensuring storage link..."
tput sgr0;
php artisan storage:link
# ensure www-data permissions
tput setaf 2;
echo "Setting www-data ownership to some folders..."
tput sgr0;
chown -R www-data:www-data storage/*
chown -R www-data:www-data bootstrap/cache
# ensure some other permissions
tput setaf 2;
echo "Ensuring file permissions..."
tput sgr0;
chmod 755 ./*.sh
chmod -R 755 storage
chmod -R 755 bootstrap/cache
# make sure setfacl is installed on the server
sudo apt-get install acl
# Give www-data user permission to write in this folder regardless of ownership. See https://stackoverflow.com/a/29882246/771270
setfacl -d -m g:www-data:rwx storage/logs
# Prior to performing any artisan commands, we need to update composer. Normally composer also calls artisan, but the
# --no-scripts tag prevents that from happening. After this, artisan will work normally. Otherwise you get this error:
# Fatal error: Uncaught Error: Class 'Illuminate\Foundation\Application' not found in /home/vagrant/Git/private/keystone.guru/bootstrap/app.php:14
tput setaf 2;
composer install --no-scripts
tput sgr0;
# Prevent not being able to compile because cross-env is missing
tput setaf 2;
echo "Installing cross-env globally..."
tput sgr0;
sudo npm install --global cross-env
# Install globally for echo server
tput setaf 2;
echo "Installing dotenv globally..."
tput sgr0;
sudo npm install --global dotenv
#make sure we have the correct versions for everything
tput setaf 2;
echo "Updating dependencies..."
tput sgr0;
./update_dependencies.sh
# This was somehow needed to get the image library to work
tput setaf 2;
echo "Publishing service providers..."
tput sgr0;
php artisan vendor:publish --provider="Folklore\Image\ImageServiceProvider"
php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"
php artisan vendor:publish --tag=language
# Generate encryption key
#tput setaf 2;
#echo "Setting up private encryption key..."
#tput sgr0;
#php artisan key:generate
# Run migrate again to fix the tracker
./migrate.sh
# Setup Horizon
php artisan horizon:install
php artisan horizon:publish
# Seeding database
./refresh_db_seed.sh