extend docs/dynamic_cacheing_nginx_reverse_proxy_for_pacman.md

This commit is contained in:
Trent Palmer 2017-07-24 03:16:39 -07:00
parent c7b05df1c2
commit 27b6330edd
5 changed files with 53 additions and 30 deletions

View File

@ -41,7 +41,7 @@ You can start with a default `/etc/nginx/nginx.conf`,
and add the line `include sites-enabled/*;`
at the end of the *http* section.
```text
```nginx
# /etc/nginx/nginx.conf
#user html;
worker_processes 1;
@ -181,12 +181,12 @@ ip address instead, then that should match what you write in your mirrorlist.
And of course your mirrorlist entry
on the client machine, has to preserve the directory scheme.
```text
```conf
# /etc/pacman.d/mirrorlist
Server = http://<hostname or ip address>:<port if not 80>/archlinux/$repo/os/$arch
```
```text
```nginx
# /etc/nginx/sites-enabled/proxy_cache.conf
# nginx may need to resolve domain names at run time
resolver 8.8.8.8 8.8.4.4;
@ -282,7 +282,7 @@ systemctl enable/start /etc/systemd/system/proxy_cache_clean.timer
Keeps the 2 most recent versions of each package using paccache command.
```text
```conf
# /etc/systemd/system/proxy_cache_clean.service
[Unit]
Description=Clean The pacman proxy cache
@ -296,7 +296,7 @@ StandardError=syslog
## systemd timer for the systemd service that cleans the proxy cache
```text
```conf
# /etc/systemd/system/proxy_cache_clean.timer
[Unit]
Description=Timer for clean The pacman proxy cache
@ -323,7 +323,7 @@ the database files, then you'll just be stuck with old database files, unless
you periodically delete them. But I'm not sure about all this, will keep an
eye on things.
```text
```conf
# /etc/systemd/system/proxy_cache_database_clean.service
[Unit]
Description=Clean The pacman proxy cache database
@ -337,7 +337,7 @@ StandardError=syslog
## systemd timer for the systemd service that deletes the pacman database files from the proxy cache
```text
```conf
# /etc/systemd/system/proxy_cache_database_clean.timer
[Unit]
Description=Timer for clean The pacman proxy cache database
@ -350,3 +350,12 @@ Unit=proxy_cache_database_clean.service
[Install]
WantedBy=timers.target
```
## If you prefer cron because the server is actually an ubuntu:16.04 LXD container
Make sure single quote in the command here.
```cron
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
5,20,35,50 * * * * /bin/bash -c 'for f in $(find /var/www/html/pacman-cache -name *db) ; do rm $f; done'
```

View File

@ -108,6 +108,8 @@
<li><a class="toctree-l3" href="#systemd-timer-for-the-systemd-service-that-deletes-the-pacman-database-files-from-the-proxy-cache">systemd timer for the systemd service that deletes the pacman database files from the proxy cache</a></li>
<li><a class="toctree-l3" href="#if-you-prefer-cron-because-the-server-is-actually-an-ubuntu1604-lxd-container">If you prefer cron because the server is actually an ubuntu:16.04 LXD container</a></li>
</ul>
@ -203,7 +205,7 @@ working as of July 2017 with a fresh install of nginx.</p>
<p>You can start with a default <code>/etc/nginx/nginx.conf</code>,
and add the line <code>include sites-enabled/*;</code>
at the end of the <em>http</em> section.</p>
<pre><code class="text"># /etc/nginx/nginx.conf
<pre><code class="nginx"># /etc/nginx/nginx.conf
#user html;
worker_processes 1;
@ -337,11 +339,11 @@ have to assign static ip addresses and explicitly write the local
ip address instead, then that should match what you write in your mirrorlist.</p>
<p>And of course your mirrorlist entry
on the client machine, has to preserve the directory scheme.</p>
<pre><code class="text"># /etc/pacman.d/mirrorlist
<pre><code class="conf"># /etc/pacman.d/mirrorlist
Server = http://&lt;hostname or ip address&gt;:&lt;port if not 80&gt;/archlinux/$repo/os/$arch
</code></pre>
<pre><code class="text"># /etc/nginx/sites-enabled/proxy_cache.conf
<pre><code class="nginx"># /etc/nginx/sites-enabled/proxy_cache.conf
# nginx may need to resolve domain names at run time
resolver 8.8.8.8 8.8.4.4;
@ -432,7 +434,7 @@ server
</code></pre>
<p>Keeps the 2 most recent versions of each package using paccache command.</p>
<pre><code class="text"># /etc/systemd/system/proxy_cache_clean.service
<pre><code class="conf"># /etc/systemd/system/proxy_cache_clean.service
[Unit]
Description=Clean The pacman proxy cache
@ -444,7 +446,7 @@ StandardError=syslog
</code></pre>
<h2 id="systemd-timer-for-the-systemd-service-that-cleans-the-proxy-cache">systemd timer for the systemd service that cleans the proxy cache</h2>
<pre><code class="text"># /etc/systemd/system/proxy_cache_clean.timer
<pre><code class="conf"># /etc/systemd/system/proxy_cache_clean.timer
[Unit]
Description=Timer for clean The pacman proxy cache
@ -466,7 +468,7 @@ WantedBy=timers.target
the database files, then you'll just be stuck with old database files, unless
you periodically delete them. But I'm not sure about all this, will keep an
eye on things.</p>
<pre><code class="text"># /etc/systemd/system/proxy_cache_database_clean.service
<pre><code class="conf"># /etc/systemd/system/proxy_cache_database_clean.service
[Unit]
Description=Clean The pacman proxy cache database
@ -478,7 +480,7 @@ StandardError=syslog
</code></pre>
<h2 id="systemd-timer-for-the-systemd-service-that-deletes-the-pacman-database-files-from-the-proxy-cache">systemd timer for the systemd service that deletes the pacman database files from the proxy cache</h2>
<pre><code class="text"># /etc/systemd/system/proxy_cache_database_clean.timer
<pre><code class="conf"># /etc/systemd/system/proxy_cache_database_clean.timer
[Unit]
Description=Timer for clean The pacman proxy cache database
@ -489,6 +491,13 @@ Unit=proxy_cache_database_clean.service
[Install]
WantedBy=timers.target
</code></pre>
<h2 id="if-you-prefer-cron-because-the-server-is-actually-an-ubuntu1604-lxd-container">If you prefer cron because the server is actually an ubuntu:16.04 LXD container</h2>
<p>Make sure single quote in the command here.</p>
<pre><code class="cron">#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
5,20,35,50 * * * * /bin/bash -c 'for f in $(find /var/www/html/pacman-cache -name *db) ; do rm $f; done'
</code></pre>
</div>

View File

@ -228,5 +228,5 @@
<!--
MkDocs version : 0.16.3
Build Date UTC : 2017-07-24 06:45:41
Build Date UTC : 2017-07-24 10:16:29
-->

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
<url>
<loc>/</loc>
<lastmod>2017-07-23</lastmod>
<lastmod>2017-07-24</lastmod>
<changefreq>daily</changefreq>
</url>
@ -12,7 +12,7 @@
<url>
<loc>/apt_pinning_artful_aardvark_packages_in_xenial_xerus/</loc>
<lastmod>2017-07-23</lastmod>
<lastmod>2017-07-24</lastmod>
<changefreq>daily</changefreq>
</url>
@ -20,7 +20,7 @@
<url>
<loc>/lxd_container_home_server_networking_for_dummies/</loc>
<lastmod>2017-07-23</lastmod>
<lastmod>2017-07-24</lastmod>
<changefreq>daily</changefreq>
</url>
@ -28,7 +28,7 @@
<url>
<loc>/how_to_reassign_a_static_ip_address_with_dnsmasq/</loc>
<lastmod>2017-07-23</lastmod>
<lastmod>2017-07-24</lastmod>
<changefreq>daily</changefreq>
</url>
@ -36,7 +36,7 @@
<url>
<loc>/serve_and_share_apps_from_your_phone_with_fdroid/</loc>
<lastmod>2017-07-23</lastmod>
<lastmod>2017-07-24</lastmod>
<changefreq>daily</changefreq>
</url>
@ -44,7 +44,7 @@
<url>
<loc>/nspawn/</loc>
<lastmod>2017-07-23</lastmod>
<lastmod>2017-07-24</lastmod>
<changefreq>daily</changefreq>
</url>
@ -52,7 +52,7 @@
<url>
<loc>/mastodon_on_arch/</loc>
<lastmod>2017-07-23</lastmod>
<lastmod>2017-07-24</lastmod>
<changefreq>daily</changefreq>
</url>
@ -60,7 +60,7 @@
<url>
<loc>/debian_nspawn_container_on_arch_for_testing_apache_configurations/</loc>
<lastmod>2017-07-23</lastmod>
<lastmod>2017-07-24</lastmod>
<changefreq>daily</changefreq>
</url>
@ -68,7 +68,7 @@
<url>
<loc>/dynamic_cacheing_nginx_reverse_proxy_for_pacman/</loc>
<lastmod>2017-07-23</lastmod>
<lastmod>2017-07-24</lastmod>
<changefreq>daily</changefreq>
</url>
@ -76,7 +76,7 @@
<url>
<loc>/freebsd_jails_on_freenas/</loc>
<lastmod>2017-07-23</lastmod>
<lastmod>2017-07-24</lastmod>
<changefreq>daily</changefreq>
</url>
@ -84,7 +84,7 @@
<url>
<loc>/arch_redis_nspawn/</loc>
<lastmod>2017-07-23</lastmod>
<lastmod>2017-07-24</lastmod>
<changefreq>daily</changefreq>
</url>
@ -92,7 +92,7 @@
<url>
<loc>/arch_postgresql_nspawn/</loc>
<lastmod>2017-07-23</lastmod>
<lastmod>2017-07-24</lastmod>
<changefreq>daily</changefreq>
</url>
@ -100,7 +100,7 @@
<url>
<loc>/misc_tips_troubleshooting/</loc>
<lastmod>2017-07-23</lastmod>
<lastmod>2017-07-24</lastmod>
<changefreq>daily</changefreq>
</url>
@ -108,7 +108,7 @@
<url>
<loc>/self_signed_certs/</loc>
<lastmod>2017-07-23</lastmod>
<lastmod>2017-07-24</lastmod>
<changefreq>daily</changefreq>
</url>