@@ -389,7 +389,7 @@ install_template() {
389 local chmod="${pos_args[4]-644}"
389 local chmod="${pos_args[4]-644}"
391 info_msg "install (eval=$do_eval): ${dst}"
391 info_msg "install (eval=$do_eval): ${dst}"
392− [[ -n $variant ]] && info_msg "variant: ${variant}"
392+ [[ -n $variant ]] && info_msg "variant --> ${variant}"
394 if [[ ! -f "${template_origin}" ]] ; then
394 if [[ ! -f "${template_origin}" ]] ; then
395 err_msg "${template_origin} does not exists"
395 err_msg "${template_origin} does not exists"
@@ -777,6 +777,7 @@ apache_dissable_site() {
777 ln -s "${APACHE_SITES_AVAILABLE}/${CONF}" "${APACHE_SITES_ENABLED}/${CONF}"
777 ln -s "${APACHE_SITES_AVAILABLE}/${CONF}" "${APACHE_SITES_ENABLED}/${CONF}"
@@ -846,7 +847,7 @@ uWSGI_restart() {
846 if uWSGI_app_available "${CONF}"; then
847 if uWSGI_app_available "${CONF}"; then
847 systemctl restart "uwsgi@${CONF%.*}"
848 systemctl restart "uwsgi@${CONF%.*}"
849− info_msg "in systemd template mode: ${CONF} not installed (nothing to restart)"
850+ info_msg "[uWSGI:systemd-template] ${CONF} not installed (no need to restart)"
852 fedora-*)
853 fedora-*)
@@ -854,7 +855,7 @@ uWSGI_restart() {
854 if uWSGI_app_enabled "${CONF}"; then
855 if uWSGI_app_enabled "${CONF}"; then
855 touch "${uWSGI_APPS_ENABLED}/${CONF}"
856 touch "${uWSGI_APPS_ENABLED}/${CONF}"
857− info_msg "in uWSGI emperor mode: ${CONF} not installed (nothing to restart)"
858+ info_msg "[uWSGI:emperor] ${CONF} not installed (no need to restart)"
@@ -864,6 +865,32 @@ uWSGI_restart() {
868+uWSGI_prepare_app() {
870+ # usage: uWSGI_prepare_app <myapp.ini>
873+ if [[ -z $APP ]]; then
874+ err_msg "uWSGI_prepare_app: missing arguments"
878+ case $DIST_ID-$DIST_VERS in
880+ # in emperor mode, the uwsgi user is the owner of the sockets
881+ info_msg "prepare (uwsgi:uwsgi) /run/uwsgi/app/${APP}"
882+ mkdir -p "/run/uwsgi/app/${APP}"
883+ chown -R "uwsgi:uwsgi" "/run/uwsgi/app/${APP}"
886+ info_msg "prepare (${SERVICE_USER}:${SERVICE_GROUP}) /run/uwsgi/app/${APP}"
887+ mkdir -p "/run/uwsgi/app/${APP}"
888+ chown -R "${SERVICE_USER}:${SERVICE_GROUP}" "/run/uwsgi/app/${APP}"
867uWSGI_app_available() {
894uWSGI_app_available() {
868 # usage: uWSGI_app_available <myapp.ini>
895 # usage: uWSGI_app_available <myapp.ini>
869 local CONF="$1"
896 local CONF="$1"
@@ -888,6 +915,7 @@ uWSGI_install_app() {
888 *) pos_args+=("$i");;
915 *) pos_args+=("$i");;
918+ uWSGI_prepare_app "${pos_args[1]}"
891 mkdir -p "${uWSGI_APPS_AVAILABLE}"
919 mkdir -p "${uWSGI_APPS_AVAILABLE}"
892 install_template "${template_opts[@]}" \
920 install_template "${template_opts[@]}" \
893 "${uWSGI_APPS_AVAILABLE}/${pos_args[1]}" \
921 "${uWSGI_APPS_AVAILABLE}/${pos_args[1]}" \
@@ -1281,3 +1309,30 @@ global_IPs(){
1282 ip -o addr show | sed -nr 's/[0-9]*:\s*([a-z0-9]*).*inet[6]?\s*([a-z0-9.:]*).*scope global.*/\1|\2/p'
1310 ip -o addr show | sed -nr 's/[0-9]*:\s*([a-z0-9]*).*inet[6]?\s*([a-z0-9.:]*).*scope global.*/\1|\2/p'
1317+ echo "$(ip -o addr show \
1318+ | sed -nr 's/[0-9]*:\s*([a-z0-9]*).*inet[6]?\s*([a-z0-9.:]*).*scope global.*/\2/p' \
1321+ *) echo "$(hostname -I | cut -d' ' -f1)" ;;
1328+url_replace_hostname(){
1330+ # usage: url_replace_hostname <url> <new hostname>
1332+ # to replace hostname by primary IP::
1334+ # url_replace_hostname http://searx-ubu1604/morty $(primary_ip)
1335+ # http://10.246.86.250/morty
1337+ echo "$1" | sed "s|\(http[s]*://\)[^/]*\(.*\)|\1$2\2|"