utils/morty.sh
¶
To simplify installation and maintenance of a morty instance you can use the script git://utils/morty.sh. In most cases you will install morty simply by running the command:
sudo -H ./utils/morty.sh install all
The script adds a ${SERVICE_USER}
(default:morty
) and installs morty
into this user account:
Create a separated user account (
morty
).Download and install Go binary in user’s $HOME (
~morty
).Install morty with the package management from Go (
go get -v -u github.com/asciimoo/morty
)Setup a systemd service unit [ref] (
/lib/systemd/system/morty.service
).
Hint
To add morty to your SearXNG instance read chapter How to setup result proxy.
Create user¶
$ sudo -H useradd --shell /bin/bash --system \
--home-dir "/usr/local/morty" \
--comment "Privacy-respecting metasearch engine" morty
$ sudo -H mkdir "/usr/local/morty"
$ sudo -H chown -R "morty:morty" "/usr/local/morty"
Install go¶
$ cat > "/usr/local/morty/.go_env" <<EOF
export GOPATH=/usr/local/morty/go-apps
export PATH=$PATH:/usr/local/morty/local/go/bin:$GOPATH/bin
EOF
$ sudo -i -u "morty"
(morty) $ echo 'source /usr/local/morty/.go_env' >> ~/.profile
(morty) $ mkdir /usr/local/morty/local
(morty) $ wget --progress=bar -O "go1.17.2.linux-amd64.tar.gz" \
"https://golang.org/dl/go1.17.2.linux-amd64.tar.gz"
(morty) $ tar -C /usr/local/morty/local -xzf "go1.17.2.linux-amd64.tar.gz"
(morty) $ which go
/usr/local/morty/local/go/bin/go
Install morty¶
Install morty software and systemd unit:
$ sudo -i -u "morty"
(morty) $ go get -v -u github.com/asciimoo/morty
[Unit]
Description=morty
After=syslog.target
After=network.target
[Service]
Type=simple
User=morty
Group=morty
WorkingDirectory=/usr/local/morty
ExecStart=/usr/local/morty/go-apps/bin/morty -key '' -listen '127.0.0.1:3000' -timeout 5
Restart=always
Environment=USER=morty HOME=/usr/local/morty DEBUG=false
# 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
Overview¶
The --help
output of the script is largely self-explanatory
(Common commands & environment):
INFO: not yet cloned: /usr/local/searx/searx-src
usage::
morty.sh shell
morty.sh install [all|check|user]
morty.sh reinstall all
morty.sh update [morty]
morty.sh remove [all]
morty.sh activate [service]
morty.sh deactivate [service]
morty.sh inspect [service]
morty.sh option [debug-on|debug-off|new-key]
morty.sh apache [install|remove]
morty.sh nginx [install|remove]
morty.sh info [searx]
shell
start interactive shell from user morty
install / remove
:all: complete setup of morty service
:user: add/remove service user 'morty' (/usr/local/morty)
install
:check: check the morty installation
reinstall:
:all: runs 'install/remove all'
update morty
Update morty installation (/usr/local/morty)
activate service
activate and start service daemon (systemd unit)
deactivate service
stop and deactivate service daemon (systemd unit)
inspect service
show service status and log
option
set one of the available options
:new-key: set new morty key
apache : http://fv-az445-316/morty/
:install: apache site with a reverse proxy (ProxyPass)
:remove: apache site morty.conf
nginx (http://fv-az445-316/morty/)
:install: nginx site with a reverse proxy (ProxyPass)
:remove: nginx site morty.conf
----
sourced /home/runner/work/searxng/searxng/.config.sh :
SERVICE_USER : morty
SERVICE_HOME : /usr/local/morty
PUBLIC_URL_MORTY: : http://fv-az445-316/morty/
MORTY_LISTEN: : 127.0.0.1:3000
---- SearXNG instance setup (status: missing-searx-clone)
SEARXNG_SETTINGS_PATH : /etc/searxng/settings.yml
SEARX_PYENV : /usr/local/searx/searx-pyenv
SEARX_SRC : /usr/local/searx/searx-src
SEARXNG_URL : http://fv-az445-316
To activate result and image proxy in SearXNG read:
https://docs.searxng.org/admin/morty.html
Check settings in file /etc/searxng/settings.yml ...
result_proxy:
url : http://fv-az445-316/morty/
server:
image_proxy : True