8000 added missing files for the latest draft · Sengorius/sengorius.github.io@89e2e5a · GitHub
[go: up one dir, main page]

Skip to content

Commit 89e2e5a

Browse files
author
Sengorius
committed
added missing files for the latest draft
1 parent e763d4f commit 89e2e5a

File tree

5 files changed

+980
-0
lines changed

5 files changed

+980
-0
lines changed
Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
<!DOCTYPE html>
2+
<html class="writer-html5" lang="en" >
3+
<head>
4+
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
5+
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>DockerExec &mdash; 1.0.0 documentation</title>
8+
<link rel="stylesheet" href="../../static/pygments.css" type="text/css" />
9+
<link rel="stylesheet" href="../../static/css/theme.css" type="text/css" />
10+
<link rel="stylesheet" href="../../static/additional.css" type="text/css" />
11+
<link rel="shortcut icon" href="../../static/favicon.ico"/>
12+
<!--[if lt IE 9]>
13+
<script src="../../static/js/html5shiv.min.js"></script>
14+
<![endif]-->
15+
16+
<script data-url_root="../../" id="documentation_options" src="../../static/documentation_options.js"></script>
17+
<script src="../../static/jquery.js"></script>
18+
<script src="../../static/underscore.js"></script>
19+
<script src="../../static/doctools.js"></script>
20+
<script src="../../static/js/theme.js"></script>
21+
<link rel="index" title="Index" href="../../genindex.html" />
22+
<link rel="search" title="Search" href="../../search.html" />
23+
<link rel="next" title="E-Mail Catching" href="mailcatching.html" />
24+
<link rel="prev" title="Installation &amp; Update" href="install.html" />
25+
</head>
26+
27+
<body class="wy-body-for-nav">
28+
<div class="wy-grid-for-nav">
29+
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
30+
<div class="wy-side-scroll">
31+
<div class="wy-side-nav-search" >
32+
<a href="../../index.html" class="icon icon-home">
33+
<img src="../../static/cogs_v3_256.png" class="logo" alt="Logo"/>
34+
</a>
35+
<div role="search">
36+
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
37+
<input type="text" name="q" placeholder="Search docs" />
38+
<input type="hidden" name="check_keywords" value="yes" />
39+
<input type="hidden" name="area" value="default" />
40+
</form>
41+
</div>
42+
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
43+
<ul class="current">
44+
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Docker-Proxy-Stack</a><ul class="current">
45+
<li class="toctree-l2"><a class="reference internal" href="install.html">Installation &amp; Update</a></li>
46+
<li class="toctree-l2 current"><a class="current reference internal" href="#">DockerExec</a><ul>
47+
<li class="toctree-l3"><a class="reference internal" href="#advantages">Advantages</a></li>
48+
<li class="toctree-l3"><a class="reference internal" href="#how-to-use-dockerexec">How to use DockerExec?</a></li>
49+
<li class="toctree-l3"><a class="reference internal" href="#limitations-of-dockerexec">Limitations of DockerExec</a></li>
50+
<li class="toctree-l3"><a class="reference internal" href="#spawn-global-network-containers">Spawn global network containers</a></li>
51+
<li class="toctree-l3"><a class="reference internal" href="#a-minimal-configuration-for-php">A Minimal Configuration for PHP</a></li>
52+
</ul>
53+
</li>
54+
<li class="toctree-l2"><a class="reference internal" href="mailcatching.html">E-Mail Catching</a></li>
55+
<li class="toctree-l2"><a class="reference internal" href="upgrade-v2.html">Docker-Proxy-Stack Upgrade instructions</a></li>
56+
<li class="toctree-l2"><a class="reference internal" href="index.html#what-is-the-docker-proxy-stack">What is the Docker-Proxy-Stack?</a></li>
57+
<li class="toctree-l2"><a class="reference internal" href="index.html#how-does-the-proxy-stack-work">How does the Proxy-Stack work?</a></li>
58+
<li class="toctree-l2"><a class="reference internal" href="index.html#how-to-add-projects-to-the-docker-proxy-network">How to add Projects to the Docker Proxy Network</a></li>
59+
</ul>
60+
</li>
61+
<li class="toctree-l1"><a class="reference internal" href="../simple-rest/index.html">Simple REST Bundle</a></li>
62+
</ul>
63+
64+
</div>
65+
</div>
66+
</nav>
67+
68+
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
69+
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
70+
<a href="../../index.html"></a>
71+
</nav>
72+
73+
<div class="wy-nav-content">
74+
<div class="rst-content">
75+
<div role="navigation" aria-label="Page navigation">
76+
<ul class="wy-breadcrumbs">
77+
<li><a href="../../index.html" class="icon icon-home"></a> &raquo;</li>
78+
<li><a href="index.html">Docker-Proxy-Stack</a> &raquo;</li>
79+
<li>DockerExec</li>
80+
<li class="wy-breadcrumbs-aside">
81+
</li>
82+
</ul>
83+
<hr/>
84+
</div>
85+
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
86+
<div itemprop="articleBody">
87+
88+
<section id="dockerexec">
89+
<span id="docs-docker-proxy-dockerexec"></span><h1>DockerExec<a class="headerlink" href="#dockerexec" title="Permalink to this headline"></a></h1>
90+
<p>To simplify most of the aforementioned tasks and add additional functionality for usual interactions with the
91+
Docker-Proxy-Stack, we provice the Bash script <code class="docutils literal notranslate"><span class="pre">DockerExec</span></code>.</p>
92+
<section id="advantages">
93+
<h2>Advantages<a class="headerlink" href="#advantages" title="Permalink to this headline"></a></h2>
94+
<ol class="arabic simple">
95+
<li><p>Concise commands for Docker and Docker-Compose.</p></li>
96+
<li><p>Perform additional tasks like stopping all local Docker containers or remove old image layers.</p></li>
97+
<li><p>Update local <code class="docutils literal notranslate"><span class="pre">/etc/hosts</span></code> automatically.</p></li>
98+
<li><p>Synchronize the containers <code class="docutils literal notranslate"><span class="pre">/etc/hosts</span></code> files automatically.</p></li>
99+
<li><p>Starting up a project will print the projects domain to your command line.</p></li>
100+
<li><p>Helps with “spawning” new global containers for the network.</p></li>
101+
</ol>
102+
</section>
103+
<section id="how-to-use-dockerexec">
104+
<h2>How to use DockerExec?<a class="headerlink" href="#how-to-use-dockerexec" title="Permalink to this headline"></a></h2>
105+
<ol class="arabic simple">
106+
<li><p>Try and follow <code class="docutils literal notranslate"><span class="pre">DockerExec</span> <span class="pre">help</span></code> for a list of commands.</p></li>
107+
</ol>
108+
</section>
109+
<section id="limitations-of-dockerexec">
110+
<h2>Limitations of DockerExec<a class="headerlink" href="#limitations-of-dockerexec" title="Permalink to this headline"></a></h2>
111+
<p>At this point some variables and configuration are hard coded and have to be set manually for a new project.
112+
You also need Bash. <code class="docutils literal notranslate"><span class="pre">/bin/sh</span></code> will not suffice.</p>
113+
<ol class="arabic simple">
114+
<li><p>Your projects Docker-Compose file has to have the name <code class="docutils literal notranslate"><span class="pre">docker-compose.proxy.y(a)ml</span></code>.</p>
115+
<ul class="simple">
116+
<li><p>Depending on your environment there can also be a <code class="docutils literal notranslate"><span class="pre">docker-compose.prod.y(a)ml</span></code> or for a single Compose file
117+
<code class="docutils literal notranslate"><span class="pre">docker-compose.y(a)ml</span></code>. These are not suited for local dev environments.</p></li>
118+
</ul>
119+
</li>
120+
<li><p>You have to provide a <code class="docutils literal notranslate"><span class="pre">.env</span></code> file in your project root to set necessary variables. A best practice would be to
121+
have a version-controlled <code class="docutils literal notranslate"><span class="pre">.env.template</span></code> which you copy over to <code class="docutils literal notranslate"><span class="pre">.env</span></code> and customize on deployment.</p></li>
122+
</ol>
123+
</section>
124+
<section id="spawn-global-network-containers">
125+
<span id="docs-docker-proxy-spawn-instructions"></span><h2>Spawn global network containers<a class="headerlink" href="#spawn-global-network-containers" title="Permalink to this headline"></a></h2>
126+
<p>Having the Docker-Proxy-Stack installed, you are still missing services. With its new configuration in v2, the only
127+
container that is ensured on every init is the NGINX proxy, which will allow the basics. If you like to start a MySQL
128+
database with your stack, you have to “spawn” and enable this container first. To do that, the
129+
<code class="docutils literal notranslate"><span class="pre">DockerExec</span> <span class="pre">spawn</span> <span class="pre">create</span></code> should be prefered.</p>
130+
<p>This command will ask you the mandatory question for any container that will be started on init. Just pass a name and
131+
the docker image to do so, e.g. “mysql5” and “mysql:5.7”. By telling the process to enable the container, a soft link
132+
will be created for you. Then hit <code class="docutils literal notranslate"><span class="pre">DockerExec</span> <span class="pre">proxy</span> <span class="pre">init</span></code> to see the result.</p>
133+
<p>As the example above, any service container can be added to the stack. Try more databases like PostgreSQL, add a Redis
134+
or dev tools like the Adminer. You could also add <a class="reference external" href="https://github.com/mcuadros/ofelia">Ofelia</a> for cron jobs or
135+
<a class="reference external" href="https://hub.docker.com/r/collabora/code">Collabora</a> for editing office files. Whatever fits your needs.</p>
136+
<p>If you need to configured the basic start of a container, e.g. with command parameters, volumes or environment
137+
variables, just head to the Docker-Proxy-Stack installation directory, open the spawned container behind
138+
<code class="docutils literal notranslate"><span class="pre">spawns-available/{container-name}</span></code> with an editor and change the file until it matches your setup. Don’t forget to
139+
restart the stack.</p>
140+
<p>As the <code class="docutils literal notranslate"><span class="pre">DockerExec</span> <span class="pre">proxy</span> <span class="pre">init</span></code> will only start the containers within the <code class="docutils literal notranslate"><span class="pre">path/to/Docker-Proxy/spawns-enabled</span></code>
141+
directory, you can use the <code class="docutils literal notranslate"><span class="pre">DockerExec</span> <span class="pre">spawn</span> <span class="pre">enabled/disable</span> <span class="pre">{filename}</span></code> command, to link those necessary files. Keep
142+
in mind to restart the Proxy-Stack, so the changes can take effect.</p>
143+
</section>
144+
<section id="a-minimal-configuration-for-php">
145+
<h2>A Minimal Configuration for PHP<a class="headerlink" href="#a-minimal-configuration-for-php" title="Permalink to this headline"></a></h2>
146+
<p>Some environment variables cannot be read from the <code class="docutils literal notranslate"><span class="pre">.env</span></code> file and have to be manually added to the container under
147+
<code class="docutils literal notranslate"><span class="pre">environment</span></code>. E.g. the domain name.</p>
148+
<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="c1"># docker-compose.proxy.yml</span><span class="w"></span>
149+
<span class="nt">version</span><span class="p">:</span><span class="w"> </span><span class="s">&#39;3.5&#39;</span><span class="w"></span>
150+
151+
<span class="nt">services</span><span class="p">:</span><span class="w"></span>
152+
<span class="w"> </span><span class="nt">web</span><span class="p">:</span><span class="w"></span>
153+
<span class="w"> </span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">${WEB_IMAGE}</span><span class="w"></span>
154+
<span class="w"> </span><span class="nt">container_name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">${CON_PREFIX}-web</span><span class="w"></span>
155+
<span class="w"> </span><span class="nt">env_file</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">.env</span><span class="w"></span>
156+
<span class="w"> </span><span class="nt">volumes</span><span class="p">:</span><span class="w"></span>
157+
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">.:/var/www/html</span><span class="w"></span>
158+
<span class="w"> </span><span class="nt">expose</span><span class="p">:</span><span class="w"></span>
159+
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">80</span><span class="w"></span>
160+
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">443</span><span class="w"></span>
161+
<span class="w"> </span><span class="nt">environment</span><span class="p">:</span><span class="w"></span>
162+
<span class="w"> </span><span class="nt">VIRTUAL_HOST</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">my-project.docker.test</span><span class="w"></span>
163+
<span class="w"> </span><span class="nt">VIRTUAL_PORT</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">443</span><span class="w"></span>
164+
<span class="w"> </span><span class="nt">VIRTUAL_PROTO</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">https</span><span class="w"></span>
165+
<span class="w"> </span><span class="nt">links</span><span class="p">:</span><span class="w"></span>
166+
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">php</span><span class="w"></span>
167+
168+
<span class="w"> </span><span class="nt">php</span><span class="p">:</span><span class="w"></span>
169+
<span class="w"> </span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">${PHP_IMAGE}</span><span class="w"></span>
170+
<span class="w"> </span><span class="nt">container_name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">${CON_PREFIX}-app</span><span class="w"></span>
171+
<span class="w"> </span><span class="nt">env_file</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">.env</span><span class="w"></span>
172+
<span class="w"> </span><span class="nt">volumes</span><span class="p">:</span><span class="w"></span>
173+
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">.:/var/www/html</span><span class="w"></span>
174+
175+
<span class="nt">networks</span><span class="p">:</span><span class="w"></span>
176+
<span class="w"> </span><span class="nt">default</span><span class="p">:</span><span class="w"></span>
177+
<span class="w"> </span><span class="nt">external</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span><span class="w"></span>
178+
<span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">${NETWORK}</span><span class="w"></span>
179+
</pre></div>
180+
</div>
181+
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span># .env
182+
183+
# on a Windows machine
184+
# convert windows path to linux in docker-compose
185+
COMPOSE_CONVERT_WINDOWS_PATHS=1
186+
187+
# docker-compose configuration
188+
CON_PREFIX=project # prefix name for the running docker container
189+
PHP_IMAGE={$CONTAINER_REGISTRY}/symfony/flex/php:7.4-fpm-dev
190+
WEB_IMAGE={$CONTAINER_REGISTRY}/symfony/flex/nginx:latest
191+
NETWORK=nginx-proxy
192+
START_CONTAINER=project-app
193+
194+
### specific to your project
195+
# MySQL configuration
196+
MYSQL_HOST=proxy-db
197+
MYSQL_PORT=3306
198+
MYSQL_USER=root
199+
MYSQL_DATABASE=my_project_db
200+
MYSQL_ROOT_PASSWORD=root
201+
202+
# or PostgreSQL configuration
203+
POSTGRES_HOST=proxy-pg
204+
POSTGRES_PORT=5432
205+
POSTGRES_USER=root
206+
POSTGRES_DB=my_project_db
207+
POSTGRES_PASSWORD=root
208+
</pre></div>
209+
</div>
210+
<p>These files can be created within any current directory with the <code class="docutils literal notranslate"><span class="pre">DockerExec</span> <span class="pre">proxy</span> <span class="pre">generate</span> <span class="pre">${project-name}</span></code> command.
211+
See <code class="docutils literal notranslate"><span class="pre">DockerExec</span> <span class="pre">help</span></code> for better usage info.</p>
212+
<p>Use the <code class="docutils literal notranslate"><span class="pre">START_CONTAINER</span></code> variable to define the container, that will be allocated with <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">exec</span> <span class="pre">-it</span></code> at the
213+
end of a <code class="docutils literal notranslate"><span class="pre">DockerExec</span> <span class="pre">(dev|prod|proxy)</span> <span class="pre">start</span></code> command. If <code class="docutils literal notranslate"><span class="pre">START_CONTAINER=none</span></code> is set, the <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">exec</span></code> will be
214+
omitted. If not defined, it falls back to search for the first container with <code class="docutils literal notranslate"><span class="pre">-app</span></code> suffix.</p>
215+
</section>
216+
</section>
217+
218+
219+
</div>
220+
</div>
221+
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
222+
<a href="install.html" class="btn btn-neutral float-left" title="Installation &amp; Update" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
223+
<a href="mailcatching.html" class="btn btn-neutral float-right" title="E-Mail Catching" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
224+
</div>
225+
226+
<hr/>
227+
228+
<div role="contentinfo">
229+
<p>&#169; Copyright 2022, Sengorius.</p>
230+
</div>
231+
232+
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
233+
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
234+
provided by <a href="https://readthedocs.org">Read the Docs</a>.
235+
236+
237+
</footer>
238+
</div>
239+
</div>
240+
</section>
241+
</div>
242+
<script>
243+
jQuery(function () {
244+
SphinxRtdTheme.Navigation.enable(true);
245+
});
246+
</script>
247+
248+
</body>
249+
</html>

0 commit comments

Comments
 (0)
0