<?xml version="1.0"?>
<rss version="2.0"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:dcterms="http://purl.org/dc/terms/"
     xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Tyler Cipriani: pages tagged vagrant</title>
<link>https://tylercipriani.com/tags/vagrant/</link>
<atom:link href="https://tylercipriani.com/tags/vagrant/index.rss" rel="self" type="application/rss+xml"/>

<description>Tyler Cipriani</description>
<generator>ikiwiki</generator>
<pubDate>Sat, 01 Jul 2017 00:49:09 +0000</pubDate>
<item>
	<title>Development Environments with Vagrant, Docker, and Supervisord</title>

	<guid isPermaLink="false">https://tylercipriani.com/blog/2014/05/25/lightweight-portable-vagrant-docker/</guid>

	<link>https://tylercipriani.com/blog/2014/05/25/lightweight-portable-vagrant-docker/</link>

	<dc:creator>Tyler Cipriani</dc:creator>



	<category>computing</category>

	<category>docker</category>

	<category>shell</category>

	<category>vagrant</category>


	<pubDate>Sun, 25 May 2014 00:00:00 +0000</pubDate>
	<dcterms:modified>2017-07-01T00:49:09Z</dcterms:modified>


	<description>&lt;p&gt;I’ve used Vagrant a fair amount in my day, and it’s great. I enjoy being able to spin-up toy linux environments to test out ideas. I tend to use the &lt;a href=&quot;http://docs.vagrantup.com/v2/provisioning/chef_solo.html&quot;&gt;Chef provisioner&lt;/a&gt; with Vagrant to build-out a local environment that matches my server fairly closely.&lt;/p&gt;
&lt;section id=&quot;my-ever-evolving-rant-about-devops&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;My Ever-Evolving Rant About DevOps &lt;a href=&quot;https://tylercipriani.com/tags/vagrant/#my-ever-evolving-rant-about-devops&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I’ve been thinking about Chef a lot lately. Often is the time, in moments of profound frustration, that I’ve had the thought that Chef is nothing more than a useless, leaky abstraction that separates me from something I know fairly well—Linux.&lt;/p&gt;
&lt;p&gt;This thought is usually fleeting: Chef provides many needed abstractions that are, ultimately, much easier to grok than the underlying Linux system. Further, Chef allows you to keep a(n ostensibly) well-tested system under version control.&lt;/p&gt;
&lt;p&gt;I’ve come to the realization that my problem with Chef is not really a problem with Chef, but a &lt;a href=&quot;https://www.domenkozar.com/2014/03/11/why-puppet-chef-ansible-arent-good-enough-and-we-can-do-better/&quot;&gt;problem with Linux itself&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Linux system administration is difficult because Linux commands are non-deterministic and rely heavily on system state (e.g., installed software, permissions, network settings and availability). Maintaining a bare-metal, long-running server non-interactively using Chef sucks because &lt;a href=&quot;http://me.andering.com/2011/02/03/server-login-considered-harmful/&quot;&gt;any hand-tinkering via ssh&lt;/a&gt; is going to fuck with the “state” of the system—creating different results for subsequent chef-client runs. This system state adjustment may or may not be reflected in the chef repository (which double sucks).&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;why-docker-curtails-my-rage&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Why Docker Curtails My Rage &lt;a href=&quot;https://tylercipriani.com/tags/vagrant/#why-docker-curtails-my-rage&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I started to think about Docker. I feel Docker addresses the problem of program state better than other currently available solutions (although, &lt;a href=&quot;https://nixos.org/nixos/&quot;&gt;Nix&lt;/a&gt; is looking pretty promising as well). While Docker is still a Linux system—and, ipso facto, state-dependant—it’s also ephemeral and therefore, by not persisting changes to state, Docker has created a previously unavailable (on bare metal hardware), lightweight workaround to the problem of system state.&lt;/p&gt;
&lt;p&gt;As is my wont, I decided today to play a bit with Docker on Vagrant and, lo-and-below, I found that the newest version of Vagrant (1.6.2, as of May 26th) can actually use &lt;a href=&quot;https://www.vagrantup.com/blog/feature-preview-vagrant-1-6-docker-dev-environments.html&quot;&gt;docker as a &lt;em&gt;provider&lt;/em&gt;&lt;/a&gt;, that is, as an alternative to VirtualBox. Using Docker as a provider means that you can run a fully-independent development enviroment, on your host machine without the overhead of VirtualBox. Neat.&lt;/p&gt;
&lt;p&gt;“Imma setup a local development environment for Ubuntu 14.04, nginx and php-fpm using Vagrant, Supervisord and Docker,” says I.&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;project-layout&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Project Layout &lt;a href=&quot;https://tylercipriani.com/tags/vagrant/#project-layout&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To keep my project directory nice and tidy, I’ve separated-out most of the files needed by the Docker provider into a &lt;code&gt;Docker&lt;/code&gt; folder. This results in the directory structure below.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb1&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-1&quot; title=&quot;1&quot;&gt;├── &lt;span class=&quot;ex&quot;&gt;Docker&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-2&quot; title=&quot;2&quot;&gt;│   ├── &lt;span class=&quot;ex&quot;&gt;Dockerfile&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-3&quot; title=&quot;3&quot;&gt;│   ├── &lt;span class=&quot;ex&quot;&gt;nginx&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-4&quot; title=&quot;4&quot;&gt;│   │   └── &lt;span class=&quot;ex&quot;&gt;default&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-5&quot; title=&quot;5&quot;&gt;│   ├── &lt;span class=&quot;ex&quot;&gt;php-fpm&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-6&quot; title=&quot;6&quot;&gt;│   │   └── &lt;span class=&quot;ex&quot;&gt;php-fpm.conf&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-7&quot; title=&quot;7&quot;&gt;│   └── &lt;span class=&quot;ex&quot;&gt;supervisor&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-8&quot; title=&quot;8&quot;&gt;│       └── &lt;span class=&quot;ex&quot;&gt;supervisord.conf&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-9&quot; title=&quot;9&quot;&gt;├── &lt;span class=&quot;ex&quot;&gt;Vagrantfile&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-10&quot; title=&quot;10&quot;&gt;└── &lt;span class=&quot;ex&quot;&gt;www&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-11&quot; title=&quot;11&quot;&gt;    └── &lt;span class=&quot;ex&quot;&gt;index.php&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;Dockerfile&lt;/code&gt; is used to build the main docker machine and the subfolders in the &lt;code&gt;Docker&lt;/code&gt; directory contain configuration used in the &lt;code&gt;Dockerfile&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;www&lt;/code&gt; folder is my fake php project folder.&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;vagrantfile&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;VagrantFile &lt;a href=&quot;https://tylercipriani.com/tags/vagrant/#vagrantfile&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Since docker handles so much of what was previously handled by Vagrant provisioner, the &lt;code&gt;Vagrantfile&lt;/code&gt; for a Docker-backed Vagrant instance is pretty sparse.&lt;/p&gt;
&lt;p&gt;In mine, I’ve got:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb2&quot;&gt;&lt;pre class=&quot;sourceCode numberSource ruby numberLines&quot;&gt;&lt;code class=&quot;sourceCode ruby&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;dt&quot;&gt;Vagrant&lt;/span&gt;.configure(&lt;span class=&quot;dv&quot;&gt;2&lt;/span&gt;) &lt;span class=&quot;kw&quot;&gt;do&lt;/span&gt; |config|&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-2&quot; title=&quot;2&quot;&gt;  config.vm.synced_folder &lt;span class=&quot;st&quot;&gt;&amp;quot;./www&amp;quot;&lt;/span&gt;, &lt;span class=&quot;st&quot;&gt;&amp;quot;/var/www&amp;quot;&lt;/span&gt;   &lt;span class=&quot;co&quot;&gt;# Sync&amp;#39;d folder&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-3&quot; title=&quot;3&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-4&quot; title=&quot;4&quot;&gt;  config.vm.provider &lt;span class=&quot;st&quot;&gt;&amp;quot;docker&amp;quot;&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;do&lt;/span&gt; |d|&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-5&quot; title=&quot;5&quot;&gt;    d.build_dir = &lt;span class=&quot;st&quot;&gt;&amp;quot;./Docker&amp;quot;&lt;/span&gt; &lt;span class=&quot;co&quot;&gt;# specifies the path to the Dockerfile&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-6&quot; title=&quot;6&quot;&gt;    d.ports &amp;lt;&amp;lt; &lt;span class=&quot;st&quot;&gt;&amp;#39;8080:80&amp;#39;&lt;/span&gt;     &lt;span class=&quot;co&quot;&gt;# Forwards port 8080 from the host to the Docker Container port 80&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-7&quot; title=&quot;7&quot;&gt;  &lt;span class=&quot;kw&quot;&gt;end&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-8&quot; title=&quot;8&quot;&gt;&lt;span class=&quot;kw&quot;&gt;end&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;dockerfile&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Dockerfile &lt;a href=&quot;https://tylercipriani.com/tags/vagrant/#dockerfile&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Most of the work of provisioning a container is handled by Docker and the Dockerfile. In fact, if you were only ever going to run this container on a Linux machine, I don’t think that Vagrant adds any needed functionality to the &lt;code&gt;docker.io&lt;/code&gt; cli. In terms of portability, however, Vagrant is, at this time, a necessary evil to run docker on OSX and Windows.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb3&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;FROM&lt;/span&gt; ubuntu:latest&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-2&quot; title=&quot;2&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;ex&quot;&gt;MAINTAINER&lt;/span&gt; Tyler Cipriani, tyler@tylercipriani.com&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-4&quot; title=&quot;4&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-5&quot; title=&quot;5&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Download and install php, nginx, and supervisor, hey, just linux for a change!&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-6&quot; title=&quot;6&quot;&gt;&lt;span class=&quot;ex&quot;&gt;RUN&lt;/span&gt; apt-get update&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-7&quot; title=&quot;7&quot;&gt;&lt;span class=&quot;ex&quot;&gt;RUN&lt;/span&gt; apt-get install -y software-properties-common&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-8&quot; title=&quot;8&quot;&gt;&lt;span class=&quot;ex&quot;&gt;RUN&lt;/span&gt; add-apt-repository ppa:nginx/stable&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-9&quot; title=&quot;9&quot;&gt;&lt;span class=&quot;ex&quot;&gt;RUN&lt;/span&gt; apt-get update&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-10&quot; title=&quot;10&quot;&gt;&lt;span class=&quot;ex&quot;&gt;RUN&lt;/span&gt; apt-get -y dist-upgrade&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-11&quot; title=&quot;11&quot;&gt;&lt;span class=&quot;ex&quot;&gt;RUN&lt;/span&gt; apt-get install -y php5-fpm nginx supervisor&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-12&quot; title=&quot;12&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-13&quot; title=&quot;13&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Setup config files&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-14&quot; title=&quot;14&quot;&gt;&lt;span class=&quot;ex&quot;&gt;RUN&lt;/span&gt; echo &lt;span class=&quot;st&quot;&gt;&amp;quot;daemon off;&amp;quot;&lt;/span&gt; &lt;span class=&quot;op&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; /etc/nginx/nginx.conf&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-15&quot; title=&quot;15&quot;&gt;&lt;span class=&quot;ex&quot;&gt;ADD&lt;/span&gt; ./nginx/default /etc/nginx/sites-enabled/default&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-16&quot; title=&quot;16&quot;&gt;&lt;span class=&quot;ex&quot;&gt;ADD&lt;/span&gt; ./supervisor/supervisord.conf /etc/supervisor/supervisord.conf&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-17&quot; title=&quot;17&quot;&gt;&lt;span class=&quot;ex&quot;&gt;ADD&lt;/span&gt; ./php-fpm/php-fpm.conf /etc/php5/fpm/php-fpm.conf&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-18&quot; title=&quot;18&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-19&quot; title=&quot;19&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Shared volume&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-20&quot; title=&quot;20&quot;&gt;&lt;span class=&quot;ex&quot;&gt;RUN&lt;/span&gt; mkdir -p /var/www&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-21&quot; title=&quot;21&quot;&gt;&lt;span class=&quot;ex&quot;&gt;VOLUME&lt;/span&gt; [&lt;span class=&quot;st&quot;&gt;&amp;quot;/var/www&amp;quot;&lt;/span&gt;]&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-22&quot; title=&quot;22&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-23&quot; title=&quot;23&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Default command for container, start supervisor&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-24&quot; title=&quot;24&quot;&gt;&lt;span class=&quot;ex&quot;&gt;CMD&lt;/span&gt; [&lt;span class=&quot;st&quot;&gt;&amp;quot;supervisord&amp;quot;&lt;/span&gt;, &lt;span class=&quot;st&quot;&gt;&amp;quot;--nodaemon&amp;quot;&lt;/span&gt;]&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-25&quot; title=&quot;25&quot;&gt;&lt;span class=&quot;ex&quot;&gt;USER&lt;/span&gt; root&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-26&quot; title=&quot;26&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-27&quot; title=&quot;27&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Expose port 80 of the container&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-28&quot; title=&quot;28&quot;&gt;&lt;span class=&quot;ex&quot;&gt;EXPOSE&lt;/span&gt; 80&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This &lt;code&gt;Dockerfile&lt;/code&gt; takes care of building a docker container from the latest Ubuntu image (14.04 as of May 26th, 2014). Running this code installs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Nginx 1.6.0&lt;/li&gt;
&lt;li&gt;PHP 5.5.9&lt;/li&gt;
&lt;li&gt;Supervisor&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This config also starts supervisor with the &lt;code&gt;--nodaemon&lt;/code&gt; flag by default. Docker can run a container running a non-daemonized program as a daemon (much like supervisor can run non-daemonized programs as daemons). Supervisor is used as a way of running both nginx and php-fpm as non-daemonized programs. It is also noteworthy that the dockerfile creates and/or modifies configuration files for php-fpm and nginx to make sure they both run in non-daemon mode.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;nginx/default&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb4&quot;&gt;&lt;pre class=&quot;sourceCode numberSource numberLines&quot;&gt;&lt;code class=&quot;sourceCode&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-1&quot; title=&quot;1&quot;&gt;server {&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-2&quot; title=&quot;2&quot;&gt;  listen 80 default_server;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-3&quot; title=&quot;3&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-4&quot; title=&quot;4&quot;&gt;  root  /var/www;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-5&quot; title=&quot;5&quot;&gt;  index index.php index.html;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-6&quot; title=&quot;6&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-7&quot; title=&quot;7&quot;&gt;  # pass the PHP scripts to FastCGI server&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-8&quot; title=&quot;8&quot;&gt;  location ~ \.php$ {&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-9&quot; title=&quot;9&quot;&gt;    try_files $uri =404;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-10&quot; title=&quot;10&quot;&gt;    fastcgi_split_path_info ^(.+\.php)(/.+)$;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-11&quot; title=&quot;11&quot;&gt;    fastcgi_pass unix:/var/run/php5-fpm.sock;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-12&quot; title=&quot;12&quot;&gt;    fastcgi_index index.php;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-13&quot; title=&quot;13&quot;&gt;    include fastcgi_params;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-14&quot; title=&quot;14&quot;&gt;  }&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-15&quot; title=&quot;15&quot;&gt;}&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;php-fpm/php-fpm.conf&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb5&quot;&gt;&lt;pre class=&quot;sourceCode numberSource ini numberLines&quot;&gt;&lt;code class=&quot;sourceCode ini&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;kw&quot;&gt;[global]&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;dt&quot;&gt;pid &lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; /var/run/php5-fpm.pid&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;dt&quot;&gt;error_log &lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; /var/log/php5-fpm.log&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-4&quot; title=&quot;4&quot;&gt;&lt;span class=&quot;dt&quot;&gt;daemonize &lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;no&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-5&quot; title=&quot;5&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-6&quot; title=&quot;6&quot;&gt;&lt;span class=&quot;dt&quot;&gt;include&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/etc/php5/fpm/pool.d/*.conf&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;supervisor/supervisord.conf&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb6&quot;&gt;&lt;pre class=&quot;sourceCode numberSource ini numberLines&quot;&gt;&lt;code class=&quot;sourceCode ini&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;kw&quot;&gt;[unix_http_server]&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;dt&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/var/run/supervisor.sock   ; (the path to the socket file)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;dt&quot;&gt;chmod&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dv&quot;&gt;0700&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;                       ; sockef file mode (&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;dv&quot;&gt;0700&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-4&quot; title=&quot;4&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-5&quot; title=&quot;5&quot;&gt;&lt;span class=&quot;kw&quot;&gt;[supervisord]&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-6&quot; title=&quot;6&quot;&gt;&lt;span class=&quot;dt&quot;&gt;logfile&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/tmp/supervisord.log ; (main log file;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; $CWD/supervisord.log)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-7&quot; title=&quot;7&quot;&gt;&lt;span class=&quot;dt&quot;&gt;logfile_maxbytes&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;50MB        ; (max main logfile bytes b4 rotation;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; 50MB)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-8&quot; title=&quot;8&quot;&gt;&lt;span class=&quot;dt&quot;&gt;logfile_backups&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dv&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;           ; (num of main logfile rotation backups;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;dv&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-9&quot; title=&quot;9&quot;&gt;&lt;span class=&quot;dt&quot;&gt;loglevel&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;info                ; (log level;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; info; others: debug,warn,trace)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-10&quot; title=&quot;10&quot;&gt;&lt;span class=&quot;dt&quot;&gt;pidfile&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/tmp/supervisord.pid ; (supervisord pidfile;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; supervisord.pid)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-11&quot; title=&quot;11&quot;&gt;&lt;span class=&quot;dt&quot;&gt;nodaemon&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;               ; (start in foreground if &lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-12&quot; title=&quot;12&quot;&gt;&lt;span class=&quot;dt&quot;&gt;minfds&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dv&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;                  ; (min. avail startup file descriptors;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;dv&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-13&quot; title=&quot;13&quot;&gt;&lt;span class=&quot;dt&quot;&gt;minprocs&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dv&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;                 ; (min. avail process descriptors;&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; &lt;/span&gt;&lt;span class=&quot;dv&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-14&quot; title=&quot;14&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-15&quot; title=&quot;15&quot;&gt;&lt;span class=&quot;co&quot;&gt;; the below section must remain in the config file for RPC&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-16&quot; title=&quot;16&quot;&gt;&lt;span class=&quot;co&quot;&gt;; (supervisorctl/web interface) to work, additional interfaces may be&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-17&quot; title=&quot;17&quot;&gt;&lt;span class=&quot;co&quot;&gt;; added by defining them in separate rpcinterface: sections&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-18&quot; title=&quot;18&quot;&gt;&lt;span class=&quot;kw&quot;&gt;[rpcinterface:supervisor]&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-19&quot; title=&quot;19&quot;&gt;&lt;span class=&quot;dt&quot;&gt;supervisor.rpcinterface_factory &lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt; supervisor.rpcinterface:make_main_rpcinterface&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-20&quot; title=&quot;20&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-21&quot; title=&quot;21&quot;&gt;&lt;span class=&quot;kw&quot;&gt;[supervisorctl]&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-22&quot; title=&quot;22&quot;&gt;&lt;span class=&quot;dt&quot;&gt;serverurl&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;unix:///var/run/supervisor.sock ; use a unix:// URL  for a unix socket&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-23&quot; title=&quot;23&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-24&quot; title=&quot;24&quot;&gt;&lt;span class=&quot;kw&quot;&gt;[program:php5-fpm]&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-25&quot; title=&quot;25&quot;&gt;&lt;span class=&quot;dt&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/usr/sbin/php5-fpm -c /etc/php5/fpm&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-26&quot; title=&quot;26&quot;&gt;&lt;span class=&quot;dt&quot;&gt;stdout_events_enabled&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;true&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-27&quot; title=&quot;27&quot;&gt;&lt;span class=&quot;dt&quot;&gt;stderr_events_enabled&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;true&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-28&quot; title=&quot;28&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-29&quot; title=&quot;29&quot;&gt;&lt;span class=&quot;kw&quot;&gt;[program:nginx]&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-30&quot; title=&quot;30&quot;&gt;&lt;span class=&quot;dt&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;/usr/sbin/nginx&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-31&quot; title=&quot;31&quot;&gt;&lt;span class=&quot;dt&quot;&gt;stdout_events_enabled&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;true&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-32&quot; title=&quot;32&quot;&gt;&lt;span class=&quot;dt&quot;&gt;stderr_events_enabled&lt;/span&gt;&lt;span class=&quot;ot&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kw&quot;&gt;true&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;jam-time&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Jam Time &lt;a href=&quot;https://tylercipriani.com/tags/vagrant/#jam-time&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;With all of our configuration in place there isn’t much left to do aside from running the vagrant instance and allowing docker to create our container.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb7&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb7-1&quot; title=&quot;1&quot;&gt;$ &lt;span class=&quot;fu&quot;&gt;sudo&lt;/span&gt; docker pull ubuntu &lt;span class=&quot;co&quot;&gt;# to grab the latest Ubuntu image, Vagrant should probably do this but doesn&amp;#39;t&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb7-2&quot; title=&quot;2&quot;&gt;$ &lt;span class=&quot;fu&quot;&gt;sudo&lt;/span&gt; vagrant up --provider=docker --debug &lt;span class=&quot;co&quot;&gt;# use debug if you don&amp;#39;t want to sit waiting with no info for a long time on the first run&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With that, you now have a container running nginx and php-fpm that is sharing a folder with you at &lt;code&gt;/var/www&lt;/code&gt;. Navigating to &lt;code&gt;http://localhost:8080/index.php&lt;/code&gt; should show you the contents of your &lt;code&gt;./www/index.php&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;This process is really simple AND super lightweight. I’ve been running my docker/vagrant instance for about 45 minutes alongside chrome and tmux/xterm without any noticeable jankyness on a notoriously janky laptop.&lt;/p&gt;
&lt;/section&gt;
</description>


	<comments>//tylercipriani.com/blog/2014/05/25/lightweight-portable-vagrant-docker/#comments</comments>

</item>

</channel>
</rss>
