-
Notifications
You must be signed in to change notification settings - Fork 102
/
bootstrap.sh
96 lines (75 loc) · 3.07 KB
/
bootstrap.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
#!/usr/bin/env bash
apt update
# Defaults for MySQL and phpMyAdmin:
debconf-set-selections <<< 'mysql-server mysql-server/root_password password password'
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password password'
echo 'phpmyadmin phpmyadmin/dbconfig-install boolean true' | debconf-set-selections
echo 'phpmyadmin phpmyadmin/app-password-confirm password password' | debconf-set-selections
echo 'phpmyadmin phpmyadmin/mysql/admin-pass password password' | debconf-set-selections
echo 'phpmyadmin phpmyadmin/mysql/app-pass password password' | debconf-set-selections
echo 'phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2' | debconf-set-selections
apt full-upgrade -y
apt install -y apache2 php7.0 php7.0-intl php7.0-mysql php-rrd php7.0-cgi php7.0-cli php7.0-curl php7.0-mcrypt \
php-memcached libapache2-mod-php7.0 mysql-server mysql-client php-mysql joe memcached \
php7.0-mbstring php7.0-xml phpmyadmin php-gettext screen joe php-memcache
if ! [ -L /var/www ]; then
rm -rf /var/www
ln -fs /vagrant/public /var/www
fi
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
export MYSQL_PWD=password
mysql -u root <<END_SQL
DROP DATABASE IF EXISTS \`vimbadmin\`;
CREATE DATABASE \`vimbadmin\` CHARACTER SET = 'utf8mb4' COLLATE = 'utf8mb4_unicode_ci';
GRANT ALL ON \`vimbadmin\`.* TO \`vimbadmin\`@\`127.0.0.1\` IDENTIFIED BY 'password';
GRANT ALL ON \`vimbadmin\`.* TO \`vimbadmin\`@\`localhost\` IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
END_SQL
if [[ -f /vagrant/vimbadmin-preferred.sql.bz2 ]]; then
bzcat /vagrant/vimbadmin-preferred.sql.bz2 | mysql -u root vimbadmin
elif [[ -f /vagrant/data/vagrant-base.sql ]]; then
cat /vagrant/data/vagrant-base.sql | mysql -u root vimbadmin
fi
cat >/vagrant/public/.htaccess <<END_HTACCESS
SetEnv APPLICATION_ENV vagrant
END_HTACCESS
cd /vagrant
su - vagrant -c "cd /vagrant && composer install"
cat >/etc/apache2/sites-available/000-default.conf <<END_APACHE
<VirtualHost *:80>
DocumentRoot /vagrant/public
<Directory /vagrant/public>
Options FollowSymLinks
AllowOverride None
Require all granted
SetEnv APPLICATION_ENV vagrant
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]
</Directory>
ErrorLog \${APACHE_LOG_DIR}/error.log
CustomLog \${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
END_APACHE
cp /vagrant/application/configs/application.ini.vagrant /vagrant/application/configs/application.ini
a2enmod rewrite
chmod -R a+rwX /vagrant/var
service apache2 restart
# Useful screen settings for barryo:
cat >/home/vagrant/.screenrc <<END_SCREEN
termcapinfo xterm* ti@:te@
vbell off
startup_message off
defutf8 on
defscrollback 2048
nonblock on
hardstatus on
hardstatus alwayslastline
hardstatus string '%{= kG}%-Lw%{= kW}%50> %n%f* %t%{= kG}%+Lw%<'
screen -t bash 0
altscreen on
END_SCREEN
cd /vagrant