1
0
Fork 0
forked from mCaptcha/website
mcaptcha-website/docs/self-hosting/docker/index.html

254 lines
14 KiB
HTML
Raw Normal View History

<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="preload" as="font" href="/fonts/vendor/jost/jost-v4-latin-regular.woff2" type="font/woff2" crossorigin>
<link rel="preload" as="font" href="/fonts/vendor/jost/jost-v4-latin-700.woff2" type="font/woff2" crossorigin>
<link rel="stylesheet" href="/main.976507041017ac4a08ed252c5399a7c72b3b5aeae14bc23dd624cbddb3d2cb6065f6cf8ed6cd96bf5cd21c1157dee4bfdb85b488cb791a49a33af016aa3fcffd.css" integrity="sha512-l2UHBBAXrEoI7SUsU5mnxys7WurhS8I91iTL3bPSy2Bl9s&#43;O1s2Wv1zSHBFX3uS/24W0iMt5GkmjOvAWqj/P/Q==" crossorigin="anonymous">
<noscript><style>img.lazyload { display: none; }</style></noscript>
<meta name="robots" content="index, follow">
<meta name="googlebot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1">
<meta name="bingbot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1">
<title>Using Docker - mCaptcha</title>
<meta name="description" content="Deploy mCaptcha using docker">
<link rel="canonical" href="/docs/self-hosting/docker/">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="/icon.png">
<meta name="twitter:title" content="Using Docker">
<meta name="twitter:description" content="Deploy mCaptcha using docker">
<meta name="twitter:site" content="@">
<meta name="twitter:creator" content="@">
<meta property="og:title" content="Using Docker">
<meta property="og:description" content="Deploy mCaptcha using docker">
<meta property="og:type" content="article">
<meta property="og:url" content="/docs/self-hosting/docker/">
<meta property="og:image" content="/icon.png"/>
<meta property="article:modified_time" content="2023-10-27T21:39:40+05:30">
<meta property="og:site_name" content="mCaptcha">
<meta property="article:publisher" content="https://www.facebook.com/">
<meta property="article:author" content="https://www.facebook.com/">
<meta property="og:locale" content="en_US">
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [{
"@type": "ListItem",
"position": 1 ,
"name": "Home",
"item": "\/"
},{
"@type": "ListItem",
"position": 2 ,
"name": "Docsself Hostingdocker",
"item": "\/docsself-hostingdocker\/"
}]
}
</script>
<meta name="theme-color" content="#fff">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
</head>
<body class="docs single">
<div class="header-bar fixed-top"></div>
<header class="navbar fixed-top navbar-expand-md navbar-light">
<div class="container">
<input class="menu-btn order-0" type="checkbox" id="menu-btn">
<label class="menu-icon d-md-none" for="menu-btn"><span class="navicon"></span></label>
<a class="navbar-brand order-1 order-md-0 me-auto" href="/">mCaptcha</a>
<button id="mode" class="btn btn-link order-2 order-md-4" type="button" aria-label="Toggle mode">
<span class="toggle-dark"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-moon"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg></span>
<span class="toggle-light"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-sun"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg></span>
</button>
<ul class="navbar-nav social-nav order-3 order-md-5">
<li class="nav-item">
<a class="nav-link" href="https://github.com/mCaptcha"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-github"><path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path></svg><span class="ms-2 visually-hidden">GitHub</span></a>
</li>
</ul>
<div class="collapse navbar-collapse order-4 order-md-1">
<ul class="navbar-nav main-nav me-auto order-5 order-md-2"><li class="nav-item">
<a class="nav-link" href="/blog/">Blog</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/community/">Community</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/contact/">Contact</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/about/">About</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="/docs/webmasters/installing-captcha/">Docs</a>
</li>
</ul>
<div class="break order-6 d-md-none"></div>
<form class="navbar-form flex-grow-1 order-7 order-md-3">
<input id="userinput" class="form-control is-search" type="search" placeholder="Search docs..." aria-label="Search docs..." autocomplete="off">
<div id="suggestions" class="shadow bg-white rounded"></div>
</form>
</div>
</div>
</header>
<div class="wrap container" role="document">
<div class="content">
<div class="row flex-xl-nowrap">
<div class="col-lg-5 col-xl-4 docs-sidebar">
<nav class="docs-links" aria-label="Main navigation">
<h3>Webmasters</h3>
<ul class="list-unstyled">
<li><a class="docs-link" href="/docs/webmasters/installing-captcha/">Installing mCaptcha on your website</a></li>
<li><a class="docs-link" href="/docs/webmasters/configuring-difficulty-factor/">Configuring Difficulty Factor</a></li>
<li><a class="docs-link" href="/docs/webmasters/terminology/">Terminology</a></li>
<li><a class="docs-link" href="/docs/webmasters/faq/">Webmasters FAQ</a></li>
</ul>
<h3>Self-Hosting</h3>
<ul class="list-unstyled">
<li><a class="docs-link" href="/docs/self-hosting/getting-started/">Getting started</a></li>
<li><a class="docs-link" href="/docs/self-hosting/bare-metal/">Deploy bare metal</a></li>
<li><a class="docs-link active" href="/docs/self-hosting/docker/">Using Docker</a></li>
<li><a class="docs-link" href="/docs/self-hosting/dependencies/">Database and cache</a></li>
</ul>
<h3>API</h3>
<ul class="list-unstyled">
<li><a class="docs-link" href="/docs/api/browser/">Browser libraries</a></li>
<li><a class="docs-link" href="/docs/api/mcaptcha-system/">mCaptcha System Library</a></li>
<li><a class="docs-link" href="/docs/api/pow-sha256/">pow_sha256</a></li>
</ul>
<h3>Help</h3>
<ul class="list-unstyled">
<li><a class="docs-link" href="/docs/help/troubleshooting/">Troubleshooting</a></li>
<li><a class="docs-link" href="/docs/help/faq/">FAQ</a></li>
</ul>
</nav>
</div>
<nav class="docs-toc d-none d-xl-block col-xl-3" aria-label="Secondary navigation">
<div class="page-links">
<h3>On this page</h3>
<nav id="TableOfContents">
<ul>
<li><a href="#with-docker">With Docker</a>
<ul>
<li><a href="#1-configure">1. Configure</a></li>
<li><a href="#2-run-image">2. Run image</a></li>
</ul>
</li>
<li><a href="#with-docker-compose">With docker-compose</a></li>
</ul>
</nav>
</div>
</nav>
<main class="docs-content col-lg-11 col-xl-9">
<h1>Using Docker</h1>
<p class="lead"></p>
<h2 id="with-docker">With Docker<a href="#with-docker" class="anchor" aria-hidden="true">#</a> </h2>
<h3 id="1-configure">1. Configure<a href="#1-configure" class="anchor" aria-hidden="true">#</a> </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<a href="#2-run-image" class="anchor" aria-hidden="true">#</a> </h3>
<p>If you have already have a Postgres instance running, then:</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-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>docker run -p &lt;host-machine-port&gt;:&lt;port-in-configuration-file&gt; <span style="color:#f1fa8c">\
</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:#f1fa8c"></span> --add-host<span style="color:#ff79c6">=</span>database:&lt;database-ip-addrss&gt; <span style="color:#f1fa8c">\
</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:#f1fa8c"></span> -e <span style="color:#8be9fd;font-style:italic">RUST_LOG</span><span style="color:#ff79c6">=</span>debug <span style="color:#f1fa8c">\
</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">4</span><span><span style="color:#f1fa8c"></span> -e <span style="color:#8be9fd;font-style:italic">DATABASE_URL</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;postgres://&lt;db-user&gt;:&lt;db-password&gt;@database:&lt;db-port&gt;/&lt;db-name&gt;&#34;</span> <span style="color:#f1fa8c">\
</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">5</span><span><span style="color:#f1fa8c"></span> mcaptcha/mcaptcha:latest
</span></span></code></pre></div><p>If you don&rsquo;t have a Postgres instance running, you can either install
2023-02-13 16:52:49 +05:30
one using a package manager or launch one with docker. A <a href="'../docker-compose.yml">docker-compose
configuration</a> is available that will launch both
a database instance mcaptcha instance.</p>
<h2 id="with-docker-compose">With docker-compose<a href="#with-docker-compose" class="anchor" aria-hidden="true">#</a> </h2>
<ol>
<li>
<p>Follow steps above to build docker image.</p>
</li>
<li>
<p>Set database password <a href="'../docker-compose.yml">docker-compose configuration</a>.</p>
</li>
<li>
<p>Launch network</p>
</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>docker-compose up -d
</span></span></code></pre></div>
<p class="edit-page"><a href="https://git.batsense.net/mCaptcha/website/blob/master/content/docs/self-hosting/docker.md"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit-2"><path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path></svg>Edit this page on git.batsense.net</a></p>
<div class="docs-navigation d-flex justify-content-between">
<a href="/docs/self-hosting/bare-metal/">
<div class="card my-1">
<div class="card-body py-2">
&larr; Deploy bare metal
</div>
</div>
</a>
<a class="ms-auto" href="/docs/self-hosting/dependencies/">
<div class="card my-1">
<div class="card-body py-2">
Database and cache &rarr;
</div>
</div>
</a>
</div>
</main>
</div>
</div>
</div>
<footer class="footer text-muted">
<div class="container">
<div class="row">
<div class="col-lg-8 order-last order-lg-first">
<ul class="list-inline">
<li class="list-inline-item">Powered by <a href="https://gohugo.io/">Hugo</a>, and <a href="https://getdoks.org/">Doks</a></li>
</ul>
</div>
<div class="col-lg-8 order-first order-lg-last text-lg-end">
<ul class="list-inline">
<li class="list-inline-item"><a href="/about/">About</a></li>
<li class="list-inline-item"><a href="/donate">Donate</a></li>
<li class="list-inline-item"><a href="/privacy-policy/">Privacy</a></li>
<li class="list-inline-item"><a href="/security">Security</a></li>
<li class="list-inline-item"><a href="https://stats.uptimerobot.com/GK7VLFJnBl">Status</a></li>
<li class="list-inline-item"><a href="/thanks">Thanks</a></li>
</ul>
</div>
</div>
</div>
</footer>
<script src="/main.min.bc2465e4e1abda257c622bf89b85235da437778b3e3f80e01762312382cc27d4e50a8a4de22e464dc82e3a61039da8aef9d6d5e62b76711fa93d9663860b1926.js" integrity="sha512-vCRl5OGr2iV8Yiv4m4UjXaQ3d4s&#43;P4DgF2IxI4LMJ9TlCopN4i5GTcguOmEDnaiu&#43;dbV5it2cR&#43;pPZZjhgsZJg==" crossorigin="anonymous" defer></script>
<script src="/index.min.3815062368a85ddb58786a06fadf790751079a4737b79f370db1cf2044c2451d2de7aa39343d73dab0c02899036427f327ddec61ad33c2cebafc3e4e1e8a64dc.js" integrity="sha512-OBUGI2ioXdtYeGoG&#43;t95B1EHmkc3t583DbHPIETCRR0t56o5ND1z2rDAKJkDZCfzJ93sYa0zws66/D5OHopk3A==" crossorigin="anonymous" defer></script>
</body>
</html>