mirror of
https://github.com/YunoHost-Apps/openproject_ynh.git
synced 2024-09-03 19:56:10 +02:00
95 lines
2.9 KiB
Bash
Executable file
95 lines
2.9 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
#=================================================
|
|
|
|
# Installer variables
|
|
_homedir="/var/$app/"
|
|
ynh_app_setting_set --app=$app --key=_homedir --value=$_homedir
|
|
|
|
#=================================================
|
|
# NGINX CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring NGINX web server..."
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
#=================================================
|
|
# SPECIFIC SETUP
|
|
#=================================================
|
|
# OPENPROJECT CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring OpenProject..."
|
|
|
|
mkdir -p "/etc/openproject/"
|
|
_openproject_install_dat="/etc/openproject/installer.dat"
|
|
|
|
#TODO Not sure about this email sending. To be tested.
|
|
cat >> "$_openproject_install_dat"<< EOF
|
|
postgres/autoinstall reuse
|
|
postgres/db_host 127.0.0.1
|
|
postgres/db_port 5432
|
|
postgres/db_username $db_user
|
|
postgres/db_password $db_pwd
|
|
postgres/db_name $db_name
|
|
server/autoinstall skip
|
|
server/hostname $domain
|
|
server/protocol HTTPS
|
|
smtp/autoinstall smtp
|
|
smtp/authentication none
|
|
smtp/host 127.0.0.1
|
|
smtp/port 25
|
|
smtp/domain $domain
|
|
smtp/admin_email admin@$domain
|
|
memcached/autoinstall install
|
|
|
|
server/hostname $domain
|
|
server/ssl no
|
|
EOF
|
|
|
|
ynh_store_file_checksum --file="$_openproject_install_dat"
|
|
|
|
chmod 750 "/etc/openproject/"
|
|
chmod -R o-rwx "/etc/openproject/"
|
|
chown -R $app:$app "/etc/openproject/"
|
|
|
|
ynh_exec_warn_less openproject config:set PORT=$port
|
|
ynh_exec_warn_less openproject config:set SERVER_PROTOCOL_FORCE_HTTPS="true"
|
|
ynh_exec_warn_less openproject config:set SERVER_HOSTNAME=$domain
|
|
ynh_exec_warn_less openproject config:set SERVER_PATH_PREFIX=$path
|
|
|
|
ynh_exec_warn_less openproject configure >> "$YNH_STDINFO"
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
# INTEGRATE SERVICE IN YUNOHOST
|
|
#=================================================
|
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
|
|
|
yunohost service add $app --description="Web-based project management software" --log="systemd"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..."
|
|
|
|
# Start a systemd service
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed"
|