-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy.example.sh
87 lines (64 loc) · 1.58 KB
/
deploy.example.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
#!/bin/bash
# Bounce pm2 :)
pm2 reload all
# Clone repo
git clone -b master --single-branch https://github.com/m1x0n/asciit.git
# Install dependencies
composer install --no-interaction --prefer-dist --optimize-autoloader
# Create config
cat > .env << EOL
APP_ENV=local
APP_DEBUG=true
APP_KEY=SomeRandomString
DB_HOST=localhost
DB_DATABASE=asciit
DB_USERNAME=username
DB_PASSWORD=password
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
WEBSOCKET_PORT=9092
SERVER_PREFIX=asciit
JWT_SECRET=superpupersecret
AUTH_REDIRECT=/auth
AUTH_ME=/profile/user/getByCentralId
AUTH_LOGOUT=/auth/logout
NOTIFICATIONS=/app/api/notification
JS_PATH=asciit/js/min
JS_IS_MIN=true
USE_COMMON_HEADER=true
LINK_PREVIEW_SCREENSHOT=phantomjs /path/to/rasterize/rasterize.js %url %file 1024px*1024px
SERVER_HOST=http://example.com
EOL
#Generate app key
php artisan key:generate
#Migrate database
php artisan migrate:refresh --seed
# Run tests
phpunit
# Copy to destination folders
cp -rf ./ /home/code/asciit
chmod -R 777 /home/code/asciit/storage
chmod -R 777 /home/code/asciit/bootstrap/cache
# Serve websockets
KILLABLE=`lsof -i tcp:9092 | tail -n 1 | awk '{print $2}'`
if [ -n "$KILLABLE" ]; then
kill -9 $KILLABLE
else
echo "PORT 9092 is already free"
fi
KILLABLEZ=`lsof -i tcp:9091 | tail -n 1 | awk '{print $2}'`
if [ -n "$KILLABLEZ" ]; then
kill -9 $KILLABLEZ
else
echo "PORT 9091 is already free"
fi
# Serve sockets
cd /home/code/asciit
php artisan sockets:serve &