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

config: store the socket file in a writable location

On Yunhost `/var/tmp` is only writable by root.
This commit is contained in:
Pierre de La Morinerie 2021-11-01 10:24:00 +00:00
parent 0bb5458e66
commit b3647e3db5
3 changed files with 10 additions and 5 deletions

View file

@ -84,7 +84,7 @@
"EnableLatex": false, "EnableLatex": false,
"EnableAPIChannelDeletion": false, "EnableAPIChannelDeletion": false,
"EnableLocalMode": true, "EnableLocalMode": true,
"LocalModeSocketLocation": "/var/tmp/mattermost_local.socket", "LocalModeSocketLocation": "__LOCAL_SOCKET_PATH__",
"EnableAWSMetering": false, "EnableAWSMetering": false,
"SplitKey": "", "SplitKey": "",
"FeatureFlagSyncIntervalSeconds": 30, "FeatureFlagSyncIntervalSeconds": 30,

View file

@ -11,6 +11,7 @@ TimeoutStartSec=3600
Restart=always Restart=always
RestartSec=10 RestartSec=10
WorkingDirectory=__FINALPATH__ WorkingDirectory=__FINALPATH__
RuntimeDirectory=__APP__
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
LimitNOFILE=49152 LimitNOFILE=49152

View file

@ -144,6 +144,7 @@ ynh_script_progression --message="Modifying a config file..." --weight=3
smtp_user_pwd=$(ynh_string_random --length=24) smtp_user_pwd=$(ynh_string_random --length=24)
url=https://$domain$path_url url=https://$domain$path_url
local_socket_path="/var/run/${app}/mattermost_local.socket"
ynh_add_config --template="../conf/config.json" --destination="$final_path/config/config.json" ynh_add_config --template="../conf/config.json" --destination="$final_path/config/config.json"
@ -186,10 +187,13 @@ ynh_script_progression --message="Create the first administrator and team..." --
team_name=$(echo "$team_display_name" | iconv -f utf8 -t ascii//TRANSLIT//IGNORE | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z) team_name=$(echo "$team_display_name" | iconv -f utf8 -t ascii//TRANSLIT//IGNORE | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z)
pushd "$final_path" pushd "$final_path"
ynh_exec_warn_less ynh_exec_as $app bin/mmctl user create --local --username "$admin" --email "$email" --password "$password" --locale "$language" --system-admin export MMCTL_LOCAL=true
ynh_exec_warn_less ynh_exec_as $app bin/mmctl user verify --local "$admin" export MMCTL_LOCAL_SOCKET_PATH="$local_socket_path"
ynh_exec_warn_less ynh_exec_as $app bin/mmctl team create --local --name "$team_name" --display_name "$team_display_name" --email "$email"
ynh_exec_warn_less ynh_exec_as $app bin/mmctl team add --local "$team_name" "$admin" ynh_exec_warn_less sudo --preserve-env -u $app bin/mmctl user create --username "$admin" --email "$email" --password "$password" --locale "$language" --system-admin
ynh_exec_warn_less sudo --preserve-env -u $app bin/mmctl user verify "$admin"
ynh_exec_warn_less sudo --preserve-env -u $app bin/mmctl team create --name "$team_name" --display_name "$team_display_name" --email "$email"
ynh_exec_warn_less sudo --preserve-env -u $app bin/mmctl team add "$team_name" "$admin"
popd popd
# Now that the first user is created, disable mmctl passwordless access # Now that the first user is created, disable mmctl passwordless access