-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·59 lines (45 loc) · 1.44 KB
/
entrypoint.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
#!/bin/bash
# Check if Invoice Ninja is already setup
if [ ! -f "/var/www/artisan" ]; then
echo "Invoice Ninja is not setup. Doing it now."
# Unzip and set Invoice Ninja permissions
#unzip /app/invoice-ninja-5-1-14.zip -d /var/www/
unzip /app/invoice-ninja-4.5.34.zip -d /var/www/
# Tidy up folders - zip folder diff betweeb 4.5 and 5.1
if [ -d "/var/www/ninja/" ]; then
mv /var/www/ninja/* /var/www/
rm -rf /var/www/ninja/
fi
# Set permissions
chown www-data:www-data /var/www/ -R
chmod 755 /var/www/storage/ -R
fi
echo "Invoice Ninja is setup and ready to go!"
# Add Invoice Ninja Virtual Host
echo "<VirtualHost *:80>
DocumentRoot /var/www/public
<Directory /var/www/public>
DirectoryIndex index.php
Options +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/invoice-ninja.error.log
CustomLog /var/log/invoice-ninja.access.log combined
</VirtualHost>" >> /etc/apache2/sites-available/invoice-ninja.conf
# Send logs to stdout/stderr
ln -sf /dev/stdout /var/log/invoice-ninja.access.log
ln -sf /dev/stderr /var/log/invoice-ninja.error.log
# Adjust Apache config and restart
a2dissite 000-default.conf
a2ensite invoice-ninja.conf
a2enmod rewrite
# Reload apache
service apache2 reload
echo "Apache is ready to go!"
# Tidy up folders
if [ -d "/var/www/html/" ]; then
rm -rf /var/www/html/
fi
# Ready to go!
apache2-foreground