Self-Hosting on //localhost:1313/docs/self-hosting/ Recent content in Self-Hosting on Hugo en-US Getting started //localhost:1313/docs/self-hosting/getting-started/ Mon, 01 Jan 0001 00:00:00 +0000 //localhost:1313/docs/self-hosting/getting-started/ <h2 id="get-started">Get started</h2> <p>There are two main ways to self-host mCaptcha:</p> <p>&laquo;&laquo;&laquo;&lt; Updated upstream</p> <ol> <li><a href="./bare-metal">Bare metal</a></li> <li><a href="./docker">With Docker</a></li> <li><a href="./ansible">With Ansible</a> =======</li> <li><a href="//localhost:1313/docs/self-hosting/bare-metal">Bare metal</a></li> <li><a href="//localhost:1313/docs/self-hosting/docker">With Docker</a></li> <li><a href="//localhost:1313/docs/self-hosting/ansible">With Ansible</a></li> </ol> <blockquote> <blockquote> <blockquote> <blockquote> <blockquote> <blockquote> <blockquote> <p>Stashed changes</p> </blockquote> </blockquote> </blockquote> </blockquote> </blockquote> </blockquote> </blockquote> Deploy bare metal //localhost:1313/docs/self-hosting/bare-metal/ Mon, 01 Jan 0001 00:00:00 +0000 //localhost:1313/docs/self-hosting/bare-metal/ <h2 id="1-install-database">1. Install Database</h2> <p>The following databases are supported:</p> <ol> <li>Postgres</li> <li>MariaDB</li> </ol> <p>Please install the database of your choice. Then:</p> <ol> <li>Create new database user for mCaptcha</li> <li>Create new database for mCaptcha</li> </ol> <p>mCaptcha binary has migrations baked-in and is applied on start up. The choice of database is described using the <a href="https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Web_mechanics/What_is_a_URL#scheme">scheme</a> of the database URL. For instance:</p> <ol> <li>Postgres: <code>postgres://mcaptcha:password@localhost:5432/mcaptcha</code></li> <li>Mariadb: <code>mysql://mcaptcha:password@localhost:3306/mcaptcha</code></li> </ol> <h2 id="2-optionally-install-mcaptchacache">2. Optionally, install mCaptcha/cache</h2> <p>We recommend this for larger instances. For single-user instances or for instances that protect personal websites, we recommend using the internal cache system. To do so, please comment out the <a href="https://github.com/mCaptcha/mCaptcha/blob/d4967626ee59504b32b0f85e409b4e3444ddc4f0/config/default.toml#L54"><code>redis</code></a> section of the configuration file.</p> Using Ansible //localhost:1313/docs/self-hosting/ansible/ Mon, 01 Jan 0001 00:00:00 +0000 //localhost:1313/docs/self-hosting/ansible/ <p>Ansible playbooks to install mCaptcha are available <a href="https://git.batsense.net/mCaptcha/iac">here</a>.</p> <h2 id="instructions">Instructions</h2> <h3 id="installation">Installation</h3> <ol> <li>Clone the repository:</li> </ol> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span>git clone https://git.batsense.net/mCaptcha/iac <span style="color:#ff79c6">&amp;&amp;</span> <span style="color:#8be9fd;font-style:italic">cd</span> iac </span></span></code></pre></div><ol start="2"> <li> <p>Create inventory file. You should have SSH access to the remote machine, and the user must have <code>sudo</code> privileges. Example inventory file:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-ini" data-lang="ini"><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1</span><span><span style="color:#ff79c6">[mcaptcha_hosts]</span> </span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2</span><span><span style="color:#50fa7b">&#34;mcaptcha_hosts&#34;</span> </span></span><span style="display:flex;"><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3</span><span><span style="color:#50fa7b">&lt;node name&gt; ansible_host</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&lt;node IP&gt; ansible_user=&lt;remote username&gt;</span> </span></span></code></pr Using Docker //localhost:1313/docs/self-hosting/docker/ Mon, 01 Jan 0001 00:00:00 +0000 //localhost:1313/docs/self-hosting/docker/ <h2 id="with-docker">With Docker</h2> <h3 id="1-configure">1. Configure</h3> <p>mcaptcha is highly configurable.</p> <p>Configuration is applied/merged in the following order:</p> <ol> <li>path to configuration file passed in via <code>MCAPTCHA_CONFIG</code></li> <li><code>./config/default.toml</code></li> <li><code>/etc/mcaptcha/config.toml</code></li> <li>environment variables.</li> </ol> <p>See <a href="https://github.com/mCaptcha/mCaptcha/tree/master/docs/CONFIGURATION.md">CONFIGURATION.md</a> for configurable options.</p> <h3 id="2-run-image">2. Run image</h3> <p>If you have already have a Postgres instance running, then:</p> <pre tabindex="0"><code>docker run -p &lt;host-machine-port&gt;:&lt;port-in-configuration-file&gt; \ --add-host=database:&lt;database-ip-addrss&gt; \ -e RUST_LOG=debug \ -e DATABASE_URL=&#34;postgres://&lt;db-user&gt;:&lt;db-password&gt;@database:&lt;db-port&gt;/&lt;db-name&gt;&#34; \ mcaptcha/mcaptcha:latest </code></pr