summarylogtreecommitdiffstats
path: root/discourse.install
blob: db3e54d6e0c2c60762d515ad8f525202b357c95a (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
_homedir="/var/lib/discourse"
_datadir="/usr/share/webapps/discourse"

fix_perms() {
    chown -R discourse:discourse "${_homedir}"
}

post_install() {
    groupadd discourse &>/dev/null
    useradd -d "${_homedir}" -g discourse -s /bin/bash discourse &>/dev/null
    systemd-tmpfiles --create discourse.conf
    fix_perms
    echo "You have to configure few things."
    echo "Configure the application in /etc/webapps/discourse/discourse.config and run:"
    echo "sudo -u discourse -s /usr/bin/bash -c \"cd ${_datadir}; bundle exec rake discourse:setup RAILS_ENV=production\""
}

post_upgrade() {
    systemd-tmpfiles --create discourse.conf
    fix_perms
    echo "The database may need to be migrated to reflect the latest changes in the application"
    echo "Running 'systemctl start discourse-update.service'; it may take a few minutes."
    systemctl start discourse-update.service
}