mirror of
https://github.com/YunoHost-Apps/loki_ynh.git
synced 2024-09-03 19:36:16 +02:00
Fix problems
This commit is contained in:
parent
7d17f9a7e4
commit
77909659f0
7 changed files with 28 additions and 21 deletions
|
@ -7,7 +7,7 @@ Type=simple
|
|||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
ExecStart=/bin/bash -c '__FINALPATH__/loki-linux-__ARCH__ --config.file <(/bin/bash __FINALPATH__/merge_yaml.bash /etc/__APP__/loki-default.yaml /etc/__APP__/loki.d/*.y{a,}ml)'
|
||||
ExecStart=/bin/bash -c '__FINALPATH__/loki-linux-__ARCH__ --config.file <(/bin/bash __FINALPATH__/merge_yaml.sh /etc/__APP__/loki-default.yaml /etc/__APP__/loki.d/*.y{a,}ml)'
|
||||
StandardOutput=append:/var/log/__APP__/loki.log
|
||||
StandardError=inherit
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ Type=simple
|
|||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
ExecStart=/bin/bash -c '__FINALPATH__/promtail-linux-__ARCH__ --config.file <(/bin/bash __FINALPATH__/merge_yaml.bash /etc/__APP__/promtail-default.yaml /etc/__APP__/promtail.d/*.y{a,}ml)'
|
||||
ExecStart=/bin/bash -c '__FINALPATH__/promtail-linux-__ARCH__ --config.file <(/bin/bash __FINALPATH__/merge_yaml.sh /etc/__APP__/promtail-default.yaml /etc/__APP__/promtail.d/*.y{a,}ml)'
|
||||
StandardOutput=append:/var/log/__APP__/promtail.log
|
||||
StandardError=inherit
|
||||
|
||||
|
|
|
@ -75,6 +75,14 @@ chmod 750 "$final_path"
|
|||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
mkdir -p "/etc/$app/loki.d"
|
||||
chmod 700 "/etc/$app/loki.d"
|
||||
chown $app:www-data "/etc/$app/loki.d"
|
||||
|
||||
mkdir -p "/etc/$app/promtail.d"
|
||||
chmod 700 "/etc/$app/promtail.d"
|
||||
chown $app:www-data "/etc/$app/promtail.d"
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -96,14 +104,6 @@ ynh_add_config --template="promtail-default.yaml" --destination="/etc/$app/promt
|
|||
chmod 400 "/etc/$app/promtail-default.yaml"
|
||||
chown $app:www-data "/etc/$app/promtail-default.yaml"
|
||||
|
||||
mkdir -p "/etc/$app/loki.d"
|
||||
chmod 700 "/etc/$app/loki.d"
|
||||
chown $app:www-data "/etc/$app/loki.d"
|
||||
|
||||
mkdir -p "/etc/$app/promtail.d"
|
||||
chmod 700 "/etc/$app/promtail.d"
|
||||
chown $app:www-data "/etc/$app/promtail.d"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
|
|
|
@ -32,6 +32,7 @@ if ynh_exec_warn_less yunohost service status $app >/dev/null
|
|||
then
|
||||
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
||||
yunohost service remove $app
|
||||
yunohost service remove $app-promtail
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -41,6 +42,7 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
|
|||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
ynh_remove_systemd_config --service="$app-promtail"
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
|
|
|
@ -75,6 +75,15 @@ chmod 750 "$final_path"
|
|||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
mkdir -p "/etc/$app/loki.d"
|
||||
chmod 700 "/etc/$app/loki.d"
|
||||
chown $app:www-data "/etc/$app/loki.d"
|
||||
|
||||
mkdir -p "/etc/$app/promtail.d"
|
||||
chmod 700 "/etc/$app/promtail.d"
|
||||
chown $app:www-data "/etc/$app/promtail.d"
|
||||
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
|
@ -109,14 +118,6 @@ ynh_add_config --template="promtail-default.yaml" --destination="/etc/$app/promt
|
|||
chmod 400 "/etc/$app/promtail-default.yaml"
|
||||
chown $app:www-data "/etc/$app/promtail-default.yaml"
|
||||
|
||||
mkdir -p "/etc/$app/loki.d"
|
||||
chmod 700 "/etc/$app/loki.d"
|
||||
chown $app:www-data "/etc/$app/loki.d"
|
||||
|
||||
mkdir -p "/etc/$app/promtail.d"
|
||||
chmod 700 "/etc/$app/promtail.d"
|
||||
chown $app:www-data "/etc/$app/promtail.d"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
file_list=($@)
|
||||
|
||||
{
|
||||
for file in $@
|
||||
for file in "${file_list[@]}"
|
||||
do
|
||||
/usr/bin/python3 -c "import yaml, json; print(json.dumps(yaml.safe_load(open('$file'))))"
|
||||
/usr/bin/python3 -c "import yaml, json; print(json.dumps(yaml.safe_load(open('$file')), default=str))"
|
||||
done
|
||||
} \
|
||||
| /usr/bin/jq --slurp 'reduce .[] as $item ({}; . * $item)' \ # Credits: https://stackoverflow.com/a/36218044
|
||||
| /usr/bin/jq --slurp 'reduce .[] as $item ({}; . * $item)' \
|
||||
| /usr/bin/python3 -c "import yaml, json; print(yaml.dump(json.load(open('/dev/stdin'))))"
|
Loading…
Add table
Reference in a new issue