View puma.service
[Unit]
Description=Puma HTTP Server
After=network.target
[Service]
Type=simple
User=deployer
Group=deployer
View nginx.conf
# use the socket we configured in our puma.rb
upstream puma_appname {
server unix:/home/deployer/apps/appname/shared/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name domain;
root /home/deployer/apps/appname/current/public;
try_files $uri/index.html $uri @puma_appname;
View puma_conf.rb
app_name = "appname"
app_dir = "/home/deployer/apps/#{app_name}"
# Change to match your CPU core count
workers 1
# Min and Max threads per worker
threads 1, 6
shared_dir = "#{app_dir}/shared"
View unicorn_init.sh
#!/bin/sh
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $all
# Required-Stop: $network $remote_fs $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts the unicorn app server
# Description: Starts unicorn using start-stop-daemon
View unicorn_conf.rb
# Configuration file for Unicorn
#
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete documentation.
# See also http://unicorn.bogomips.org/examples/unicorn.conf.rb for a more verbose configuration using more features.
app_name = "appname"
root = "/home/deployer/apps/#{app_name}"
current_root = "#{root}/current"
# Help ensure your application will always spawn in the symlinked "current" directory
View nginx.conf
# use the socket we configured in our unicorn.rb
upstream unicorn_appname {
server unix:/tmp/unicorn.appname.sock fail_timeout=0;
}
server {
listen 80;
server_name domain;
root /home/deployer/apps/appname/current/public;
try_files $uri/index.html $uri @unicorn_appname;
View selectize.sh
#!/bin/bash
# Checkout vendor repo
echo "Cloning brianreavis/selectize.js github repo into tmp_vendor"
git clone https://github.com/brianreavis/selectize.js.git tmp_vendor
# Copy files
echo "Copying selectize.js"
mkdir -p app/assets/javascripts/vendor/selectize/
cp tmp_vendor/dist/js/standalone/selectize.js app/assets/javascripts/vendor/selectize/selectize.js
View nginx_php_cache.conf
server {
server_name domain;
rewrite ^/(.*) http://www.domain/$1 permanent;
access_log /dev/null;
error_log /dev/null;
}
server {
server_name www.domain;
root /home/deployer/apps/appname/current;
View php_init.sh
#!/bin/bash
# https://www.linode.com/docs/websites/nginx/nginx-and-phpfastcgi-on-ubuntu-10-04-lts-lucid
PHP_SCRIPT=/home/deployer/.php/appname/run.sh
FASTCGI_USER=deployer
FASTCGI_GROUP=deployer
PID_DIR=/home/deployer/.php/appname
PID_FILE=/home/deployer/.php/appname/php-fastcgi.pid
RET_VAL=0
View php_run.sh
#!/bin/bash
FASTCGI_USER=deployer
FASTCGI_GROUP=deployer
ADDRESS=127.0.0.1
PORT=9000
PIDFILE=/home/deployer/.php/appname/php-fastcgi.pid
CHILDREN=3
PHP5=/usr/bin/php5-cgi