1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/movim_ynh.git synced 2024-09-03 19:46:19 +02:00

simplify config

This commit is contained in:
ericgaspar 2021-02-21 09:46:03 +01:00
parent 95923dc8e1
commit 20a2d7163a
No known key found for this signature in database
GPG key ID: 574F281483054D44
7 changed files with 7 additions and 39 deletions

View file

@ -36,6 +36,7 @@ location __PATH__/ {
proxy_send_timeout 14400s; proxy_send_timeout 14400s;
# (14400s is 4h) # (14400s is 4h)
} }
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
} }

View file

@ -6,7 +6,7 @@ After=nginx.service network.target local-fs.target postgresql.service
Type=simple Type=simple
User=__APP__ User=__APP__
WorkingDirectory=__FINALPATH__ WorkingDirectory=__FINALPATH__
ExecStart=/usr/bin/php__PHP_VERSION__ daemon.php start --interface=127.0.0.1 --url=https://__DOMAIN____PATH__/ --port=__PORT__ ExecStart=/usr/bin/php__PHPVERSION__ daemon.php start --interface=127.0.0.1 --url=https://__DOMAIN____PATH__/ --port=__PORT__
StandardOutput=syslog StandardOutput=syslog
SyslogIdentifier=__APP__ SyslogIdentifier=__APP__
PIDFile=/run/movim.pid PIDFile=/run/movim.pid

View file

@ -9,7 +9,7 @@ pkg_dependencies="postgresql postgresql-contrib apt-transport-https"
YNH_PHP_VERSION="7.3" YNH_PHP_VERSION="7.3"
extra_php_dependencies="php${YNH_PHP_VERSION}-fpm php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-pgsql php${YNH_PHP_VERSION}-xml" extra_php_dependencies="php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-pgsql php${YNH_PHP_VERSION}-xml"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
@ -22,16 +22,3 @@ extra_php_dependencies="php${YNH_PHP_VERSION}-fpm php${YNH_PHP_VERSION}-curl php
#================================================= #=================================================
# FUTURE OFFICIAL HELPERS # FUTURE OFFICIAL HELPERS
#================================================= #=================================================
# Execute a command as another user
# usage: ynh_exec_as USER COMMAND [ARG ...]
ynh_exec_as() {
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]; then
eval "$@"
else
sudo -u "$USER" "$@"
fi
}

View file

@ -29,7 +29,6 @@ app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================

View file

@ -48,7 +48,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -76,13 +75,9 @@ ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
db_name=$(ynh_sanitize_dbid --db_name=$app) db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_string_random --length=30)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
ynh_psql_test_if_first_run ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_setup_db --db_user=$db_name --db_name=$db_name
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
@ -128,10 +123,7 @@ phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
#================================================= #=================================================
ynh_script_progression --message="Modifying a config file..." --weight=1 ynh_script_progression --message="Modifying a config file..." --weight=1
cp ../conf/db.example.inc.php $final_path/config/db.inc.php ynh_add_config --template="../conf/db.example.inc.php" --destination="$final_path/config/db.inc.php"
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config/db.inc.php"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config/db.inc.php"
ynh_store_file_checksum --file="$final_path/config/db.inc.php" ynh_store_file_checksum --file="$final_path/config/db.inc.php"
@ -150,11 +142,6 @@ popd
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1 ynh_script_progression --message="Configuring a systemd service..." --weight=1
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file=../conf/systemd.service
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file=../conf/systemd.service
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=../conf/systemd.service
ynh_replace_string --match_string="__PHP_VERSION__" --replace_string="$phpversion" --target_file=../conf/systemd.service
ynh_add_systemd_config ynh_add_systemd_config
#================================================= #=================================================

View file

@ -32,7 +32,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================

View file

@ -23,7 +23,7 @@ port=$(ynh_app_setting_get --app=$app --key=port)
is_public=$(ynh_app_setting_get --app=$app --key=is_public) is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion) phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
timezone=$(cat /etc/timezone) timezone=$(cat /etc/timezone)
@ -172,12 +172,6 @@ popd
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
# Create a dedicated systemd config
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file=../conf/systemd.service
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file=../conf/systemd.service
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=../conf/systemd.service
ynh_replace_string --match_string="__PHP_VERSION__" --replace_string="$phpversion" --target_file=../conf/systemd.service
ynh_add_systemd_config ynh_add_systemd_config
#================================================= #=================================================