summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/build-templates/morty.rst52
-rw-r--r--docs/utils/morty.sh.rst29
-rwxr-xr-xutils/morty.sh33
3 files changed, 109 insertions, 5 deletions
diff --git a/docs/build-templates/morty.rst b/docs/build-templates/morty.rst
new file mode 100644
index 000000000..4a5d1f27f
--- /dev/null
+++ b/docs/build-templates/morty.rst
@@ -0,0 +1,52 @@
+.. START create user
+
+.. tabs::
+
+ .. group-tab:: bash
+
+ .. code-block:: sh
+
+ $ sudo -H useradd --shell /bin/bash --system \\
+ --home-dir "$SERVICE_HOME" \\
+ --comment "Privacy-respecting metasearch engine" $SERVICE_USER
+
+ $ sudo -H mkdir "$SERVICE_HOME"
+ $ sudo -H chown -R "$SERVICE_GROUP:$SERVICE_GROUP" "$SERVICE_HOME"
+
+.. END create user
+
+.. START install go
+
+.. tabs::
+
+ .. group-tab:: bash
+
+ .. code-block:: bash
+
+ $ cat > "$GO_ENV" <<EOF
+ export GOPATH=${SERVICE_HOME}/go-apps
+ export PATH=\$PATH:${SERVICE_HOME}/local/go/bin:\$GOPATH/bin
+ EOF
+ $ sudo -i -u "${SERVICE_USER}"
+ (${SERVICE_USER}) $ echo 'source $GO_ENV' >> ~/.profile
+ (${SERVICE_USER}) $ mkdir ${SERVICE_HOME}/local
+ (${SERVICE_USER}) $ wget --progress=bar -O "${GO_TAR}" \\
+ "${GO_PKG_URL}"
+ (${SERVICE_USER}) $ tar -C ${SERVICE_HOME}/local/go -xzf "${GO_TAR}"
+ (${SERVICE_USER}) $ which go
+ ${SERVICE_HOME}/local/go/bin/go
+
+.. END install go
+
+.. START install morty
+
+.. tabs::
+
+ .. group-tab:: bash
+
+ .. code-block:: bash
+
+ $ sudo -i -u "${SERVICE_USER}"
+ (${SERVICE_USER}) $ go get -v -u github.com/asciimoo/morty
+
+.. END install morty
diff --git a/docs/utils/morty.sh.rst b/docs/utils/morty.sh.rst
index 2bdc4d9c8..34f0c9b5e 100644
--- a/docs/utils/morty.sh.rst
+++ b/docs/utils/morty.sh.rst
@@ -13,6 +13,7 @@
- :ref:`installation`
- :ref:`architecture`
+ - :ref:`searx morty`
To simplify installation and maintenance of a morty_ instance you can use the
script :origin:`utils/morty.sh`. In most cases you will install morty_ simply by
@@ -37,6 +38,34 @@ into this user account:
To add morty to your searx instance read chapter :ref:`searx morty`.
+Create user
+===========
+
+.. include:: ../../build/docs/includes/morty.rst
+ :start-after: START create user
+ :end-before: END create user
+
+
+Install go
+==========
+
+.. include:: ../../build/docs/includes/morty.rst
+ :start-after: START install go
+ :end-before: END install go
+
+
+Install morty
+=============
+
+Install morty software and systemd unit:
+
+.. include:: ../../build/docs/includes/morty.rst
+ :start-after: START install morty
+ :end-before: END install morty
+
+.. include:: ../../build/docs/includes/morty.rst
+ :start-after: START install systemd unit
+ :end-before: END install systemd unit
Overview
========
diff --git a/utils/morty.sh b/utils/morty.sh
index e6e14be8a..ec1d47cb6 100755
--- a/utils/morty.sh
+++ b/utils/morty.sh
@@ -194,11 +194,7 @@ main() {
debug-off) disable_debug ;;
*) usage "$_usage"; exit 42;;
esac ;;
- doc)
- echo
- echo ".. generic utils/morty.sh documentation"
- ;;
-
+ doc) rst-doc ;;
*) usage "ERROR: unknown or missing command $1"; exit 42;;
esac
}
@@ -436,6 +432,33 @@ This removes apache site ${APACHE_MORTY_SITE}."
apache_remove_site "$APACHE_MORTY_SITE"
}
+rst-doc() {
+
+ eval "echo \"$(< "${REPO_ROOT}/docs/build-templates/morty.rst")\""
+
+ echo -e "\n.. START install systemd unit"
+ cat <<EOF
+.. tabs::
+
+ .. group-tab:: systemd
+
+ .. code:: bash
+
+EOF
+ eval "echo \"$(< "${TEMPLATES}/${SERVICE_SYSTEMD_UNIT}")\"" | prefix_stdout " "
+ echo -e "\n.. END install systemd unit"
+
+ # for DIST_NAME in ubuntu-20.04 arch fedora; do
+ # (
+ # DIST_ID=${DIST_NAME%-*}
+ # DIST_VERS=${DIST_NAME#*-}
+ # [[ $DIST_VERS =~ $DIST_ID ]] && DIST_VERS=
+ # # ...
+ # )
+ # done
+}
+
+
# ----------------------------------------------------------------------------
main "$@"
# ----------------------------------------------------------------------------