summarylogtreecommitdiffstats
path: root/aegir.install
blob: bcc1da516ea620e1e13640155a2c556d7cfc2c74 (plain)
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
post_install() {
    post_upgrade

    echo ">>> 1. Ensure this machine's hostname is a FQDN that resolves one of its IP addresses:"
    echo "         $ ip addr | grep inet | sed --regexp-extended 's/ *inet6? ([^\\/]*).*/\1/' | \\"
    echo "             grep --quiet $(resolveip $(hostname) | cut --fields=6 --delimiter=' ') && echo Success!"
    echo ">>> 2. Ensure the http user and group exist (i.e. uid=gid=33):"
    echo "         $ test \$(id --user http) -eq 33 -a \$(id --group http) -eq 33 && echo Success!"
    echo ">>> 3. Ensure PHP can successfully send outgoing emails (the supplied msmtprc template works for Google accounts):"
    echo "         $ php -r 'mail(\"example@example.com\", \"Test email from PHP\", \"Test email body.\");'"
    echo ">>> 4. Setup the MySQL instance (by running mysql_secure_installation, or the following shell commands):"
    echo "         # systemctl start mysqld"
    echo "         $ mysql --user=root --execute=\""
    echo "             DELETE FROM mysql.user WHERE User='';"
    echo "             DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
    echo "             DROP DATABASE IF EXISTS test;"
    echo "             DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';"
    echo "             FLUSH PRIVILEGES;\""
    echo ">>> 5. (opt) Create a aegir MySQL user:"
    echo "          $ mysql --user=root \\"
    echo "              --execute=\"GRANT ALL PRIVILEGES ON *.* TO 'aegir'@'%' IDENTIFIED BY 'passwd' WITH GRANT OPTION;\""
    echo ">>> 6. Install hostmaster as the aegir user through its drush provision command:"
    echo "         # su aegir -c \\"
    echo "             \"drush hostmaster-install --yes --web_group=http --http_service_type=nginx \\"
    echo "                --root=/var/lib/aegir/hostmaster --aegir_db_user=aegir --aegir_db_pass=passwd \\"
    echo "                --aegir_host=\$(hostname) --client_email=aegir@\$(hostname) \$(hostname)\""
    echo ">>> 7. Connect nginx to the Unix socket used by php-fpm:"
    echo "         # su aegir -c \"sed -i 's/127.0.0.1:9000/unix:\\/run\\/php-fpm\\/php-fpm.sock/' /var/lib/aegir/config/includes/nginx_vhost_common.conf\""
    echo ">>> 8. Start the entire web stack:"
    echo "         # systemctl start mysqld nginx php-fpm"
    echo ">>> 9. (opt) Enable and start the hosting queue daemon:"
    echo "         # su aegir -c \"drush @hostmaster pm-enable hosting_queued\" && systemctl start aegir"
}

post_upgrade() {
    [ getent passwd aegir &>/dev/null ] || useradd --uid 696  --gid http --home-dir /var/lib/aegir aegir
    chmod 755 /var/lib/aegir
    pwconv
}