mirror of
https://github.com/evennia/evennia.git
synced 2026-03-18 05:46:31 +01:00
365 lines
No EOL
33 KiB
HTML
365 lines
No EOL
33 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||
|
||
<title>Installing with Docker — Evennia latest documentation</title>
|
||
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
|
||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
||
<script src="../_static/jquery.js"></script>
|
||
<script src="../_static/underscore.js"></script>
|
||
<script src="../_static/doctools.js"></script>
|
||
<script src="../_static/language_data.js"></script>
|
||
<link rel="shortcut icon" href="../_static/favicon.ico"/>
|
||
<link rel="index" title="Index" href="../genindex.html" />
|
||
<link rel="search" title="Search" href="../search.html" />
|
||
<link rel="next" title="Installation Troubleshooting" href="Installation-Troubleshooting.html" />
|
||
<link rel="prev" title="Installing with GIT" href="Installation-Git.html" />
|
||
</head><body>
|
||
|
||
|
||
|
||
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
accesskey="I">index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="Installation-Troubleshooting.html" title="Installation Troubleshooting"
|
||
accesskey="N">next</a> |</li>
|
||
<li class="right" >
|
||
<a href="Installation-Git.html" title="Installing with GIT"
|
||
accesskey="P">previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia latest</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="Setup-Overview.html" accesskey="U">Server Setup and Life</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">Installing with Docker</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="document">
|
||
|
||
<div class="documentwrapper">
|
||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||
<div class="sphinxsidebarwrapper">
|
||
<p class="logo"><a href="../index.html">
|
||
<img class="logo" src="../_static/evennia_logo.png" alt="Logo"/>
|
||
</a></p>
|
||
<div id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="../search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" />
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<script>$('#searchbox').show(0);</script>
|
||
<h3><a href="../index.html">Table of Contents</a></h3>
|
||
<ul>
|
||
<li><a class="reference internal" href="#">Installing with Docker</a><ul>
|
||
<li><a class="reference internal" href="#running-your-game-as-a-docker-image">Running your game as a docker image</a><ul>
|
||
<li><a class="reference internal" href="#start-evennia-and-run-through-docker">Start Evennia and run through docker</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#create-your-own-game-image">Create your own game image</a><ul>
|
||
<li><a class="reference internal" href="#run-container-from-your-game-image-for-development">Run container from your game image for development</a></li>
|
||
<li><a class="reference internal" href="#deploy-game-image-for-production">Deploy game image for production</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#how-it-works">How it Works</a><ul>
|
||
<li><a class="reference internal" href="#what-if-i-dont-want-latest">What if I Don’t Want “LATEST”?</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#additional-creature-comforts">Additional Creature Comforts</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
<h4>Previous topic</h4>
|
||
<p class="topless"><a href="Installation-Git.html"
|
||
title="previous chapter">Installing with GIT</a></p>
|
||
<h4>Next topic</h4>
|
||
<p class="topless"><a href="Installation-Troubleshooting.html"
|
||
title="next chapter">Installation Troubleshooting</a></p>
|
||
<div role="note" aria-label="source link">
|
||
<!--h3>This Page</h3-->
|
||
<ul class="this-page-menu">
|
||
<li><a href="../_sources/Setup/Installation-Docker.md.txt"
|
||
rel="nofollow">Show Page Source</a></li>
|
||
</ul>
|
||
</div><h3>Links</h3>
|
||
<ul>
|
||
<li><a href="https://www.evennia.com/docs/latest/index.html">Documentation Top</a> </li>
|
||
<li><a href="https://www.evennia.com">Evennia Home</a> </li>
|
||
<li><a href="https://github.com/evennia/evennia">Github</a> </li>
|
||
<li><a href="http://games.evennia.com">Game Index</a> </li>
|
||
<li>
|
||
<a href="https://discord.gg/AJJpcRUhtF">Discord</a> -
|
||
<a href="https://github.com/evennia/evennia/discussions">Discussions</a> -
|
||
<a href="https://evennia.blogspot.com/">Blog</a>
|
||
</li>
|
||
</ul>
|
||
<h3>Doc Versions</h3>
|
||
<ul>
|
||
|
||
<li><a href="Installation-Docker.html">latest (main branch)</a></li>
|
||
|
||
<li><a href="../../3.x/index.html">v3.0.0 branch (outdated)</a></li>
|
||
|
||
<li><a href="../../2.x/index.html">v2.0.0 branch (outdated)</a></li>
|
||
|
||
<li><a href="../../1.x/index.html">v1.0.0 branch (outdated)</a></li>
|
||
|
||
<li><a href="../../0.x/index.html">v0.9.5 branch (outdated)</a></li>
|
||
|
||
|
||
</ul>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="bodywrapper">
|
||
<div class="body" role="main">
|
||
|
||
<section class="tex2jax_ignore mathjax_ignore" id="installing-with-docker">
|
||
<h1>Installing with Docker<a class="headerlink" href="#installing-with-docker" title="Permalink to this headline">¶</a></h1>
|
||
<p>Evennia releases <a class="reference external" href="https://hub.docker.com/r/evennia/evennia/">docker images</a> as part of regular commits and releases. This makes running an Evennia-based game in a Docker container easy.</p>
|
||
<p>First, install the <code class="docutils literal notranslate"><span class="pre">docker</span></code> program so you can run the Evennia container. You can get it freely from <a class="reference external" href="https://www.docker.com/">docker.com</a>. Linux users can likely also get it through their normal package manager.</p>
|
||
<p>To fetch the latest evennia docker image, run:</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>docker pull evennia/evennia
|
||
</pre></div>
|
||
</div>
|
||
<p>This will get the latest stable image.</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>docker pull evennia/evennia:develop
|
||
</pre></div>
|
||
</div>
|
||
<p>gets the image based off Evennia’s unstable <code class="docutils literal notranslate"><span class="pre">develop</span></code> branch.</p>
|
||
<p>Next, <code class="docutils literal notranslate"><span class="pre">cd</span></code> to a place where your game dir is, or where you want to create it. Then run:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>docker<span class="w"> </span>run<span class="w"> </span>-it<span class="w"> </span>--rm<span class="w"> </span>-p<span class="w"> </span><span class="m">4000</span>:4000<span class="w"> </span>-p<span class="w"> </span><span class="m">4001</span>:4001<span class="w"> </span>-p<span class="w"> </span><span class="m">4002</span>:4002<span class="w"> </span>--rm<span class="w"> </span>-v<span class="w"> </span><span class="nv">$PWD</span>:/usr/src/game<span class="w"> </span>--user<span class="w"> </span><span class="nv">$UID</span>:<span class="nv">$GID</span><span class="w"> </span>evennia/evennia
|
||
</pre></div>
|
||
</div>
|
||
<p>Having run this (see next section for a description of what’s what), you will be at a prompt inside
|
||
the docker container:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>evennia<span class="p">|</span>docker<span class="w"> </span>/usr/src/game<span class="w"> </span>$
|
||
</pre></div>
|
||
</div>
|
||
<p>This is a normal shell prompt. We are in the <code class="docutils literal notranslate"><span class="pre">/usr/src/game</span></code> location inside the docker container. If you had anything in the folder you started from, you should see it here (with <code class="docutils literal notranslate"><span class="pre">ls</span></code>) since we mounted the current directory to <code class="docutils literal notranslate"><span class="pre">usr/src/game</span></code> (with <code class="docutils literal notranslate"><span class="pre">-v</span></code> above). You have the <code class="docutils literal notranslate"><span class="pre">evennia</span></code> command available and can now proceed to create a new game as per the normal <a class="reference internal" href="Installation.html"><span class="doc std std-doc">game setup</span></a> instructions (no virtualenv needed).</p>
|
||
<p>You can run Evennia from inside this container if you want to, it’s like you are root in a little
|
||
isolated Linux environment. To exit the container and all processes in there, press <code class="docutils literal notranslate"><span class="pre">Ctrl-D</span></code>. If you
|
||
created a new game folder, you will find that it has appeared on-disk.</p>
|
||
<blockquote>
|
||
<div><p>The game folder or any new files that you created from inside the container will appear as owned by <code class="docutils literal notranslate"><span class="pre">root</span></code>. If you want to edit the files outside of the container you should change the ownership. On Linux/Mac you do this with <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">chown</span> <span class="pre">myname:myname</span> <span class="pre">-R</span> <span class="pre">mygame</span></code>, where you replace <code class="docutils literal notranslate"><span class="pre">myname</span></code> with your username and <code class="docutils literal notranslate"><span class="pre">mygame</span></code> with whatever your game folder is named.</p>
|
||
</div></blockquote>
|
||
<p>Below is an explanation of the <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">run</span></code> command we used:</p>
|
||
<ul class="simple">
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">run</span> <span class="pre">...</span> <span class="pre">evennia/evennia</span></code> tells us that we want to run a new container based on the <code class="docutils literal notranslate"><span class="pre">evennia/evennia</span></code> docker image. Everything in between are options for this. The <code class="docutils literal notranslate"><span class="pre">evennia/evennia</span></code> is the name of our <a class="reference external" href="https://hub.docker.com/r/evennia/evennia/">official docker image on the dockerhub repository</a>. If you didn’t do <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">pull</span> <span class="pre">evennia/evennia</span></code> first, the image will be downloaded when running this, otherwise your already downloaded version will be used. It contains everything needed to run Evennia.</p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">-it</span></code> has to do with creating an interactive session inside the container we start.</p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">--rm</span></code> will make sure to delete the container when it shuts down. This is nice to keep things tidy
|
||
on your drive.</p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">-p</span> <span class="pre">4000:4000</span> <span class="pre">-p</span> <span class="pre">4001:4001</span> <span class="pre">-p</span> <span class="pre">4002:4002</span></code> means that we <em>map</em> ports <code class="docutils literal notranslate"><span class="pre">4000</span></code>, <code class="docutils literal notranslate"><span class="pre">4001</span></code> and <code class="docutils literal notranslate"><span class="pre">4002</span></code> from inside the docker container to same-numbered ports on our host machine. These are ports for telnet, webserver and websockets. This is what allows your Evennia server to be accessed from outside the container (such as by your MUD client)!</p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">-v</span> <span class="pre">$PWD:/usr/src/game</span></code> mounts the current directory (<em>outside</em> the container) to the path <code class="docutils literal notranslate"><span class="pre">/usr/src/game</span></code> <em>inside</em> the container. This means that when you edit that path in the container you will actually be modifying the “real” place on your hard drive. If you didn’t do this, any changes would only exist inside the container and be gone if we create a new one. Note that in linux a shortcut for the current directory is <code class="docutils literal notranslate"><span class="pre">$PWD</span></code>. If you don’t have this for your OS, you can replace it with the full path to the current on-disk directory (like <code class="docutils literal notranslate"><span class="pre">C:/Development/evennia/game</span></code> or wherever you want your evennia files to appear).</p></li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">--user</span> <span class="pre">$UID:$GID</span></code> ensures the container’s modifications to <code class="docutils literal notranslate"><span class="pre">$PWD</span></code> are done with you user and group IDs instead of root’s IDs (root is the user running evennia inside the container). This avoids having stale <code class="docutils literal notranslate"><span class="pre">.pid</span></code> files in your filesystem between container reboots which you have to force delete with <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">rm</span> <span class="pre">server/*.pid</span></code> before each boot.</p></li>
|
||
</ul>
|
||
<section id="running-your-game-as-a-docker-image">
|
||
<h2>Running your game as a docker image<a class="headerlink" href="#running-your-game-as-a-docker-image" title="Permalink to this headline">¶</a></h2>
|
||
<p>If you run the <code class="docutils literal notranslate"><span class="pre">docker</span></code> command given in the previous section from your game dir you can then easily start Evennia and have a running server without any further fuss.</p>
|
||
<p>But apart from ease of install, the primary benefit to running an Evennia-based game in a container is to simplify its deployment into a public production environment. Most cloud-based hosting
|
||
providers these days support the ability to run container-based applications. This makes deploying
|
||
or updating your game as simple as building a new container image locally, pushing it to your Docker Hub account, and then pulling from Docker Hub into your AWS/Azure/other docker-enabled hosting account. The container eliminates the need to install Python, set up a virtualenv, or run pip to install dependencies.</p>
|
||
<section id="start-evennia-and-run-through-docker">
|
||
<h3>Start Evennia and run through docker<a class="headerlink" href="#start-evennia-and-run-through-docker" title="Permalink to this headline">¶</a></h3>
|
||
<p>For remote or automated deployment you may want to start Evennia immediately as soon as the docker container comes up. If you already have a game folder with a database set up you can also start the docker container and pass commands directly to it. The command you pass will be the main process to run in the container. From your game dir, run for example this command:</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>docker run -it --rm -p 4000:4000 -p 4001:4001 -p 4002:4002 --rm -v $PWD:/usr/src/game evennia/evennia evennia start -l
|
||
</pre></div>
|
||
</div>
|
||
<p>This will start Evennia as the foreground process, echoing the log to the terminal. Closing the
|
||
terminal will kill the server. Note that you <em>must</em> use a foreground command like <code class="docutils literal notranslate"><span class="pre">evennia</span> <span class="pre">start</span> <span class="pre">-l</span></code>
|
||
or <code class="docutils literal notranslate"><span class="pre">evennia</span> <span class="pre">ipstart</span></code> to start the server - otherwise the foreground process will finish immediately
|
||
and the container go down.</p>
|
||
</section>
|
||
</section>
|
||
<section id="create-your-own-game-image">
|
||
<h2>Create your own game image<a class="headerlink" href="#create-your-own-game-image" title="Permalink to this headline">¶</a></h2>
|
||
<p>These steps assume that you have created or otherwise obtained a game directory already. First, <code class="docutils literal notranslate"><span class="pre">cd</span></code> to your game dir and create a new empty text file named <code class="docutils literal notranslate"><span class="pre">Dockerfile</span></code>. Save the following two lines into it:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">FROM</span> <span class="n">evennia</span><span class="o">/</span><span class="n">evennia</span><span class="p">:</span><span class="n">latest</span>
|
||
|
||
<span class="n">ENTRYPOINT</span> <span class="n">evennia</span> <span class="n">start</span> <span class="o">-</span><span class="n">l</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>These are instructions for building a new docker image. This one is based on the official
|
||
<code class="docutils literal notranslate"><span class="pre">evennia/evennia</span></code> image, but also makes sure to start evennia when it runs (so we don’t need to
|
||
enter it and run commands).</p>
|
||
<p>To build the image:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="w"> </span>docker<span class="w"> </span>build<span class="w"> </span>-t<span class="w"> </span>mydhaccount/mygame<span class="w"> </span>.
|
||
</pre></div>
|
||
</div>
|
||
<p>(don’t forget the period at the end, it will use the <code class="docutils literal notranslate"><span class="pre">Dockerfile</span></code> from the current location). Here <code class="docutils literal notranslate"><span class="pre">mydhaccount</span></code> is the name of your <code class="docutils literal notranslate"><span class="pre">dockerhub</span></code> account. If you don’t have a dockerhub account you can build the image locally only (name the container whatever you like in that case, like just <code class="docutils literal notranslate"><span class="pre">mygame</span></code>).</p>
|
||
<p>Docker images are stored centrally on your computer. You can see which ones you have available locally with <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">images</span></code>. Once built, you have a couple of options to run your game.</p>
|
||
<section id="run-container-from-your-game-image-for-development">
|
||
<h3>Run container from your game image for development<a class="headerlink" href="#run-container-from-your-game-image-for-development" title="Permalink to this headline">¶</a></h3>
|
||
<p>To run the container based on your game image locally for development, mount the local game directory as before:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>docker run -it --rm -p 4000:4000 -p 4001:4001 -p 4002:4002 -v $PWD:/usr/src/game --user $UID:$GID
|
||
mydhaccount/mygame
|
||
</pre></div>
|
||
</div>
|
||
<p>Evennia will start and you’ll get output in the terminal, perfect for development. You should be
|
||
able to connect to the game with your clients normally.</p>
|
||
</section>
|
||
<section id="deploy-game-image-for-production">
|
||
<h3>Deploy game image for production<a class="headerlink" href="#deploy-game-image-for-production" title="Permalink to this headline">¶</a></h3>
|
||
<p>Each time you rebuild the docker image as per the above instructions, the latest copy of your game
|
||
directory is actually copied inside the image (at <code class="docutils literal notranslate"><span class="pre">/usr/src/game/</span></code>). If you don’t mount your on-disk
|
||
folder there, the internal one will be used. So for deploying evennia on a server, omit the <code class="docutils literal notranslate"><span class="pre">-v</span></code>
|
||
option and just give the following command:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>docker run -it --rm -d -p 4000:4000 -p 4001:4001 -p 4002:4002 --user $UID:$GID mydhaccount/mygame
|
||
</pre></div>
|
||
</div>
|
||
<p>Your game will be downloaded from your docker-hub account and a new container will be built using the image and started on the server! If your server environment forces you to use different ports, you can just map the normal ports differently in the command above.</p>
|
||
<p>Above we added the <code class="docutils literal notranslate"><span class="pre">-d</span></code> option, which starts the container in <em>daemon</em> mode - you won’t see any
|
||
return in the console. You can see it running with <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">ps</span></code>:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>docker<span class="w"> </span>ps
|
||
|
||
CONTAINER<span class="w"> </span>ID<span class="w"> </span>IMAGE<span class="w"> </span>COMMAND<span class="w"> </span>CREATED<span class="w"> </span>...
|
||
f6d4ca9b2b22<span class="w"> </span>mygame<span class="w"> </span><span class="s2">"/bin/sh -c 'evenn..."</span><span class="w"> </span>About<span class="w"> </span>a<span class="w"> </span>minute<span class="w"> </span>ago<span class="w"> </span>...
|
||
</pre></div>
|
||
</div>
|
||
<p>Note the container ID, this is how you manage the container as it runs.</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="n">docker</span> <span class="n">logs</span> <span class="n">f6d4ca9b2b22</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Looks at the STDOUT output of the container (i.e. the normal server log)</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="n">docker</span> <span class="n">logs</span> <span class="o">-</span><span class="n">f</span> <span class="n">f6d4ca9b2b22</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Tail the log (so it updates to your screen ‘live’).</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="n">docker</span> <span class="n">pause</span> <span class="n">f6d4ca9b2b22</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Suspend the state of the container.</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="n">docker</span> <span class="n">unpause</span> <span class="n">f6d4ca9b2b22</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Un-suspend it again after a pause. It will pick up exactly where it were.</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="n">docker</span> <span class="n">stop</span> <span class="n">f6d4ca9b2b22</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Stop the container. To get it up again you need to use <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">run</span></code>, specifying ports etc. A new
|
||
container will get a new container id to reference.</p>
|
||
</section>
|
||
</section>
|
||
<section id="how-it-works">
|
||
<h2>How it Works<a class="headerlink" href="#how-it-works" title="Permalink to this headline">¶</a></h2>
|
||
<p>The <code class="docutils literal notranslate"><span class="pre">evennia/evennia</span></code> docker image holds the evennia library and all of its dependencies. It also has an <code class="docutils literal notranslate"><span class="pre">ONBUILD</span></code> directive which is triggered during builds of images derived from it. This <code class="docutils literal notranslate"><span class="pre">ONBUILD</span></code> directive handles setting up a volume and copying your game directory code into the proper location within the container.</p>
|
||
<p>In most cases, the Dockerfile for an Evennia-based game will only need the <code class="docutils literal notranslate"><span class="pre">FROM</span> <span class="pre">evennia/evennia:latest</span></code> directive, and optionally a <code class="docutils literal notranslate"><span class="pre">MAINTAINER</span></code> directive if you plan to publish your image on Docker Hub and would like to provide contact info.</p>
|
||
<p>For more information on Dockerfile directives, see the <a class="reference external" href="https://docs.docker.com/engine/reference/builder/">Dockerfile Reference</a>.</p>
|
||
<p>For more information on volumes and Docker containers, see the Docker site’s <a class="reference external" href="https://docs.docker.com/engine/tutorials/dockervolumes/">Manage data in
|
||
containers</a> page.</p>
|
||
<section id="what-if-i-dont-want-latest">
|
||
<h3>What if I Don’t Want “LATEST”?<a class="headerlink" href="#what-if-i-dont-want-latest" title="Permalink to this headline">¶</a></h3>
|
||
<p>A new <code class="docutils literal notranslate"><span class="pre">evennia/evennia</span></code> image is built automatically whenever there is a new commit to the <code class="docutils literal notranslate"><span class="pre">main</span></code> branch of Evennia. It is possible to create your own custom evennia base docker image based on any arbitrary commit.</p>
|
||
<ol class="simple">
|
||
<li><p>Use git tools to checkout the commit that you want to base your image upon. (In the example
|
||
below, we’re checking out commit a8oc3d5b.)</p></li>
|
||
</ol>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">checkout</span> <span class="o">-</span><span class="n">b</span> <span class="n">my</span><span class="o">-</span><span class="n">stable</span><span class="o">-</span><span class="n">branch</span> <span class="n">a8oc3d5b</span>
|
||
</pre></div>
|
||
</div>
|
||
<ol class="simple">
|
||
<li><p>Change your working directory to the <code class="docutils literal notranslate"><span class="pre">evennia</span></code> directory containing <code class="docutils literal notranslate"><span class="pre">Dockerfile</span></code>. Note that
|
||
<code class="docutils literal notranslate"><span class="pre">Dockerfile</span></code> has changed over time, so if you are going far back in the commit history you might
|
||
want to bring a copy of the latest <code class="docutils literal notranslate"><span class="pre">Dockerfile</span></code> with you and use that instead of whatever version
|
||
was used at the time.</p></li>
|
||
<li><p>Use the <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">build</span></code> command to build the image based off of the currently checked out commit.
|
||
The example below assumes your docker account is <strong>mydhaccount</strong>.</p></li>
|
||
</ol>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">docker</span> <span class="n">build</span> <span class="o">-</span><span class="n">t</span> <span class="n">mydhaccount</span><span class="o">/</span><span class="n">evennia</span> <span class="o">.</span>
|
||
</pre></div>
|
||
</div>
|
||
<ol class="simple">
|
||
<li><p>Now you have a base evennia docker image built off of a specific commit. To use this image to
|
||
build your game, you would modify <strong>FROM</strong> directive in the <strong>Dockerfile</strong> for your game directory
|
||
to be:</p></li>
|
||
</ol>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">FROM</span> <span class="n">mydhacct</span><span class="o">/</span><span class="n">evennia</span><span class="p">:</span><span class="n">latest</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Note: From this point, you can also use the <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">tag</span></code> command to set a specific tag on your image and/or upload it into Docker Hub under your account.
|
||
5. At this point, build your game using the same <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">build</span></code> command as usual. Change your
|
||
working directory to be your game directory and run</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">docker</span> <span class="n">build</span> <span class="o">-</span><span class="n">t</span> <span class="n">mydhaccountt</span><span class="o">/</span><span class="n">mygame</span> <span class="o">.</span>
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
</section>
|
||
<section id="additional-creature-comforts">
|
||
<h2>Additional Creature Comforts<a class="headerlink" href="#additional-creature-comforts" title="Permalink to this headline">¶</a></h2>
|
||
<p>The Docker ecosystem includes a tool called <code class="docutils literal notranslate"><span class="pre">docker-compose</span></code>, which can orchestrate complex multi- container applications, or in our case, store the default port and terminal parameters that we want specified every time we run our container. A sample <code class="docutils literal notranslate"><span class="pre">docker-compose.yml</span></code> file to run a containerized Evennia game in development might look like this:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">version</span><span class="p">:</span> <span class="s1">'2'</span>
|
||
|
||
<span class="n">services</span><span class="p">:</span>
|
||
<span class="n">evennia</span><span class="p">:</span>
|
||
<span class="n">image</span><span class="p">:</span> <span class="n">mydhacct</span><span class="o">/</span><span class="n">mygame</span>
|
||
<span class="n">stdin_open</span><span class="p">:</span> <span class="n">true</span>
|
||
<span class="n">tty</span><span class="p">:</span> <span class="n">true</span>
|
||
<span class="n">ports</span><span class="p">:</span>
|
||
<span class="o">-</span> <span class="s2">"4001-4002:4001-4002"</span>
|
||
<span class="o">-</span> <span class="s2">"4000:4000"</span>
|
||
<span class="n">volumes</span><span class="p">:</span>
|
||
<span class="o">-</span> <span class="o">.</span><span class="p">:</span><span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">src</span><span class="o">/</span><span class="n">game</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>With this file in the game directory next to the <code class="docutils literal notranslate"><span class="pre">Dockerfile</span></code>, starting the container is as simple as</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">docker</span><span class="o">-</span><span class="n">compose</span> <span class="n">up</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>For more information about <code class="docutils literal notranslate"><span class="pre">docker-compose</span></code>, see <a class="reference external" href="https://docs.docker.com/compose/gettingstarted/">Getting Started with docker-
|
||
compose</a>.</p>
|
||
<blockquote>
|
||
<div><p>Note that with this setup you lose the <code class="docutils literal notranslate"><span class="pre">--user</span> <span class="pre">$UID</span></code> option. The problem is that the variable <code class="docutils literal notranslate"><span class="pre">UID</span></code> is not available inside the configuration file <code class="docutils literal notranslate"><span class="pre">docker-compose.yml</span></code>. A workaround is to hardcode your user and group id. In a terminal run <code class="docutils literal notranslate"><span class="pre">echo</span>  <span class="pre">$UID:$GID</span></code> and if for example you get <code class="docutils literal notranslate"><span class="pre">1000:1000</span></code> you can add to <code class="docutils literal notranslate"><span class="pre">docker-compose.yml</span></code> a line <code class="docutils literal notranslate"><span class="pre">user:</span> <span class="pre">1000:1000</span></code> just below the <code class="docutils literal notranslate"><span class="pre">image:</span> <span class="pre">...</span></code> line.</p>
|
||
</div></blockquote>
|
||
</section>
|
||
</section>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
>index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="Installation-Troubleshooting.html" title="Installation Troubleshooting"
|
||
>next</a> |</li>
|
||
<li class="right" >
|
||
<a href="Installation-Git.html" title="Installing with GIT"
|
||
>previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia latest</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="Setup-Overview.html" >Server Setup and Life</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">Installing with Docker</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
|
||
|
||
<div class="footer" role="contentinfo">
|
||
© Copyright 2023, The Evennia developer community.
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
|
||
</div>
|
||
</body>
|
||
</html> |