Skip to content

Instantly share code, notes, and snippets.

@jaredmcateer
Forked from anderssvendal/Procfile
Last active December 18, 2015 00:39
Show Gist options
  • Save jaredmcateer/5698552 to your computer and use it in GitHub Desktop.
Save jaredmcateer/5698552 to your computer and use it in GitHub Desktop.

Revisions

  1. jaredmcateer revised this gist Jun 3, 2013. 1 changed file with 3 additions and 6 deletions.
    9 changes: 3 additions & 6 deletions setup.rb
    Original file line number Diff line number Diff line change
    @@ -2,12 +2,9 @@

    base = ARGV[0] || '.'
    current_dir = File.expand_path(base)
    nginx_bin = `which nginx`
    nginx_bin = nginx_bin.gsub('\n', '')
    fastcgi_bin = `which php5-fpm`
    fastcgi_bin = fastcgi_bin.gsub('\n', '')
    db_bin = `which mysqld`
    db_bin = db_bin.gsub('\n', '')
    nginx_bin = `which nginx`.gsub("\n", '')
    fastcgi_bin = `which php5-fpm`.gsub("\n", '')
    db_bin = `which mysqld`.gsub("\n", '')

    procfile = <<PROCFILE
    web: #{nginx_bin} -p #{current_dir}/tmp/nginx/ -c ../../nginx.conf
  2. jaredmcateer revised this gist Jun 3, 2013. 1 changed file with 6 additions and 3 deletions.
    9 changes: 6 additions & 3 deletions setup.rb
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,12 @@

    base = ARGV[0] || '.'
    current_dir = File.expand_path(base)
    nginx_bin = `which nginx`.gsub('\n', '')
    fastcgi_bin = `which php5-fpm`.gsub('\n', '')
    db_bin = `which mysqld`.gsub('\n', '')
    nginx_bin = `which nginx`
    nginx_bin = nginx_bin.gsub('\n', '')
    fastcgi_bin = `which php5-fpm`
    fastcgi_bin = fastcgi_bin.gsub('\n', '')
    db_bin = `which mysqld`
    db_bin = db_bin.gsub('\n', '')

    procfile = <<PROCFILE
    web: #{nginx_bin} -p #{current_dir}/tmp/nginx/ -c ../../nginx.conf
  3. jaredmcateer revised this gist Jun 3, 2013. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions setup.rb
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@

    base = ARGV[0] || '.'
    current_dir = File.expand_path(base)
    nginx_bin = `which nginx`
    fastcgi_bin = `which php5-fpm`
    db_bin = `which mysqld`
    nginx_bin = `which nginx`.gsub('\n', '')
    fastcgi_bin = `which php5-fpm`.gsub('\n', '')
    db_bin = `which mysqld`.gsub('\n', '')

    procfile = <<PROCFILE
    web: #{nginx_bin} -p #{current_dir}/tmp/nginx/ -c ../../nginx.conf
  4. jaredmcateer revised this gist Jun 3, 2013. 2 changed files with 6 additions and 4 deletions.
    1 change: 0 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    # Install packages
    You should have homebrew version 0.9 or newer.

    9 changes: 6 additions & 3 deletions setup.rb
    Original file line number Diff line number Diff line change
    @@ -2,11 +2,14 @@

    base = ARGV[0] || '.'
    current_dir = File.expand_path(base)
    nginx_bin = `which nginx`
    fastcgi_bin = `which php5-fpm`
    db_bin = `which mysqld`

    procfile = <<PROCFILE
    web: `which nginx` -p #{current_dir}/tmp/nginx/ -c ../../nginx.conf
    fastcgi: `which php5-fpm`
    db: `which mysqld`
    web: #{nginx_bin} -p #{current_dir}/tmp/nginx/ -c ../../nginx.conf
    fastcgi: #{fastcgi_bin}
    db: #{db_bin}
    PROCFILE

    nginx_conf = <<NGINX_CONF
  5. jaredmcateer revised this gist Jun 3, 2013. 2 changed files with 5 additions and 7 deletions.
    1 change: 0 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,4 @@


    # Install packages
    You should have homebrew version 0.9 or newer.

    11 changes: 5 additions & 6 deletions setup.rb
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,18 @@
    require 'fileutils'

    base = ARGV[0] || '.'
    homebrew_path = `brew --prefix`.gsub(/\n/, '')
    current_dir = File.expand_path(base)

    procfile = <<PROCFILE
    web: #{homebrew_path}/sbin/nginx -p #{current_dir}/tmp/nginx/ -c ../../nginx.conf
    fastcgi: #{homebrew_path}/sbin/php-fpm
    db: #{homebrew_path}/bin/mysqld
    web: `which nginx` -p #{current_dir}/tmp/nginx/ -c ../../nginx.conf
    fastcgi: `which php5-fpm`
    db: `which mysqld`
    PROCFILE

    nginx_conf = <<NGINX_CONF
    daemon off;
    http {
    include #{homebrew_path}/etc/nginx/mime.types;
    include /etc/nginx/mime.types;
    default_type application/octet-stream;
    server {
    @@ -27,7 +26,7 @@
    location ~ \.php$
    {
    include #{homebrew_path}/etc/nginx/fastcgi.conf;
    include /etc/nginx/fastcgi.conf;
    fastcgi_index index.php;
    fastcgi_pass 127.0.0.1:9000;
    }
  6. @anderssvendal anderssvendal revised this gist May 3, 2012. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@


    # Install packages
    You should have homebrew version 0.9 or newer.

    @@ -29,3 +31,12 @@ Change the root-path in `nginx.conf`
    logs
    access.log
    error.log

    # Setup script
    Use the `setup.rb` script to quickly prepare a new project. It creates the configuration files and skeleton folder structure.

    You can pass one parameter to the script, the name of the folder to use. Leave it empty to use the current directory.

    **Run it directly from this gist:**

    ruby -e "$(curl -fsSL https://raw.github.com/gist/2585743/d4d1fdb431724675ec2c6894a083c8af3872bb6f/setup.rb)" [optional folder name]
  7. @anderssvendal anderssvendal revised this gist May 3, 2012. 1 changed file with 55 additions and 0 deletions.
    55 changes: 55 additions & 0 deletions setup.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,55 @@
    require 'fileutils'

    base = ARGV[0] || '.'
    homebrew_path = `brew --prefix`.gsub(/\n/, '')
    current_dir = File.expand_path(base)

    procfile = <<PROCFILE
    web: #{homebrew_path}/sbin/nginx -p #{current_dir}/tmp/nginx/ -c ../../nginx.conf
    fastcgi: #{homebrew_path}/sbin/php-fpm
    db: #{homebrew_path}/bin/mysqld
    PROCFILE

    nginx_conf = <<NGINX_CONF
    daemon off;
    http {
    include #{homebrew_path}/etc/nginx/mime.types;
    default_type application/octet-stream;
    server {
    listen 3000;
    server_name localhost;
    root #{current_dir}/app;
    index index.php index.html;
    try_files $uri $uri/ /index.php?$args;
    location ~ \.php$
    {
    include #{homebrew_path}/etc/nginx/fastcgi.conf;
    fastcgi_index index.php;
    fastcgi_pass 127.0.0.1:9000;
    }
    }
    }
    events {
    }
    NGINX_CONF

    # Create folder structure
    FileUtils.mkdir_p "#{base}/tmp/nginx/logs"
    FileUtils.mkdir "#{base}/app"

    # Create empty files
    FileUtils.touch "#{base}/tmp/nginx/logs/access.log"
    FileUtils.touch "#{base}/tmp/nginx/logs/error.log"

    # Create config files
    File.open("#{base}/Procfile", 'w') {|f| f.write(procfile) }
    File.open("#{base}/nginx.conf", 'w') {|f| f.write(nginx_conf) }

    # Create test php file
    File.open("#{base}/app/index.php", 'w') {|f| f.write("<?php\n echo '<h1>It works!</h1>';\n") }
  8. @anderssvendal anderssvendal revised this gist May 3, 2012. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -13,8 +13,11 @@ You should have homebrew version 0.9 or newer.
    brew tap josegonzalez/homebrew-php
    brew install php --with-mysql --with-fpm

    # Tweak php-fpm config
    To run php-fpm in the foreground set `deamonize = no` in the php-fpm.conf. Should be located in `/usr/local/Cellar/php/5.3.10/etc`
    # Tweak config
    ## php-fpm
    To run php-fpm in the foreground set `deamonize = no` in the `php-fpm.conf`. Should be located in `/usr/local/Cellar/php/5.3.10/etc`
    ## nginx
    Change the root-path in `nginx.conf`

    # Folder structure
    Procfile
  9. @anderssvendal anderssvendal created this gist May 3, 2012.
    3 changes: 3 additions & 0 deletions Procfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    web: /usr/local/sbin/nginx -p `pwd`/tmp/nginx/ -c ../../nginx.conf
    fastcgi: /usr/local/sbin/php-fpm
    db: /usr/local/bin/mysqld
    28 changes: 28 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    # Install packages
    You should have homebrew version 0.9 or newer.

    ## Install nginx
    brew install nginx

    ## Install mysql
    brew install mysql
    unset TMPDIR
    mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

    ## Install php
    brew tap josegonzalez/homebrew-php
    brew install php --with-mysql --with-fpm

    # Tweak php-fpm config
    To run php-fpm in the foreground set `deamonize = no` in the php-fpm.conf. Should be located in `/usr/local/Cellar/php/5.3.10/etc`

    # Folder structure
    Procfile
    app
    <webapp goes here>
    nginx.conf
    tmp
    nginx
    logs
    access.log
    error.log
    26 changes: 26 additions & 0 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    daemon off;
    http {
    include /usr/local/etc/nginx/mime.types;
    default_type application/octet-stream;

    server {
    listen 3000;
    server_name localhost;

    root <absolute path to document root>;
    index index.php index.html;

    try_files $uri $uri/ /index.php?$args;

    location ~ \.php$
    {
    include /usr/local/etc/nginx/fastcgi.conf;
    fastcgi_index index.php;
    fastcgi_pass 127.0.0.1:9000;
    }
    }
    }

    events {

    }