25
Lightweight Development

Lightweight development (Lightning talk)

  • Upload
    zroger

  • View
    187

  • Download
    2

Embed Size (px)

DESCRIPTION

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

Citation preview

Page 1: Lightweight development (Lightning talk)

Lightweight Development

Page 2: Lightweight development (Lightning talk)

Roger López@zroger

Page 3: Lightweight development (Lightning talk)

I develop locally.

Page 4: Lightweight development (Lightning talk)
Page 5: Lightweight development (Lightning talk)
Page 6: Lightweight development (Lightning talk)

The old ways...

Page 7: Lightweight development (Lightning talk)

MAMP

Page 8: Lightweight development (Lightning talk)

System-wide services

Page 9: Lightweight development (Lightning talk)

Newer ways

Page 10: Lightweight development (Lightning talk)

Vagrant

Page 11: Lightweight development (Lightning talk)

Dev-friendly hosting

Page 12: Lightweight development (Lightning talk)

drush runserver

Page 13: Lightweight development (Lightning talk)

Everything to the foreground!

Page 14: Lightweight development (Lightning talk)

My Ideal Solution

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

• Easily use different configurations per project.

• Uses easily installable services (homebrew).

Page 15: Lightweight development (Lightning talk)

httpd -d . -f httpd.conf -DFOREGROUND

Page 16: Lightweight development (Lightning talk)

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

76 lines, heavily commented

Page 17: Lightweight development (Lightning talk)

## 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

Page 18: Lightweight development (Lightning talk)

Automate it.

Page 19: Lightweight development (Lightning talk)

foreman manages Procfile-based

applications

Page 20: Lightweight development (Lightning talk)

Procfile

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

Page 21: Lightweight development (Lightning talk)
Page 22: Lightweight development (Lightning talk)

Procfile

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

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

cache: memcached -v

search: solr ./example/solr/

Page 23: Lightweight development (Lightning talk)
Page 24: Lightweight development (Lightning talk)

Roger López@zroger

Page 25: Lightweight development (Lightning talk)

Phase2Technology.com