morty.sh.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <title>utils/morty.sh &#8212; Searx Documentation (Searx-1.1.0.tex)</title>
  8. <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
  9. <link rel="stylesheet" type="text/css" href="../_static/searx.css" />
  10. <link rel="stylesheet" type="text/css" href="../_static/tabs.css" />
  11. <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
  12. <script src="../_static/jquery.js"></script>
  13. <script src="../_static/underscore.js"></script>
  14. <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script>
  15. <script src="../_static/doctools.js"></script>
  16. <script src="../_static/sphinx_highlight.js"></script>
  17. <script src="../_static/tabs.js"></script>
  18. <link rel="index" title="Index" href="../genindex.html" />
  19. <link rel="search" title="Search" href="../search.html" />
  20. <link rel="next" title="utils/lxc.sh" href="lxc.sh.html" />
  21. <link rel="prev" title="utils/filtron.sh" href="filtron.sh.html" />
  22. </head><body>
  23. <div class="related" role="navigation" aria-label="related navigation">
  24. <h3>Navigation</h3>
  25. <ul>
  26. <li class="right" style="margin-right: 10px">
  27. <a href="../genindex.html" title="General Index"
  28. accesskey="I">index</a></li>
  29. <li class="right" >
  30. <a href="../py-modindex.html" title="Python Module Index"
  31. >modules</a> |</li>
  32. <li class="right" >
  33. <a href="lxc.sh.html" title="utils/lxc.sh"
  34. accesskey="N">next</a> |</li>
  35. <li class="right" >
  36. <a href="filtron.sh.html" title="utils/filtron.sh"
  37. accesskey="P">previous</a> |</li>
  38. <li class="nav-item nav-item-0"><a href="../index.html">Searx Documentation (Searx-1.1.0.tex)</a> &#187;</li>
  39. <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Admin’s tooling box</a> &#187;</li>
  40. <li class="nav-item nav-item-this"><a href=""><code class="docutils literal notranslate"><span class="pre">utils/morty.sh</span></code></a></li>
  41. </ul>
  42. </div>
  43. <div class="document">
  44. <div class="documentwrapper">
  45. <div class="bodywrapper">
  46. <div class="body" role="main">
  47. <section id="utils-morty-sh">
  48. <span id="morty-sh"></span><h1><code class="docutils literal notranslate"><span class="pre">utils/morty.sh</span></code><a class="headerlink" href="#utils-morty-sh" title="Permalink to this heading">¶</a></h1>
  49. <aside class="sidebar">
  50. <p class="sidebar-title">further reading</p>
  51. <ul class="simple">
  52. <li><p><a class="reference internal" href="../admin/architecture.html#architecture"><span class="std std-ref">Architecture</span></a></p></li>
  53. <li><p><a class="reference internal" href="../admin/installation.html#installation"><span class="std std-ref">Installation</span></a> (<a class="reference internal" href="../admin/installation-nginx.html#installation-nginx"><span class="std std-ref">nginx</span></a> &amp; <a class="reference internal" href="../admin/installation-apache.html#installation-apache"><span class="std std-ref">apache</span></a>)</p></li>
  54. <li><p><a class="reference internal" href="../admin/morty.html#searx-morty"><span class="std std-ref">How to setup result proxy</span></a></p></li>
  55. </ul>
  56. </aside>
  57. <p>To simplify installation and maintenance of a <a class="reference external" href="https://github.com/asciimoo/morty">morty</a> instance you can use the
  58. script <a class="reference external" href="https://github.com/searx/searx/blob/master/utils/morty.sh">Origin: utils/morty.sh</a>. In most cases you will install <a class="reference external" href="https://github.com/asciimoo/morty">morty</a> simply by
  59. running the command:</p>
  60. <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo -H ./utils/morty.sh install all
  61. </pre></div>
  62. </div>
  63. <p>The script adds a <code class="docutils literal notranslate"><span class="pre">${SERVICE_USER}</span></code> (default:<code class="docutils literal notranslate"><span class="pre">morty</span></code>) and installs <a class="reference external" href="https://github.com/asciimoo/morty">morty</a>
  64. into this user account:</p>
  65. <ol class="arabic simple">
  66. <li><p>Create a separated user account (<code class="docutils literal notranslate"><span class="pre">morty</span></code>).</p></li>
  67. <li><p>Download and install <a class="reference external" href="https://golang.org/">Go</a> binary in user’s $HOME (<code class="docutils literal notranslate"><span class="pre">~morty</span></code>).</p></li>
  68. <li><p>Install <a class="reference external" href="https://github.com/asciimoo/morty">morty</a> with the package management from <a class="reference external" href="https://golang.org/">Go</a> (<code class="docutils literal notranslate"><span class="pre">go</span> <span class="pre">get</span> <span class="pre">-v</span> <span class="pre">-u</span>
  69. <span class="pre">github.com/asciimoo/morty</span></code>)</p></li>
  70. <li><p>Setup a systemd service unit <a class="reference external" href="https://github.com/searx/searx/blob/master/utils/templates/lib/systemd/system/morty.service">[ref]</a>
  71. (<code class="docutils literal notranslate"><span class="pre">/lib/systemd/system/morty.service</span></code>).</p></li>
  72. </ol>
  73. <div class="admonition hint">
  74. <p class="admonition-title">Hint</p>
  75. <p>To add morty to your searx instance read chapter <a class="reference internal" href="../admin/morty.html#searx-morty"><span class="std std-ref">How to setup result proxy</span></a>.</p>
  76. </div>
  77. <section id="create-user">
  78. <h2>Create user<a class="headerlink" href="#create-user" title="Permalink to this heading">¶</a></h2>
  79. <div class="sphinx-tabs docutils container">
  80. <div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-0-YmFzaA==" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-0-YmFzaA==" name="YmFzaA==" role="tab" tabindex="0">bash</button></div><div aria-labelledby="tab-0-YmFzaA==" class="sphinx-tabs-panel group-tab" id="panel-0-YmFzaA==" name="YmFzaA==" role="tabpanel" tabindex="0"><div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$ sudo -H useradd --shell /bin/bash --system <span class="se">\</span>
  81. --home-dir <span class="s2">&quot;/usr/local/morty&quot;</span> <span class="se">\</span>
  82. --comment <span class="s2">&quot;Privacy-respecting metasearch engine&quot;</span> morty
  83. $ sudo -H mkdir <span class="s2">&quot;/usr/local/morty&quot;</span>
  84. $ sudo -H chown -R <span class="s2">&quot;morty:morty&quot;</span> <span class="s2">&quot;/usr/local/morty&quot;</span>
  85. </pre></div>
  86. </div>
  87. </div></div>
  88. </section>
  89. <section id="install-go">
  90. <h2>Install go<a class="headerlink" href="#install-go" title="Permalink to this heading">¶</a></h2>
  91. <div class="sphinx-tabs docutils container">
  92. <div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-1-YmFzaA==" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-1-YmFzaA==" name="YmFzaA==" role="tab" tabindex="0">bash</button></div><div aria-labelledby="tab-1-YmFzaA==" class="sphinx-tabs-panel group-tab" id="panel-1-YmFzaA==" name="YmFzaA==" role="tabpanel" tabindex="0"><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ cat &gt; <span class="s2">&quot;/usr/local/morty/.go_env&quot;</span> <span class="s">&lt;&lt;EOF</span>
  93. <span class="s">export GOPATH=/usr/local/morty/go-apps</span>
  94. <span class="s">export PATH=$PATH:/usr/local/morty/local/go/bin:$GOPATH/bin</span>
  95. <span class="s">EOF</span>
  96. $ sudo -i -u <span class="s2">&quot;morty&quot;</span>
  97. <span class="o">(</span>morty<span class="o">)</span> $ <span class="nb">echo</span> <span class="s1">&#39;source /usr/local/morty/.go_env&#39;</span> &gt;&gt; ~/.profile
  98. <span class="o">(</span>morty<span class="o">)</span> $ mkdir /usr/local/morty/local
  99. <span class="o">(</span>morty<span class="o">)</span> $ wget --progress<span class="o">=</span>bar -O <span class="s2">&quot;go1.13.5.linux-amd64.tar.gz&quot;</span> <span class="se">\</span>
  100. <span class="s2">&quot;https://dl.google.com/go/go1.13.5.linux-amd64.tar.gz&quot;</span>
  101. <span class="o">(</span>morty<span class="o">)</span> $ tar -C /usr/local/morty/local -xzf <span class="s2">&quot;go1.13.5.linux-amd64.tar.gz&quot;</span>
  102. <span class="o">(</span>morty<span class="o">)</span> $ which go
  103. /usr/local/morty/local/go/bin/go
  104. </pre></div>
  105. </div>
  106. </div></div>
  107. </section>
  108. <section id="install-morty">
  109. <h2>Install morty<a class="headerlink" href="#install-morty" title="Permalink to this heading">¶</a></h2>
  110. <p>Install morty software and systemd unit:</p>
  111. <div class="sphinx-tabs docutils container">
  112. <div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-2-YmFzaA==" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-2-YmFzaA==" name="YmFzaA==" role="tab" tabindex="0">bash</button></div><div aria-labelledby="tab-2-YmFzaA==" class="sphinx-tabs-panel group-tab" id="panel-2-YmFzaA==" name="YmFzaA==" role="tabpanel" tabindex="0"><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ sudo -i -u <span class="s2">&quot;morty&quot;</span>
  113. <span class="o">(</span>morty<span class="o">)</span> $ go get -v -u github.com/asciimoo/morty
  114. </pre></div>
  115. </div>
  116. </div></div>
  117. <div class="sphinx-tabs docutils container">
  118. <div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-3-c3lzdGVtZA==" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-3-c3lzdGVtZA==" name="c3lzdGVtZA==" role="tab" tabindex="0">systemd</button></div><div aria-labelledby="tab-3-c3lzdGVtZA==" class="sphinx-tabs-panel group-tab" id="panel-3-c3lzdGVtZA==" name="c3lzdGVtZA==" role="tabpanel" tabindex="0"><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="o">[</span>Unit<span class="o">]</span>
  119. <span class="nv">Description</span><span class="o">=</span>morty
  120. <span class="nv">After</span><span class="o">=</span>syslog.target
  121. <span class="nv">After</span><span class="o">=</span>network.target
  122. <span class="o">[</span>Service<span class="o">]</span>
  123. <span class="nv">Type</span><span class="o">=</span>simple
  124. <span class="nv">User</span><span class="o">=</span>morty
  125. <span class="nv">Group</span><span class="o">=</span>morty
  126. <span class="nv">WorkingDirectory</span><span class="o">=</span>/usr/local/morty
  127. <span class="nv">ExecStart</span><span class="o">=</span>/usr/local/morty/go-apps/bin/morty -key <span class="s1">&#39;&#39;</span> -listen <span class="s1">&#39;127.0.0.1:3000&#39;</span> -timeout <span class="m">5</span>
  128. <span class="nv">Restart</span><span class="o">=</span>always
  129. <span class="nv">Environment</span><span class="o">=</span><span class="nv">USER</span><span class="o">=</span>morty <span class="nv">HOME</span><span class="o">=</span>/usr/local/morty <span class="nv">DEBUG</span><span class="o">=</span><span class="nb">false</span>
  130. <span class="c1"># Some distributions may not support these hardening directives. If you cannot</span>
  131. <span class="c1"># start the service due to an unknown option, comment out the ones not supported</span>
  132. <span class="c1"># by your version of systemd.</span>
  133. <span class="nv">ProtectSystem</span><span class="o">=</span>full
  134. <span class="nv">PrivateDevices</span><span class="o">=</span>yes
  135. <span class="nv">PrivateTmp</span><span class="o">=</span>yes
  136. <span class="nv">NoNewPrivileges</span><span class="o">=</span><span class="nb">true</span>
  137. <span class="o">[</span>Install<span class="o">]</span>
  138. <span class="nv">WantedBy</span><span class="o">=</span>multi-user.target
  139. </pre></div>
  140. </div>
  141. </div></div>
  142. </section>
  143. <section id="overview">
  144. <span id="morty-sh-overview"></span><h2>Overview<a class="headerlink" href="#overview" title="Permalink to this heading">¶</a></h2>
  145. <p>The <code class="docutils literal notranslate"><span class="pre">--help</span></code> output of the script is largely self-explanatory
  146. (<a class="reference internal" href="index.html#toolboxing-common"><span class="std std-ref">Common commands &amp; environment</span></a>):</p>
  147. <div class="highlight-text notranslate"><div class="highlight"><pre><span></span>usage::
  148. morty.sh shell
  149. morty.sh install [all|user]
  150. morty.sh update [morty]
  151. morty.sh remove [all]
  152. morty.sh activate [service]
  153. morty.sh deactivate [service]
  154. morty.sh inspect [service]
  155. morty.sh option [debug-on|debug-off|new-key]
  156. morty.sh apache [install|remove]
  157. morty.sh nginx [install|remove]
  158. morty.sh info [searx]
  159. shell
  160. start interactive shell from user morty
  161. install / remove
  162. all: complete setup of morty service
  163. user: add/remove service user &#39;morty&#39; (/usr/local/morty)
  164. update morty
  165. Update morty installation (/usr/local/morty)
  166. activate service
  167. activate and start service daemon (systemd unit)
  168. deactivate service
  169. stop and deactivate service daemon (systemd unit)
  170. inspect service
  171. show service status and log
  172. option
  173. set one of the available options
  174. :new-key: set new morty key
  175. apache : http://fv-az163-121/morty/
  176. :install: apache site with a reverse proxy (ProxyPass)
  177. :remove: apache site morty.conf
  178. nginx (http://fv-az163-121/morty/)
  179. :install: nginx site with a reverse proxy (ProxyPass)
  180. :remove: nginx site morty.conf
  181. If needed, set the environment variables in the &#39;.config.sh&#39; file::
  182. PUBLIC_URL_MORTY: http://fv-az163-121/morty/
  183. MORTY_LISTEN: 127.0.0.1:3000
  184. SERVICE_USER: morty
  185. To activate result and image proxy in searx, edit settings.yml (read:
  186. https://searx.github.io/searx/admin/morty.html)::
  187. result_proxy:
  188. url : http://fv-az163-121/morty/
  189. server:
  190. image_proxy : True
  191. </pre></div>
  192. </div>
  193. </section>
  194. </section>
  195. <div class="clearer"></div>
  196. </div>
  197. </div>
  198. </div>
  199. <span id="sidebar-top"></span>
  200. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  201. <div class="sphinxsidebarwrapper">
  202. <p class="logo"><a href="../index.html">
  203. <img class="logo" src="../_static/searx_logo_small.png" alt="Logo"/>
  204. </a></p>
  205. <h3>Project Links</h3>
  206. <ul>
  207. <li><a href="https://searx.github.io/searx/blog/index.html">Blog</a>
  208. <li><a href="https://github.com/searx/searx">Source</a>
  209. <li><a href="https://github.com/searx/searx/wiki">Wiki</a>
  210. <li><a href="https://twitter.com/Searx_engine">Twitter</a>
  211. <li><a href="https://github.com/searx/searx/issues">Issue Tracker</a>
  212. </ul><h3>Navigation</h3>
  213. <ul>
  214. <li><a href="../index.html">Overview</a>
  215. <ul>
  216. <li><a href="index.html">Admin’s tooling box</a>
  217. <ul>
  218. <li>Previous: <a href="filtron.sh.html" title="previous chapter"><code class="docutils literal notranslate"><span class="pre">utils/filtron.sh</span></code></a>
  219. <li>Next: <a href="lxc.sh.html" title="next chapter"><code class="docutils literal notranslate"><span class="pre">utils/lxc.sh</span></code></a></ul>
  220. </li>
  221. </ul>
  222. </li>
  223. </ul>
  224. <div id="searchbox" style="display: none" role="search">
  225. <h3 id="searchlabel">Quick search</h3>
  226. <div class="searchformwrapper">
  227. <form class="search" action="../search.html" method="get">
  228. <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
  229. <input type="submit" value="Go" />
  230. </form>
  231. </div>
  232. </div>
  233. <script>document.getElementById('searchbox').style.display = "block"</script>
  234. </div>
  235. </div>
  236. <div class="clearer"></div>
  237. </div>
  238. <div class="footer" role="contentinfo">
  239. &#169; Copyright 2015-2022, Adam Tauber, Noémi Ványi.
  240. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.3.0.
  241. </div>
  242. <script src="../_static/version_warning_offset.js"></script>
  243. </body>
  244. </html>