-
Notifications
You must be signed in to change notification settings - Fork 9
/
run.sh
executable file
·105 lines (83 loc) · 2.96 KB
/
run.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
97
98
99
100
101
102
103
104
105
#!/bin/bash
# needed variables:
# POSTFIX_DOMAIN
# POSTFIX_MAILNAME
# POSTFIX_DESTINATION
# AEGIR_SITE
# AEGIR_EMAIL
# AEGIR_DB_PASSWORD
# AEGIR_VERSION
#
echo "Install mysql:"
#!/bin/bash
MYSQL="/usr/bin/mysqld_safe"
MYSQL_ADMIN="/usr/bin/mysqladmin"
INITDB="/usr/bin/mysql_install_db"
chown -R mysql:mysql /var/log/mysql
# test if DATADIR is existent
if [ ! -d $DATADIR ]; then
echo "Creating MariaDB data at $DATADIR"
mkdir -p $DATADIR
fi
# test if DATADIR has content
if [ ! "$(ls -A $DATADIR)" ]; then
echo "Initializing MariaDB Database at $DATADIR"
chown -R mysql $DATADIR
$INITDB
echo "starting MariaDB server..."
/usr/bin/mysqld_safe &
MYSQL_PID=$!
sleep 6
# Finally, grant access to off-container connections
GRANT="GRANT ALL PRIVILEGES ON *.* to root@'%' IDENTIFIED BY '${MYSQL_ROOT_PW}' WITH GRANT OPTION;\
UPDATE user SET Password=PASSWORD('$MYSQL_ROOT_PW') WHERE User='root';\
FLUSH PRIVILEGES;"
echo "$GRANT" | mysql -u root mysql
echo "server running."
else
echo "starting MariaDB server..."
/usr/bin/mysqld_safe &
MYSQL_PID=$!
sleep 6
fi
chmod +x /solr_install.sh
/solr_install.sh
echo "init aegir"
if [ -e "/root/installed" ] ; then
echo "Host already installed"
else
GRANT="GRANT ALL PRIVILEGES ON *.* TO 'aegir_root'@'%' IDENTIFIED BY '${AEGIR_DB_PASSWORD}' WITH GRANT OPTION;\
FLUSH PRIVILEGES;"
echo "$GRANT" | mysql -u root -h localhost -p$MYSQL_ROOT_PW
debconf-set-selections /tmp/dpkg_selection.conf
# set installation parameters to prevent the installation script from asking
echo "postfix postfix/relayhost string $POSTFIX_DOMAIN" | debconf-set-selections
echo "postfix postfix/mailname string $POSTFIX_MAILNAME" | debconf-set-selections
echo "postfix postfix/destinations string $POSTFIX_DESTINATION, localhost.localdomain, localhost" | debconf-set-selections
apt-get -y install postfix
adduser --system --group --home /var/aegir aegir
adduser aegir www-data #make aegir a user of group www-data
chown -R www-data:www-data /var/log/apache2
chown -R aegir:www-data /var/aegir
phpmemory_limit=256M #or what ever you want it set to
sed -i 's/memory_limit = .*/memory_limit = '${phpmemory_limit}'/' /etc/php5/apache2/php.ini
a2enmod rewrite
ln -s /var/aegir/config/apache.conf /etc/apache2/conf.d/aegir.conf
echo -e "Defaults:aegir !requiretty\naegir ALL=NOPASSWD: /usr/sbin/apache2ctl" >> /etc/sudoers.d/aegir
chmod 0440 /etc/sudoers.d/aegir
ln -s /var/aegir/drush/drush /usr/local/bin/drush
su -s /bin/sh aegir -c "sh /aegir_install.sh"
touch /root/installed
apache2ctl stop
mkdir /var/aegir/drush
ln -s /usr/bin/drush /var/aegir/drush/drush
cp /var/aegir/hosting_queued.conf /etc/supervisor/conf.d/
chown aegir:aegir /var/aegir/hosting_queued.sh
chmod 700 /var/aegir/hosting_queued.sh
fi
mysqladmin -p$MYSQL_ROOT_PW shutdown
#DPKG_DEBUG=developer apt-get -y install aegir2
echo "Starting supervisor:"
supervisord -c /opt/supervisor.conf -n
/etc/init.d/postfix restart
service syslog-ng start