_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 }