Lightweight development (Lightning talk)

Preview:

DESCRIPTION

The quest for a lightweight development environment for local PHP development.

Citation preview

Lightweight Development

Roger López@zroger

I develop locally.

The old ways...

MAMP

System-wide services

Newer ways

Vagrant

Dev-friendly hosting

drush runserver

Everything to the foreground!

My Ideal Solution

• Runs in the foreground. Start, stop, go away.

• Easily use different configurations per project.

• Uses easily installable services (homebrew).

httpd -d . -f httpd.conf -DFOREGROUND

minimal httpd.confhttps://gist.github.com/zroger/5990997

76 lines, heavily commented

## Minimal httpd.conf for running apache in the foreground for local php# development.## Setup:# 1. Place this file in the root of your project.# 2. Make sure the ./tmp directory exists (for the pid and lock files).# 3. Update the DocumentRoot and Directory directives with the relative path to# your project's document root.## Usage:# httpd -d . -f httpd.conf -DFOREGROUND## Relative file paths in this file are relative to the server root, which is# assumed to be set from the command line option, as in the about usage.# ServerName localhostListen 8080PidFile tmp/httpd.pidLockFile tmp/accept.lock

 ## Optional Modules# # Provides allow, deny and order directives.LoadModule authz_host_module /usr/libexec/apache2/mod_authz_host.so # Provides DirectoryIndex directive.LoadModule dir_module /usr/libexec/apache2/mod_dir.so # Provides SetEnv directive.LoadModule env_module /usr/libexec/apache2/mod_env.so # Provides automatic mime content type headers.LoadModule mime_module /usr/libexec/apache2/mod_mime.so # Provides CustomLog and LogFormat directives.LoadModule log_config_module /usr/libexec/apache2/mod_log_config.so # Allow rewrite rules in .htaccess files.LoadModule rewrite_module /usr/libexec/apache2/mod_rewrite.so # Using homebrew php53. Change as necessary.LoadModule php5_module /usr/local/opt/php53/libexec/apache2/libphp5.so

 ## Logs are piped to `cat` which prints to STDOUT.#LogLevel infoErrorLog "|cat"LogFormat "%h %l %u %t \"%r\" %>s %b" commonCustomLog "|cat" common ## Since this is intended for local environments, the single document root is# highly permissive.#DocumentRoot "build"<Directory "build"> AllowOverride all Order allow,deny Allow from all</Directory> ## Basic PHP handling.#AddType application/x-httpd-php .phpDirectoryIndex index.html index.php 

## Provide applications with a hook to detect when running locally.#SetEnv LOCAL_SERVER true

Automate it.

foreman manages Procfile-based

applications

Procfile

web: httpd -d . -f httpd.conf -DFOREGROUND

Procfile

web: httpd -d . -f httpd.conf -DFOREGROUND

db: mysqld --log-error=/dev/stdout

cache: memcached -v

search: solr ./example/solr/

Roger López@zroger

Phase2Technology.com