extend docs/freebsd_jails_on_freenas.md, with info about gitit and supervisord

This commit is contained in:
Trent Palmer 2017-07-16 04:50:39 -07:00
parent f2d545e838
commit 7f4b6bc5c1
5 changed files with 111 additions and 12 deletions

View File

@ -127,3 +127,54 @@ For python3 virtualenv
```csh ```csh
virtualenv-3.6 <directory> virtualenv-3.6 <directory>
``` ```
## running gitit under the supervision of supervisord
py27-supervisor and hs-gitit are available as pkg install, if you want to
run a gitit wiki.
gitit doesn't come with an init service. To generate a sample config,
run `gitit --print-default-config > gitit.conf`, and then if you want
you can reference gitit.conf by passing gitit the *-f* flag.
So for instance, after you install supervisord, add something like the
following to the end of `/usr/local/etc/supervisord.conf`, and create
the directory `/var/log/supervisor/`.
```conf
[program:gitit]
user=<user>
directory=/path/to/wikidata/directory/
command=/usr/local/bin/gitit -f /usr/local/etc/gitit.conf
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
autorestart=true
```
supervisord is a service you can enable in
`/etc/rc.conf`
```conf
# /etc/rc.conf
supervisord_enable="YES"
```
and then start with `service supervisord start`
when you get supervisord running, you can start a
supervisorctl shell, i.e.
```sh
supervisorctl
supervisor> status
# outputs
gitit RUNNING pid 98057, uptime 0:32:27
supervisor> start/restart/stop gitit
supervisor> exit
```
But there is one other little detail, in that when you try to
run gitit as a daemon like this, on FreeBSD it will fail because it can't
find git. But the symlink solution is easy enough.
```csh
ln -s /usr/local/bin/git /usr/bin/
```

View File

@ -94,6 +94,8 @@
<li><a class="toctree-l3" href="#python">python</a></li> <li><a class="toctree-l3" href="#python">python</a></li>
<li><a class="toctree-l3" href="#running-gitit-under-the-supervision-of-supervisord">running gitit under the supervision of supervisord</a></li>
</ul> </ul>
@ -244,6 +246,47 @@ python.</p>
<h2 id="python">python</h2> <h2 id="python">python</h2>
<p>For python3 virtualenv</p> <p>For python3 virtualenv</p>
<pre><code class="csh">virtualenv-3.6 &lt;directory&gt; <pre><code class="csh">virtualenv-3.6 &lt;directory&gt;
</code></pre>
<h2 id="running-gitit-under-the-supervision-of-supervisord">running gitit under the supervision of supervisord</h2>
<p>py27-supervisor and hs-gitit are available as pkg install, if you want to
run a gitit wiki.</p>
<p>gitit doesn't come with an init service. To generate a sample config,
run <code>gitit --print-default-config &gt; gitit.conf</code>, and then if you want
you can reference gitit.conf by passing gitit the <em>-f</em> flag.</p>
<p>So for instance, after you install supervisord, add something like the
following to the end of <code>/usr/local/etc/supervisord.conf</code>, and create
the directory <code>/var/log/supervisor/</code>.</p>
<pre><code class="conf">[program:gitit]
user=&lt;user&gt;
directory=/path/to/wikidata/directory/
command=/usr/local/bin/gitit -f /usr/local/etc/gitit.conf
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
autorestart=true
</code></pre>
<p>supervisord is a service you can enable in
<code>/etc/rc.conf</code></p>
<pre><code class="conf"># /etc/rc.conf
supervisord_enable=&quot;YES&quot;
</code></pre>
<p>and then start with <code>service supervisord start</code>
when you get supervisord running, you can start a
supervisorctl shell, i.e.</p>
<pre><code class="sh">supervisorctl
supervisor&gt; status
# outputs
gitit RUNNING pid 98057, uptime 0:32:27
supervisor&gt; start/restart/stop gitit
supervisor&gt; exit
</code></pre>
<p>But there is one other little detail, in that when you try to
run gitit as a daemon like this, on FreeBSD it will fail because it can't
find git. But the symlink solution is easy enough.</p>
<pre><code class="csh">ln -s /usr/local/bin/git /usr/bin/
</code></pre> </code></pre>
</div> </div>

View File

@ -204,5 +204,5 @@
<!-- <!--
MkDocs version : 0.16.3 MkDocs version : 0.16.3
Build Date UTC : 2017-07-15 10:29:22 Build Date UTC : 2017-07-16 11:50:18
--> -->

View File

@ -267,7 +267,7 @@
}, },
{ {
"location": "/freebsd_jails_on_freenas/", "location": "/freebsd_jails_on_freenas/",
"text": "FreeBSD Jails on FreeNAS\n\n\nMostly a personal distillation for getting a FreeBSD\nJail up and running on FreeNAS.\n\n\nIn The FreeNAS WebGui, Create A New Jail\n\n\nThe default networking configuration, will give\nyour jail an ip address on the lan. For now, I've\ndecided to just share a pkg cache with each jail.\nNavigate to \nJails -> Storage -> Add Storage\n and\nadd the \npkg\n storage directory to \n/var/cache/pkg\n\ninside the jail. \n\n\nFor instance, on my local FreeNAS server,\nthe pkg directory is at /mnt/VolumeOne/pkg/.\n\n\nIf you ssh into the host server, you can type the command\n\njls\n, to list the jails. Based on the output of the\ncommand \njls\n, you can get a shell with \njexec <jail number>\n\nof \njexec <jail hostname>\n.\n\n\nupdating\n\n\nHow about the command \npkg audit -F\n? Downloads a\nlist of known security issues and checks your system\nagainst that.\n\n\nI would recommend, to myself anyway, to shell into\nthe new jail with \njexec\n, run \npkg upgrade\n to install any new packages,\nand then from the FreeNAS webgui, restart the jail. Although\nthe restarted jail will have a new jail number as reported by\nthe \njls\n command.\n\n\nlocale\n\n\nWhen you use \njexec\n to get a shell, you get an environment\nwith an utf_8 locale. Not so if you ssh into the new jail.\nFor this put the following contents into ~/.login_conf\n\n\n# ~/.login_conf\nme:\\\n :charset=UTF-8:\\\n :lang=en_US.UTF-8:\\\n :setenv=LC_COLLATE=C:\n\n\n\n\nssh\n\n\nTo get ssh running, edit \n/etc/rc.conf\n inside the jail.\n\n\n# /etc/rc.conf\nsshd_enable=\"YES\"\n\n\n\n\nTo start sshd immediately, make any necessary edits to\n/etc/ssh/sshd_config, and run the following command.\n\n\nservice sshd start\n\n\n\n\nByobu\n\n\nYou'll need newt to configure byobu, and if you don't install tmux\nthen screen will become the backend.\n\n\npkg install byobu tmux newt\n\n\n\n\nIf you execute \nbyobu-config\n, by pressing \nf9\n, the\nfollowing options seem to work. Some options, of course,\nwill prevent others from working so you have to enable them\none at a time to see what happens.\n\n\n\n\ndate\n\n\ndisk\n\n\ndistro\n\n\nhostname\n\n\nip address\n\n\nload_average\n\n\nlogo\n\n\ntime\n\n\nuptime\n\n\nusers\n\n\nwhoami\n\n\n\n\nvim\n\n\nVia pkg, there are two options: vim and vim-lite. Note vim will pull\nin a whole bunch of gui dependancies, but vim-lite is not build with python.\n\n\nFor instance, powerline will not work with vim-lite because it's not built with\npython. Also, vim-youcompleteme will not work with vim-lite. However, lightline\nwill work with vim-lite, and VimCompletesMe will work with vim-lite.\n\n\nTo get lightline working update $TERM\n\n\n# ~/.config/fish/config.fish\nexport TERM=xterm-256color\n\n\n\n\nAnd vimrc\n\n\n# ~/.vimrc\nset ls=2\n\n\n\n\nAnother option is to build vim from source via ports. You can prevent vim\nfrom pulling in a bunch of gui dependancies with the following in /etc/make.conf.\n\n\n# /etc/make.conf\nWITHOUT_X11=yes\n\n\n\n\nAnd then when you compile vim from ports, run \nmake config\n where you can enable\npython.\n\n\npython\n\n\nFor python3 virtualenv\n\n\nvirtualenv-3.6 <directory>", "text": "FreeBSD Jails on FreeNAS\n\n\nMostly a personal distillation for getting a FreeBSD\nJail up and running on FreeNAS.\n\n\nIn The FreeNAS WebGui, Create A New Jail\n\n\nThe default networking configuration, will give\nyour jail an ip address on the lan. For now, I've\ndecided to just share a pkg cache with each jail.\nNavigate to \nJails -> Storage -> Add Storage\n and\nadd the \npkg\n storage directory to \n/var/cache/pkg\n\ninside the jail. \n\n\nFor instance, on my local FreeNAS server,\nthe pkg directory is at /mnt/VolumeOne/pkg/.\n\n\nIf you ssh into the host server, you can type the command\n\njls\n, to list the jails. Based on the output of the\ncommand \njls\n, you can get a shell with \njexec <jail number>\n\nof \njexec <jail hostname>\n.\n\n\nupdating\n\n\nHow about the command \npkg audit -F\n? Downloads a\nlist of known security issues and checks your system\nagainst that.\n\n\nI would recommend, to myself anyway, to shell into\nthe new jail with \njexec\n, run \npkg upgrade\n to install any new packages,\nand then from the FreeNAS webgui, restart the jail. Although\nthe restarted jail will have a new jail number as reported by\nthe \njls\n command.\n\n\nlocale\n\n\nWhen you use \njexec\n to get a shell, you get an environment\nwith an utf_8 locale. Not so if you ssh into the new jail.\nFor this put the following contents into ~/.login_conf\n\n\n# ~/.login_conf\nme:\\\n :charset=UTF-8:\\\n :lang=en_US.UTF-8:\\\n :setenv=LC_COLLATE=C:\n\n\n\n\nssh\n\n\nTo get ssh running, edit \n/etc/rc.conf\n inside the jail.\n\n\n# /etc/rc.conf\nsshd_enable=\"YES\"\n\n\n\n\nTo start sshd immediately, make any necessary edits to\n/etc/ssh/sshd_config, and run the following command.\n\n\nservice sshd start\n\n\n\n\nByobu\n\n\nYou'll need newt to configure byobu, and if you don't install tmux\nthen screen will become the backend.\n\n\npkg install byobu tmux newt\n\n\n\n\nIf you execute \nbyobu-config\n, by pressing \nf9\n, the\nfollowing options seem to work. Some options, of course,\nwill prevent others from working so you have to enable them\none at a time to see what happens.\n\n\n\n\ndate\n\n\ndisk\n\n\ndistro\n\n\nhostname\n\n\nip address\n\n\nload_average\n\n\nlogo\n\n\ntime\n\n\nuptime\n\n\nusers\n\n\nwhoami\n\n\n\n\nvim\n\n\nVia pkg, there are two options: vim and vim-lite. Note vim will pull\nin a whole bunch of gui dependancies, but vim-lite is not build with python.\n\n\nFor instance, powerline will not work with vim-lite because it's not built with\npython. Also, vim-youcompleteme will not work with vim-lite. However, lightline\nwill work with vim-lite, and VimCompletesMe will work with vim-lite.\n\n\nTo get lightline working update $TERM\n\n\n# ~/.config/fish/config.fish\nexport TERM=xterm-256color\n\n\n\n\nAnd vimrc\n\n\n# ~/.vimrc\nset ls=2\n\n\n\n\nAnother option is to build vim from source via ports. You can prevent vim\nfrom pulling in a bunch of gui dependancies with the following in /etc/make.conf.\n\n\n# /etc/make.conf\nWITHOUT_X11=yes\n\n\n\n\nAnd then when you compile vim from ports, run \nmake config\n where you can enable\npython.\n\n\npython\n\n\nFor python3 virtualenv\n\n\nvirtualenv-3.6 <directory>\n\n\n\n\nrunning gitit under the supervision of supervisord\n\n\npy27-supervisor and hs-gitit are available as pkg install, if you want to\nrun a gitit wiki.\n\n\ngitit doesn't come with an init service. To generate a sample config,\nrun \ngitit --print-default-config > gitit.conf\n, and then if you want\nyou can reference gitit.conf by passing gitit the \n-f\n flag.\n\n\nSo for instance, after you install supervisord, add something like the\nfollowing to the end of \n/usr/local/etc/supervisord.conf\n, and create\nthe directory \n/var/log/supervisor/\n.\n\n\n[program:gitit]\nuser=<user>\ndirectory=/path/to/wikidata/directory/\ncommand=/usr/local/bin/gitit -f /usr/local/etc/gitit.conf\nstdout_logfile=/var/log/supervisor/%(program_name)s.log\nstderr_logfile=/var/log/supervisor/%(program_name)s.log\nautorestart=true\n\n\n\n\nsupervisord is a service you can enable in\n\n/etc/rc.conf\n\n\n# /etc/rc.conf\nsupervisord_enable=\"YES\"\n\n\n\n\nand then start with \nservice supervisord start\n\nwhen you get supervisord running, you can start a\nsupervisorctl shell, i.e.\n\n\nsupervisorctl\nsupervisor> status\n# outputs\ngitit RUNNING pid 98057, uptime 0:32:27\nsupervisor> start/restart/stop gitit\nsupervisor> exit\n\n\n\n\nBut there is one other little detail, in that when you try to\nrun gitit as a daemon like this, on FreeBSD it will fail because it can't\nfind git. But the symlink solution is easy enough.\n\n\nln -s /usr/local/bin/git /usr/bin/",
"title": "FreeBSD Jails on FreeNAS" "title": "FreeBSD Jails on FreeNAS"
}, },
{ {
@ -310,6 +310,11 @@
"text": "For python3 virtualenv virtualenv-3.6 <directory>", "text": "For python3 virtualenv virtualenv-3.6 <directory>",
"title": "python" "title": "python"
}, },
{
"location": "/freebsd_jails_on_freenas/#running-gitit-under-the-supervision-of-supervisord",
"text": "py27-supervisor and hs-gitit are available as pkg install, if you want to\nrun a gitit wiki. gitit doesn't come with an init service. To generate a sample config,\nrun gitit --print-default-config > gitit.conf , and then if you want\nyou can reference gitit.conf by passing gitit the -f flag. So for instance, after you install supervisord, add something like the\nfollowing to the end of /usr/local/etc/supervisord.conf , and create\nthe directory /var/log/supervisor/ . [program:gitit]\nuser=<user>\ndirectory=/path/to/wikidata/directory/\ncommand=/usr/local/bin/gitit -f /usr/local/etc/gitit.conf\nstdout_logfile=/var/log/supervisor/%(program_name)s.log\nstderr_logfile=/var/log/supervisor/%(program_name)s.log\nautorestart=true supervisord is a service you can enable in /etc/rc.conf # /etc/rc.conf\nsupervisord_enable=\"YES\" and then start with service supervisord start \nwhen you get supervisord running, you can start a\nsupervisorctl shell, i.e. supervisorctl\nsupervisor> status\n# outputs\ngitit RUNNING pid 98057, uptime 0:32:27\nsupervisor> start/restart/stop gitit\nsupervisor> exit But there is one other little detail, in that when you try to\nrun gitit as a daemon like this, on FreeBSD it will fail because it can't\nfind git. But the symlink solution is easy enough. ln -s /usr/local/bin/git /usr/bin/",
"title": "running gitit under the supervision of supervisord"
},
{ {
"location": "/arch_redis_nspawn/", "location": "/arch_redis_nspawn/",
"text": "Quick Dirty Redis Nspawn Container on Arch Linux\n\n\nRefer to the \nNspawn\n page for setting up the nspawn container,\ninstall redis, and start/enable redis.service.\nOnce you have the container running, it seems all you have to do to get\nthings working in a container subnet is to change the bind address.\n\n\n# /etc/redis.conf\n# bind 127.0.0.1\nbind 0.0.0.0\n\n\n\n\nyou can nmap port 6379, be sure to restart redis\n\n\nAgain I would refer you to the Arch Wiki", "text": "Quick Dirty Redis Nspawn Container on Arch Linux\n\n\nRefer to the \nNspawn\n page for setting up the nspawn container,\ninstall redis, and start/enable redis.service.\nOnce you have the container running, it seems all you have to do to get\nthings working in a container subnet is to change the bind address.\n\n\n# /etc/redis.conf\n# bind 127.0.0.1\nbind 0.0.0.0\n\n\n\n\nyou can nmap port 6379, be sure to restart redis\n\n\nAgain I would refer you to the Arch Wiki",

View File

@ -4,7 +4,7 @@
<url> <url>
<loc>/</loc> <loc>/</loc>
<lastmod>2017-07-15</lastmod> <lastmod>2017-07-16</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -12,7 +12,7 @@
<url> <url>
<loc>/serve_and_share_apps_from_your_phone_with_fdroid/</loc> <loc>/serve_and_share_apps_from_your_phone_with_fdroid/</loc>
<lastmod>2017-07-15</lastmod> <lastmod>2017-07-16</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -20,7 +20,7 @@
<url> <url>
<loc>/nspawn/</loc> <loc>/nspawn/</loc>
<lastmod>2017-07-15</lastmod> <lastmod>2017-07-16</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -28,7 +28,7 @@
<url> <url>
<loc>/mastodon_on_arch/</loc> <loc>/mastodon_on_arch/</loc>
<lastmod>2017-07-15</lastmod> <lastmod>2017-07-16</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -36,7 +36,7 @@
<url> <url>
<loc>/debian_nspawn_container_on_arch_for_testing_apache_configurations/</loc> <loc>/debian_nspawn_container_on_arch_for_testing_apache_configurations/</loc>
<lastmod>2017-07-15</lastmod> <lastmod>2017-07-16</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -44,7 +44,7 @@
<url> <url>
<loc>/dynamic_cacheing_nginx_reverse_proxy_for_pacman/</loc> <loc>/dynamic_cacheing_nginx_reverse_proxy_for_pacman/</loc>
<lastmod>2017-07-15</lastmod> <lastmod>2017-07-16</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -52,7 +52,7 @@
<url> <url>
<loc>/freebsd_jails_on_freenas/</loc> <loc>/freebsd_jails_on_freenas/</loc>
<lastmod>2017-07-15</lastmod> <lastmod>2017-07-16</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -60,7 +60,7 @@
<url> <url>
<loc>/arch_redis_nspawn/</loc> <loc>/arch_redis_nspawn/</loc>
<lastmod>2017-07-15</lastmod> <lastmod>2017-07-16</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -68,7 +68,7 @@
<url> <url>
<loc>/arch_postgresql_nspawn/</loc> <loc>/arch_postgresql_nspawn/</loc>
<lastmod>2017-07-15</lastmod> <lastmod>2017-07-16</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -76,7 +76,7 @@
<url> <url>
<loc>/self_signed_certs/</loc> <loc>/self_signed_certs/</loc>
<lastmod>2017-07-15</lastmod> <lastmod>2017-07-16</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>