[enh] tidy: clean old morty, filtron, searx references
Everyone should have already switched from legacy methods.
This commit is contained in:
commit
1a8884fa26
5
Makefile
5
Makefile
@ -65,10 +65,7 @@ test.shell:
|
||||
utils/lib_redis.sh \
|
||||
utils/searxng.sh \
|
||||
utils/lxc.sh \
|
||||
utils/lxc-searxng.env \
|
||||
utils/searx.sh \
|
||||
utils/filtron.sh \
|
||||
utils/morty.sh
|
||||
utils/lxc-searxng.env
|
||||
$(Q)$(MTOOLS) build_msg TEST "$@ OK"
|
||||
|
||||
|
||||
|
@ -12,8 +12,7 @@ Environment variables:
|
||||
INSTANCE_NAME settings.yml : general.instance_name
|
||||
AUTOCOMPLETE settings.yml : search.autocomplete
|
||||
BASE_URL settings.yml : server.base_url
|
||||
MORTY_URL settings.yml : result_proxy.url
|
||||
MORTY_KEY settings.yml : result_proxy.key
|
||||
|
||||
Volume:
|
||||
/etc/searxng the docker entry point copies settings.yml and uwsgi.ini in
|
||||
this directory (see the -f command line option)"
|
||||
@ -70,20 +69,6 @@ patch_searxng_settings() {
|
||||
-e "s/autocomplete: \"\"/autocomplete: \"${AUTOCOMPLETE}\"/g" \
|
||||
-e "s/ultrasecretkey/$(head -c 24 /dev/urandom | base64 | tr -dc 'a-zA-Z0-9')/g" \
|
||||
"${CONF}"
|
||||
|
||||
# Morty configuration
|
||||
|
||||
if [ -n "${MORTY_KEY}" ] && [ -n "${MORTY_URL}" ]; then
|
||||
sed -i -e "s/image_proxy: false/image_proxy: true/g" \
|
||||
"${CONF}"
|
||||
cat >> "${CONF}" <<-EOF
|
||||
|
||||
# Morty configuration
|
||||
result_proxy:
|
||||
url: ${MORTY_URL}
|
||||
key: !!binary "${MORTY_KEY}"
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
update_conf() {
|
||||
@ -122,30 +107,6 @@ update_conf() {
|
||||
fi
|
||||
}
|
||||
|
||||
# searx compatibility: copy /etc/searx/* to /etc/searxng/*
|
||||
SEARX_CONF=0
|
||||
if [ -f "/etc/searx/settings.yml" ]; then
|
||||
if [ ! -f "${SEARXNG_SETTINGS_PATH}" ]; then
|
||||
printf '⚠️ /etc/searx/settings.yml is copied to /etc/searxng\n'
|
||||
cp "/etc/searx/settings.yml" "${SEARXNG_SETTINGS_PATH}"
|
||||
fi
|
||||
SEARX_CONF=1
|
||||
fi
|
||||
if [ -f "/etc/searx/uwsgi.ini" ]; then
|
||||
printf '⚠️ /etc/searx/uwsgi.ini is ignored. Use the volume /etc/searxng\n'
|
||||
SEARX_CONF=1
|
||||
fi
|
||||
if [ "$SEARX_CONF" -eq "1" ]; then
|
||||
printf '⚠️ The deprecated volume /etc/searx is mounted. Please update your configuration to use /etc/searxng ⚠️\n'
|
||||
cat << EOF > /etc/searx/deprecated_volume_read_me.txt
|
||||
This Docker image uses the volume /etc/searxng
|
||||
Update your configuration:
|
||||
* remove uwsgi.ini (or very carefully update your existing uwsgi.ini using https://github.com/searxng/searxng/blob/master/container/uwsgi.ini )
|
||||
* mount /etc/searxng instead of /etc/searx
|
||||
EOF
|
||||
fi
|
||||
# end of searx compatibility
|
||||
|
||||
# make sure there are uwsgi settings
|
||||
update_conf "${FORCE_CONF_UPDATE}" "${UWSGI_SETTINGS_PATH}" "/usr/local/searxng/container/uwsgi.ini" "patch_uwsgi_settings"
|
||||
|
||||
@ -158,8 +119,6 @@ if [ $DRY_RUN -eq 1 ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
unset MORTY_KEY
|
||||
|
||||
printf 'Listen on %s\n' "${BIND_ADDRESS}"
|
||||
|
||||
# Start uwsgi
|
||||
|
@ -6,7 +6,7 @@ digraph G {
|
||||
browser [label="browser", shape=tab, fillcolor=aliceblue];
|
||||
rp [label="reverse proxy"];
|
||||
static [label="static files", shape=folder, href="url to configure static files", fillcolor=lightgray];
|
||||
uwsgi [label="uwsgi", shape=parallelogram href="https://docs.searxng.org/utils/searx.sh.html"]
|
||||
uwsgi [label="uwsgi", shape=parallelogram href="https://docs.searxng.org/utils/searxng.sh.html"]
|
||||
redis [label="redis DB", shape=cylinder];
|
||||
searxng1 [label="SearXNG #1", fontcolor=blue3];
|
||||
searxng2 [label="SearXNG #2", fontcolor=blue3];
|
||||
|
@ -58,9 +58,6 @@ and then, to name just a few:
|
||||
- Bot protection has been switched from filtron to SearXNG's :ref:`limiter
|
||||
<limiter>`, this requires a :ref:`Redis <settings redis>` database.
|
||||
|
||||
- The image proxy morty is no longer needed, it has been replaced by the
|
||||
:ref:`image proxy <image_proxy>` from SearXNG.
|
||||
|
||||
- To save bandwidth :ref:`cache busting <static_use_hash>` has been implemented.
|
||||
To get in use, the ``static-expires`` needs to be set in the :ref:`uwsgi
|
||||
setup`.
|
||||
@ -71,12 +68,6 @@ examples show, this is not always enough, sometimes services have to be set up
|
||||
or reconfigured and sometimes services that are no longer needed should be
|
||||
uninstalled.
|
||||
|
||||
.. hint::
|
||||
|
||||
First of all: SearXNG is installed by the script :ref:`searxng.sh`. If you
|
||||
have old filtron, morty or searx setup you should consider complete
|
||||
uninstall/reinstall.
|
||||
|
||||
Here you will find a list of changes that affect the infrastructure. Please
|
||||
check to what extent it is necessary to update your installations:
|
||||
|
||||
@ -85,39 +76,6 @@ check to what extent it is necessary to update your installations:
|
||||
file manually.
|
||||
|
||||
|
||||
remove obsolete services
|
||||
------------------------
|
||||
|
||||
If your searx instance was installed *"Step by step"* or by the *"Installation
|
||||
scripts"*, you need to undo the installation procedure completely. If you have
|
||||
morty & filtron installed, it is recommended to uninstall these services also.
|
||||
In case of scripts, to uninstall use the scripts from the origin you installed
|
||||
searx from or try::
|
||||
|
||||
$ sudo -H ./utils/filtron.sh remove all
|
||||
$ sudo -H ./utils/morty.sh remove all
|
||||
$ sudo -H ./utils/searx.sh remove all
|
||||
|
||||
.. hint::
|
||||
|
||||
If you are migrate from searx take into account that the ``.config.sh`` is no
|
||||
longer used.
|
||||
|
||||
If you upgrade from searx or from before :pull:`1332` has been merged and you
|
||||
have filtron and/or morty installed, don't forget to remove HTTP sites.
|
||||
|
||||
Apache::
|
||||
|
||||
$ sudo -H ./utils/filtron.sh apache remove
|
||||
$ sudo -H ./utils/morty.sh apache remove
|
||||
|
||||
nginx::
|
||||
|
||||
$ sudo -H ./utils/filtron.sh nginx remove
|
||||
$ sudo -H ./utils/morty.sh nginx remove
|
||||
|
||||
|
||||
|
||||
Check after Installation
|
||||
------------------------
|
||||
|
||||
@ -130,9 +88,6 @@ to see if there are some left overs. In this example there exists a *old*
|
||||
SearXNG checks
|
||||
--------------
|
||||
ERROR: settings.yml in /etc/searx/ is deprecated, move file to folder /etc/searxng/
|
||||
INFO: [OK] (old) account 'searx' does not exists
|
||||
INFO: [OK] (old) account 'filtron' does not exists
|
||||
INFO: [OK] (old) account 'morty' does not exists
|
||||
...
|
||||
INFO searx.redisdb : connecting to Redis db=0 path='/usr/local/searxng-redis/run/redis.sock'
|
||||
INFO searx.redisdb : connected to Redis
|
||||
|
@ -319,13 +319,13 @@ To *inspect* the SearXNG instance (already described above):
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ ./utils/searx.sh inspect service
|
||||
$ ./utils/searxng.sh inspect service
|
||||
|
||||
.. group-tab:: desktop (HOST)
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ sudo -H ./utils/lxc.sh cmd searxng-archlinux ./utils/searx.sh inspect service
|
||||
$ sudo -H ./utils/lxc.sh cmd searxng-archlinux ./utils/searxng.sh inspect service
|
||||
|
||||
Run :ref:`makefile`, e.g. to test inside the container:
|
||||
|
||||
@ -435,4 +435,3 @@ use:
|
||||
[searxng-archlinux] SEARXNG_URL : http:///n.n.n.140/searxng
|
||||
[searxng-archlinux] SEARXNG_PORT : 8888
|
||||
[searxng-archlinux] SEARXNG_BIND_ADDRESS : 127.0.0.1
|
||||
|
||||
|
@ -39,8 +39,7 @@ Removing private data means not sending cookies to external search engines and
|
||||
generating a random browser profile for every request. Thus, it does not matter
|
||||
if a public or private instance handles the request, because it is anonymized in
|
||||
both cases. The IP address used will be the IP of the instance, but SearXNG can also be
|
||||
configured to use proxy or Tor. `Result proxy
|
||||
<https://github.com/asciimoo/morty>`__ is supported, too.
|
||||
configured to use proxy or Tor.
|
||||
|
||||
SearXNG does not serve ads or tracking content, unlike most search services. Therefore,
|
||||
private data is not forwarded to third parties who might monetize it. Besides
|
||||
|
@ -28,7 +28,7 @@ In most cases you will install SearXNG simply by running the command:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
sudo -H ./utils/searx.sh install all
|
||||
sudo -H ./utils/searxng.sh install all
|
||||
|
||||
The installation is described in chapter :ref:`installation basic`.
|
||||
|
||||
|
@ -169,18 +169,6 @@ ui:
|
||||
# - image_proxy
|
||||
# - query_in_title
|
||||
|
||||
# searx supports result proxification using an external service:
|
||||
# https://github.com/asciimoo/morty uncomment below section if you have running
|
||||
# morty proxy the key is base64 encoded (keep the !!binary notation)
|
||||
# Note: since commit af77ec3, morty accepts a base64 encoded key.
|
||||
#
|
||||
# result_proxy:
|
||||
# url: http://127.0.0.1:3000/
|
||||
# # the key is a base64 encoded string, the YAML !!binary prefix is optional
|
||||
# key: !!binary "your_morty_proxy_key"
|
||||
# # [true|false] enable the "proxy" button next to each result
|
||||
# proxify_results: true
|
||||
|
||||
# communication with search engines
|
||||
#
|
||||
outgoing:
|
||||
|
@ -230,11 +230,6 @@ SCHEMA = {
|
||||
'extra_proxy_timeout': SettingsValue(int, 0),
|
||||
'networks': {},
|
||||
},
|
||||
'result_proxy': {
|
||||
'url': SettingsValue((None, str), None),
|
||||
'key': SettingsBytesValue((None, bytes), None),
|
||||
'proxify_results': SettingsValue(bool, False),
|
||||
},
|
||||
'plugins': SettingsValue(dict, {}),
|
||||
'checker': {
|
||||
'off_when_debug': SettingsValue(bool, True, None),
|
||||
|
@ -44,10 +44,10 @@
|
||||
{%- endmacro -%}
|
||||
|
||||
<!-- Draw result sub footer -->
|
||||
{%- macro result_sub_footer(result, proxify) -%}
|
||||
{%- macro result_sub_footer(result) -%}
|
||||
<div class="engines">
|
||||
{% for engine in result.engines %}<span>{{ engine }}</span>{% endfor %}
|
||||
{{ icon_small('ellipsis-vertical') + result_link(cache_url + result.url, _('cached'), "cache_link") }}‎ {% if proxify and proxify_results %} {{ result_link(proxify(result.url), _('proxied'), "proxyfied_link") }} {% endif %}
|
||||
{{ icon_small('ellipsis-vertical') + result_link(cache_url + result.url, _('cached'), "cache_link") }}
|
||||
</div>{{- '' -}}
|
||||
<div class="break"></div>{{- '' -}}
|
||||
{%- endmacro -%}
|
||||
|
@ -28,5 +28,5 @@
|
||||
{{- result.codelines|code_highlighter(result.code_language)|safe -}}
|
||||
</div>
|
||||
|
||||
{{- result_sub_footer(result, proxify) -}}
|
||||
{{- result_sub_footer(result) -}}
|
||||
{{- result_footer(result) -}}
|
||||
|
@ -14,7 +14,7 @@
|
||||
{{ _('This site did not provide any description.')|safe }}
|
||||
</p>
|
||||
{% endif -%}
|
||||
{{- result_sub_footer(result, proxify) -}}
|
||||
{{- result_sub_footer(result) -}}
|
||||
{% if result.iframe_src -%}
|
||||
<div id="result-media-{{ index }}" class="embedded-content invisible">
|
||||
<iframe data-src="{{result.iframe_src}}" frameborder="0" allowfullscreen></iframe>
|
||||
|
@ -43,7 +43,7 @@
|
||||
<small> <a class="btn-collapse collapsed searxng_init_map hide_if_nojs" data-target="#result-map-{{ index }}" data-btn-text-collapsed="{{ _('show map') }}" data-btn-text-not-collapsed="{{ _('hide map') }}" data-leaflet-target="osm-map-{{ index }}" data-map-lon="{{ result.longitude }}" data-map-lat="{{ result.latitude }}" {% if result.boundingbox %}data-map-boundingbox='{{ result.boundingbox|tojson|safe }}'{% endif %} {% if result.geojson %}data-map-geojson='{{ result.geojson|tojson|safe }}'{% endif %}>{{ icon_small( 'globe') }} {{ _('show map') }}</a></small>
|
||||
{%- endif -%}
|
||||
|
||||
{{- result_sub_footer(result, proxify) -}}
|
||||
{{- result_sub_footer(result) -}}
|
||||
|
||||
{% if (result.latitude and result.longitude) or result.boundingbox -%}
|
||||
<div id="result-map-{{ index }}" class="invisible"><div id="osm-map-{{ index }}" class="osm-map-box"></div></div>
|
||||
|
@ -34,5 +34,5 @@
|
||||
{%- if result.html_url -%}{{ result_link(result.html_url, _('HTML')) }}{%- endif -%}
|
||||
{%- if result.doi %}{{ result_link('https://www.altmetric.com/details/doi/' + result.doi, 'Altmetric') }}{% endif -%}
|
||||
</p>
|
||||
{{- result_sub_footer(result, proxify) -}}
|
||||
{{- result_sub_footer(result) -}}
|
||||
{{- result_footer(result) }}
|
||||
|
@ -10,5 +10,5 @@
|
||||
{{ result.content|safe }}
|
||||
</p>
|
||||
{% endif -%}
|
||||
{{- result_sub_footer(result, proxify) -}}
|
||||
{{- result_sub_footer(result) -}}
|
||||
{{- result_footer(result) }}
|
||||
|
@ -19,5 +19,5 @@
|
||||
{%- if result.files %}{{ icon_big('file') }} <span class="badge">{{ result.files }} {{ _('Number of Files') }}</span>{%- endif -%}
|
||||
</p>
|
||||
{%- if result.content %}<p class="content">{{ result.content|safe }}</p>{%- endif -%}
|
||||
{{- result_sub_footer(result, proxify) -}}
|
||||
{{- result_sub_footer(result) -}}
|
||||
{{- result_footer(result) -}}
|
||||
|
@ -15,7 +15,7 @@
|
||||
</p>
|
||||
{% endif -%}
|
||||
</p>
|
||||
{{- result_sub_footer(result, proxify) -}}
|
||||
{{- result_sub_footer(result) -}}
|
||||
{% if result.iframe_src -%}
|
||||
<div id="result-video-{{ index }}" class="embedded-video invisible">
|
||||
<iframe data-src="{{result.iframe_src}}" frameborder="0" allowfullscreen></iframe>
|
||||
|
@ -7,8 +7,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import inspect
|
||||
import hashlib
|
||||
import hmac
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
@ -261,24 +259,6 @@ def custom_url_for(endpoint: str, **values):
|
||||
return url_for(endpoint, **values) + suffix
|
||||
|
||||
|
||||
def morty_proxify(url: str):
|
||||
if not url:
|
||||
return url
|
||||
|
||||
if url.startswith('//'):
|
||||
url = 'https:' + url
|
||||
|
||||
if not settings['result_proxy']['url']:
|
||||
return url
|
||||
|
||||
url_params = dict(mortyurl=url)
|
||||
|
||||
if settings['result_proxy']['key']:
|
||||
url_params['mortyhash'] = hmac.new(settings['result_proxy']['key'], url.encode(), hashlib.sha256).hexdigest()
|
||||
|
||||
return '{0}?{1}'.format(settings['result_proxy']['url'], urlencode(url_params))
|
||||
|
||||
|
||||
def image_proxify(url: str):
|
||||
if not url:
|
||||
return url
|
||||
@ -300,9 +280,6 @@ def image_proxify(url: str):
|
||||
return url
|
||||
return None
|
||||
|
||||
if settings['result_proxy']['url']:
|
||||
return morty_proxify(url)
|
||||
|
||||
h = new_hmac(settings['server']['secret_key'], url.encode())
|
||||
|
||||
return '{0}?{1}'.format(url_for('image_proxy'), urlencode(dict(url=url.encode(), h=h)))
|
||||
@ -424,8 +401,6 @@ def render(template_name: str, **kwargs):
|
||||
kwargs['url_for'] = custom_url_for # override url_for function in templates
|
||||
kwargs['image_proxify'] = image_proxify
|
||||
kwargs['favicon_url'] = favicons.favicon_url
|
||||
kwargs['proxify'] = morty_proxify if settings['result_proxy']['url'] is not None else None
|
||||
kwargs['proxify_results'] = settings['result_proxy']['proxify_results']
|
||||
kwargs['cache_url'] = settings['ui']['cache_url']
|
||||
kwargs['get_result_template'] = get_result_template
|
||||
kwargs['opensearch_url'] = (
|
||||
|
@ -4,6 +4,3 @@ server:
|
||||
bind_address: "[::]"
|
||||
default_http_headers:
|
||||
Custom-Header: Custom-Value
|
||||
result_proxy:
|
||||
url: https://localhost/morty
|
||||
key: "$ecretKey"
|
||||
|
125
utils/filtron.sh
125
utils/filtron.sh
@ -1,125 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# shellcheck disable=SC2001
|
||||
|
||||
# shellcheck source=utils/lib.sh
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# config
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
PUBLIC_URL="${PUBLIC_URL:-${SEARXNG_URL}}"
|
||||
|
||||
FILTRON_ETC="/etc/filtron"
|
||||
|
||||
SERVICE_NAME="filtron"
|
||||
SERVICE_USER="${SERVICE_USER:-${SERVICE_NAME}}"
|
||||
SERVICE_SYSTEMD_UNIT="${SYSTEMD_UNITS}/${SERVICE_NAME}.service"
|
||||
|
||||
APACHE_FILTRON_SITE="searx.conf"
|
||||
NGINX_FILTRON_SITE="searx.conf"
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
usage() {
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# shellcheck disable=SC1117
|
||||
cat <<EOF
|
||||
usage::
|
||||
$(basename "$0") remove all
|
||||
$(basename "$0") apache remove
|
||||
$(basename "$0") nginx remove
|
||||
|
||||
remove all : drop all components of the filtron service
|
||||
apache remove : drop apache site ${APACHE_FILTRON_SITE}
|
||||
nginx remove : drop nginx site ${NGINX_FILTRON_SITE}
|
||||
|
||||
environment:
|
||||
PUBLIC_URL : ${PUBLIC_URL}
|
||||
EOF
|
||||
|
||||
[[ -n ${1} ]] && err_msg "$1"
|
||||
}
|
||||
|
||||
main() {
|
||||
local _usage="unknown or missing $1 command $2"
|
||||
|
||||
case $1 in
|
||||
-h|--help) usage; exit 0;;
|
||||
remove)
|
||||
sudo_or_exit
|
||||
case $2 in
|
||||
all) remove_all;;
|
||||
*) usage "$_usage"; exit 42;;
|
||||
esac ;;
|
||||
apache)
|
||||
sudo_or_exit
|
||||
case $2 in
|
||||
remove) remove_apache_site ;;
|
||||
*) usage "$_usage"; exit 42;;
|
||||
esac ;;
|
||||
nginx)
|
||||
sudo_or_exit
|
||||
case $2 in
|
||||
remove) remove_nginx_site ;;
|
||||
*) usage "$_usage"; exit 42;;
|
||||
esac ;;
|
||||
*) usage "unknown or missing command $1"; exit 42;;
|
||||
esac
|
||||
}
|
||||
|
||||
remove_all() {
|
||||
rst_title "De-Install $SERVICE_NAME (service)"
|
||||
|
||||
rst_para "\
|
||||
It goes without saying that this script can only be used to remove
|
||||
installations that were installed with this script."
|
||||
|
||||
if ! systemd_remove_service "${SERVICE_NAME}" "${SERVICE_SYSTEMD_UNIT}"; then
|
||||
return 42
|
||||
fi
|
||||
drop_service_account "${SERVICE_USER}"
|
||||
rm -r "$FILTRON_ETC" 2>&1 | prefix_stdout
|
||||
if service_is_available "${PUBLIC_URL}"; then
|
||||
MSG="** Don't forget to remove your public site! (${PUBLIC_URL}) **" wait_key 10
|
||||
fi
|
||||
}
|
||||
|
||||
remove_apache_site() {
|
||||
|
||||
rst_title "Remove Apache site $APACHE_FILTRON_SITE"
|
||||
|
||||
rst_para "\
|
||||
This removes apache site ${APACHE_FILTRON_SITE}."
|
||||
|
||||
! apache_is_installed && err_msg "Apache is not installed."
|
||||
|
||||
if ! ask_yn "Do you really want to continue?" Yn; then
|
||||
return
|
||||
fi
|
||||
|
||||
apache_remove_site "$APACHE_FILTRON_SITE"
|
||||
|
||||
}
|
||||
|
||||
remove_nginx_site() {
|
||||
|
||||
rst_title "Remove nginx site $NGINX_FILTRON_SITE"
|
||||
|
||||
rst_para "\
|
||||
This removes nginx site ${NGINX_FILTRON_SITE}."
|
||||
|
||||
! nginx_is_installed && err_msg "nginx is not installed."
|
||||
|
||||
if ! ask_yn "Do you really want to continue?" Yn; then
|
||||
return
|
||||
fi
|
||||
|
||||
nginx_remove_app "$FILTRON_FILTRON_SITE"
|
||||
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
main "$@"
|
||||
# ----------------------------------------------------------------------------
|
@ -1802,8 +1802,8 @@ url_replace_hostname(){
|
||||
|
||||
# to replace hostname by primary IP::
|
||||
#
|
||||
# url_replace_hostname http://searx-ubu1604/morty $(primary_ip)
|
||||
# http://10.246.86.250/morty
|
||||
# url_replace_hostname http://searx-ubu1604/example $(primary_ip)
|
||||
# http://10.246.86.250/example
|
||||
|
||||
# shellcheck disable=SC2001
|
||||
echo "$1" | sed "s|\(http[s]*://\)[^/]*\(.*\)|\1$2\2|"
|
||||
|
124
utils/morty.sh
124
utils/morty.sh
@ -1,124 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# shellcheck source=utils/lib.sh
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# config
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
PUBLIC_URL="${PUBLIC_URL:-${SEARXNG_URL}}"
|
||||
|
||||
MORTY_LISTEN="${MORTY_LISTEN:-127.0.0.1:3000}"
|
||||
PUBLIC_URL_PATH_MORTY="${PUBLIC_URL_PATH_MORTY:-/morty/}"
|
||||
PUBLIC_URL_MORTY="${PUBLIC_URL_MORTY:-$(echo "$PUBLIC_URL" | sed -e's,^\(.*://[^/]*\).*,\1,g')${PUBLIC_URL_PATH_MORTY}}"
|
||||
|
||||
SERVICE_NAME="morty"
|
||||
SERVICE_USER="${SERVICE_USER:-${SERVICE_NAME}}"
|
||||
SERVICE_SYSTEMD_UNIT="${SYSTEMD_UNITS}/${SERVICE_NAME}.service"
|
||||
|
||||
# Apache Settings
|
||||
|
||||
APACHE_MORTY_SITE="morty.conf"
|
||||
NGINX_MORTY_SITE="morty.conf"
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
usage() {
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# shellcheck disable=SC1117
|
||||
cat <<EOF
|
||||
usage::
|
||||
$(basename "$0") remove all
|
||||
$(basename "$0") apache remove
|
||||
$(basename "$0") nginx remove
|
||||
|
||||
remove all : drop all components of the morty service
|
||||
apache remove : drop apache site ${APACHE_MORTY_SITE}
|
||||
nginx remove : drop nginx site ${NGINX_MORTY_SITE}
|
||||
|
||||
environment:
|
||||
PUBLIC_URL_MORTY : ${PUBLIC_URL_MORTY}
|
||||
EOF
|
||||
|
||||
[[ -n ${1} ]] && err_msg "$1"
|
||||
}
|
||||
|
||||
main() {
|
||||
local _usage="ERROR: unknown or missing $1 command $2"
|
||||
|
||||
case $1 in
|
||||
-h|--help) usage; exit 0;;
|
||||
remove)
|
||||
sudo_or_exit
|
||||
case $2 in
|
||||
all) remove_all;;
|
||||
*) usage "$_usage"; exit 42;;
|
||||
esac ;;
|
||||
apache)
|
||||
sudo_or_exit
|
||||
case $2 in
|
||||
remove) remove_apache_site ;;
|
||||
*) usage "$_usage"; exit 42;;
|
||||
esac ;;
|
||||
nginx)
|
||||
sudo_or_exit
|
||||
case $2 in
|
||||
remove) remove_nginx_site ;;
|
||||
*) usage "$_usage"; exit 42;;
|
||||
esac ;;
|
||||
*) usage "ERROR: unknown or missing command $1"; exit 42;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
remove_all() {
|
||||
rst_title "De-Install $SERVICE_NAME (service)"
|
||||
|
||||
rst_para "\
|
||||
It goes without saying that this script can only be used to remove
|
||||
installations that were installed with this script."
|
||||
|
||||
if systemd_remove_service "${SERVICE_NAME}" "${SERVICE_SYSTEMD_UNIT}"; then
|
||||
drop_service_account "${SERVICE_USER}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
remove_apache_site() {
|
||||
|
||||
rst_title "Remove Apache site $APACHE_MORTY_SITE"
|
||||
|
||||
rst_para "\
|
||||
This removes apache site ${APACHE_MORTY_SITE}."
|
||||
|
||||
! apache_is_installed && err_msg "Apache is not installed."
|
||||
|
||||
if ! ask_yn "Do you really want to continue?" Yn; then
|
||||
return
|
||||
fi
|
||||
|
||||
apache_remove_site "$APACHE_MORTY_SITE"
|
||||
}
|
||||
|
||||
remove_nginx_site() {
|
||||
|
||||
rst_title "Remove nginx site $NGINX_MORTY_SITE"
|
||||
|
||||
rst_para "\
|
||||
This removes nginx site ${NGINX_MORTY_SITE}."
|
||||
|
||||
! nginx_is_installed && err_msg "nginx is not installed."
|
||||
|
||||
if ! ask_yn "Do you really want to continue?" Yn; then
|
||||
return
|
||||
fi
|
||||
|
||||
nginx_remove_app "$NGINX_MORTY_SITE"
|
||||
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
main "$@"
|
||||
# ----------------------------------------------------------------------------
|
@ -1,88 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# shellcheck disable=SC2001
|
||||
|
||||
# shellcheck source=utils/lib.sh
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# config
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
PUBLIC_URL="${PUBLIC_URL:-${SEARXNG_URL}}"
|
||||
|
||||
SERVICE_NAME="searx"
|
||||
SERVICE_USER="${SERVICE_USER:-${SERVICE_NAME}}"
|
||||
SEARXNG_SETTINGS_PATH="/etc/searx/settings.yml"
|
||||
SEARXNG_UWSGI_APP="searx.ini"
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
usage() {
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# shellcheck disable=SC1117
|
||||
cat <<EOF
|
||||
usage::
|
||||
$(basename "$0") remove all
|
||||
|
||||
remove all: complete uninstall of SearXNG service
|
||||
|
||||
environment:
|
||||
PUBLIC_URL : ${PUBLIC_URL}
|
||||
EOF
|
||||
|
||||
[[ -n ${1} ]] && err_msg "$1"
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
local _usage="unknown or missing $1 command $2"
|
||||
|
||||
case $1 in
|
||||
remove)
|
||||
rst_title "SearXNG (remove)" part
|
||||
sudo_or_exit
|
||||
case $2 in
|
||||
all) remove_all;;
|
||||
*) usage "$_usage"; exit 42;;
|
||||
esac ;;
|
||||
*) usage "unknown or missing command $1"; exit 42;;
|
||||
esac
|
||||
}
|
||||
|
||||
remove_all() {
|
||||
rst_title "De-Install SearXNG (service)"
|
||||
|
||||
rst_para "\
|
||||
It goes without saying that this script can only be used to remove
|
||||
installations that were installed with this script."
|
||||
|
||||
if ! ask_yn "Do you really want to deinstall SearXNG?"; then
|
||||
return
|
||||
fi
|
||||
remove_searx_uwsgi
|
||||
drop_service_account "${SERVICE_USER}"
|
||||
remove_settings
|
||||
wait_key
|
||||
if service_is_available "${PUBLIC_URL}"; then
|
||||
MSG="** Don't forget to remove your public site! (${PUBLIC_URL}) **" wait_key 10
|
||||
fi
|
||||
}
|
||||
|
||||
remove_settings() {
|
||||
rst_title "remove SearXNG settings" section
|
||||
echo
|
||||
info_msg "delete ${SEARXNG_SETTINGS_PATH}"
|
||||
rm -f "${SEARXNG_SETTINGS_PATH}"
|
||||
}
|
||||
|
||||
remove_searx_uwsgi() {
|
||||
rst_title "Remove SearXNG's uWSGI app (searxng.ini)" section
|
||||
echo
|
||||
uWSGI_remove_app "$SEARXNG_UWSGI_APP"
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
main "$@"
|
||||
# ----------------------------------------------------------------------------
|
@ -553,15 +553,6 @@ searxng.remove.settings() {
|
||||
|
||||
searxng.check() {
|
||||
rst_title "SearXNG checks" section
|
||||
|
||||
for NAME in "searx" "filtron" "morty"; do
|
||||
if service_account_is_available "${NAME}"; then
|
||||
err_msg "There exists an old '${NAME}' account from a previous installation."
|
||||
else
|
||||
info_msg "[OK] (old) account '${NAME}' does not exists"
|
||||
fi
|
||||
done
|
||||
|
||||
"${SEARXNG_PYENV}/bin/python" "${SEARXNG_SRC}/utils/searxng_check.py"
|
||||
}
|
||||
|
||||
|
@ -1,29 +0,0 @@
|
||||
[Unit]
|
||||
|
||||
Description=${SERVICE_NAME}
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
|
||||
Type=simple
|
||||
User=${SERVICE_USER}
|
||||
Group=${SERVICE_GROUP}
|
||||
WorkingDirectory=${SERVICE_HOME}
|
||||
ExecStart=${SERVICE_HOME}/go-apps/bin/filtron -api '${FILTRON_API}' -listen '${FILTRON_LISTEN}' -rules '${FILTRON_RULES}' -target '${FILTRON_TARGET}'
|
||||
|
||||
Restart=always
|
||||
Environment=USER=${SERVICE_USER} HOME=${SERVICE_HOME}
|
||||
|
||||
# Some distributions may not support these hardening directives. If you cannot
|
||||
# start the service due to an unknown option, comment out the ones not supported
|
||||
# by your version of systemd.
|
||||
|
||||
ProtectSystem=full
|
||||
PrivateDevices=yes
|
||||
PrivateTmp=yes
|
||||
NoNewPrivileges=true
|
||||
|
||||
[Install]
|
||||
|
||||
WantedBy=multi-user.target
|
@ -1,29 +0,0 @@
|
||||
[Unit]
|
||||
|
||||
Description=${SERVICE_NAME}
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
|
||||
Type=simple
|
||||
User=${SERVICE_USER}
|
||||
Group=${SERVICE_GROUP}
|
||||
WorkingDirectory=${SERVICE_HOME}
|
||||
ExecStart=${SERVICE_HOME}/go-apps/bin/morty -key '${MORTY_KEY}' -listen '${MORTY_LISTEN}' -timeout ${MORTY_TIMEOUT}
|
||||
|
||||
Restart=always
|
||||
Environment=USER=${SERVICE_USER} HOME=${SERVICE_HOME} DEBUG=${SERVICE_ENV_DEBUG}
|
||||
|
||||
# Some distributions may not support these hardening directives. If you cannot
|
||||
# start the service due to an unknown option, comment out the ones not supported
|
||||
# by your version of systemd.
|
||||
|
||||
ProtectSystem=full
|
||||
PrivateDevices=yes
|
||||
PrivateTmp=yes
|
||||
NoNewPrivileges=true
|
||||
|
||||
[Install]
|
||||
|
||||
WantedBy=multi-user.target
|
Loading…
x
Reference in New Issue
Block a user