Skip to content

Instantly share code, notes, and snippets.

@hellolucky
hellolucky / redis-server
Last active December 21, 2015 08:39 — forked from ctavan/gist:4482825
#! /bin/bash
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db

Ubuntu 12.04, Ruby, Rails, Nginx, Unicorn and git-deploy

In the seemlingly endless search for the actual correct and easy way to deploy a Rails app, we have tried several ways. We tried out using Apache2 and running a cluster of Thin servers. With the built in threading of Puma we decided to use it with Nginx.

Server Setup

  • Create new server
  • Login to new server
    • ssh root@IPaddress (you can also use the domain name if you have the DNS setup already)
    • accept the RSA key
@hellolucky
hellolucky / rbenv-install-system-wide.sh
Created November 25, 2012 13:46 — forked from v1nc3ntlaw/rbenv-install-system-wide.sh
rbenv install ruby 1.9.3-p286 on Ubuntu 12.04 LTS
#
# Run as root
# $ bash <(curl -s https://raw.github.com/gist/1631411)
#
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential git-core curl \
libssl-dev \
@hellolucky
hellolucky / article_image_uploader.rb
Created September 13, 2012 07:43 — forked from jcsrb/article_image_uploader.rb
CarrierWave extension fix_exif_rotation, strip, quality, resize_to_fill_if_larger
class ArticleImageUploader < ImageUploader
process :fix_exif_rotation
process :strip
process :convert => 'jpg'
process :quality => 85 # Percentage from 0 - 100
version :gallery_thumb do
process :resize_to_fill => Settings.images.article_images.processing.gallery_thumb #44x44
end
@hellolucky
hellolucky / max_open_file
Created September 7, 2012 03:32 — forked from ben-lin/max_open_file
Configure max open file
## Configure max open file
ref : [nodejs.production](https://github.com/dreamerslab/nodejs.production), only `nodejs` user can open more files
$ sudo su
$ echo "nodejs soft nofile 51200" >> /etc/security/limits.conf
$ echo "nodejs hard nofile 51200" >> /etc/security/limits.conf
$ echo "www-data hard nofile 51200" >> /etc/security/limits.conf
$ echo "www-data hard nofile 51200" >> /etc/security/limits.conf
$ echo "session required pam_limits.so" >> /etc/pam.d/common-session
@hellolucky
hellolucky / unicorn
Created February 2, 2012 11:14
/etc/init.d script for unicorn
#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# Modified by [email protected] http://github.com/jaygooby
# based on http://gist.github.com/308216 by http://github.com/mguterl
#
## A sample /etc/unicorn/my_app.conf
##
@hellolucky
hellolucky / unicorn
Created February 2, 2012 11:12
/etc/init.d script for unicorn
#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# Modified by [email protected] http://github.com/jaygooby
# based on http://gist.github.com/308216 by http://github.com/mguterl
#
## A sample /etc/unicorn/my_app.conf
##