-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy.example.sh
69 lines (51 loc) · 1.2 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
#!/bin/bash
# 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=/auth/api/me
AUTH_LOGOUT=/auth/logout
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
# Kill process on port 9092 if it exists
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
# Serve sockets
cd /home/code/asciit
php artisan sockets:serve &