forked from londonhackspace/hackspace-foundation-sites
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
39 lines (30 loc) · 1.5 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
#!/usr/bin/env bash
export DEBIAN_FRONTEND=noninteractive
# Install required packages
apt-get update
apt-get install -y php5 php5-curl php-apc git postgresql-9.4 php5-pgsql
apt-get install -y ruby-erubis ruby-pg ruby-hpricot ruby-mail
su postgres -c 'createuser -s vagrant'
su postgres -c 'createuser hackspace'
su postgres -c 'createdb -O hackspace hackspace'
cat > /etc/postgresql/9.4/main/pg_hba.conf <<EOF
local hackspace hackspace trust
host hackspace hackspace 127.0.0.1/32 trust
host hackspace hackspace ::1/128 trust
local all vagrant trust
local all postgres peer
local all all peer
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
EOF
service postgresql reload
psql -U hackspace hackspace < /var/www/hackspace-foundation-sites/etc/schema.sql
# Configure php
sed -i~ "s/short_open_tag = Off/short_open_tag = On/g" /etc/php5/apache2/php.ini
sed -i~ "s/display_errors = Off/display_errors = On/g" /etc/php5/apache2/php.ini
sed -i~ "s/display_startup_errors = Off/display_startup_errors = On/g" /etc/php5/apache2/php.ini
# Configure apache
a2enmod rewrite
a2enmod expires
cp /var/www/hackspace-foundation-sites/apache-config-drop-in /etc/apache2/sites-available/000-default.conf
service apache2 restart