Skip to content

Instantly share code, notes, and snippets.

View jurikern's full-sized avatar

Juri Kern jurikern

View GitHub Profile
@jarosan
jarosan / elasticsearch.rake
Created July 16, 2012 20:37
Elasticsearch reindex task
# Run with: rake environment elasticsearch:reindex
namespace :elasticsearch do
desc "re-index elasticsearch"
task :reindex => :environment do
klass = Place
ENV['CLASS'] = klass.name
ENV['INDEX'] = new_index = klass.tire.index.name << '_' << Time.now.strftime('%Y%m%d%H%M%S')
@johnantoni
johnantoni / unicorn.rb
Created August 2, 2012 15:48
unicorn + nginx setup + ssl
unicorn.rb
-----------------------------------
application = "jarvis"
remote_user = "vagrant"
env = ENV["RAILS_ENV"] || "development"
RAILS_ROOT = File.join("/home", remote_user, application)
worker_processes 8
timeout 30
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev lib64readline-gplv2-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -xvzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194/
./configure --prefix=/usr/local
make
make install
@shamil614
shamil614 / attachment.rb
Created November 2, 2012 16:12
Carrierwave Attachment Uploader with AWS and Zencoder.
class Attachment < ActiveRecord::Base
belongs_to :attachable, :polymorphic => true
mount_uploader :item, AttachmentUploader
# background the storage of files to AWS and processing
# makes for fast uploads!
store_in_background :item
attr_accessible :item
before_save :update_attachment_attributes
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active June 10, 2024 15:37
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

namespace :figaro do
desc "SCP transfer figaro configuration to the shared folder"
task :setup do
on roles(:app) do
upload! "config/application.yml", "#{shared_path}/application.yml", via: :scp
end
end
desc "Symlink application.yml to the release path"
task :symlink do
@jurikern
jurikern / unicorn.rake
Last active August 29, 2015 14:07
Unicorn task for zero downtime deployment
namespace :load do
task :defaults do
set :pids_dir, -> { File.join(current_path, 'tmp', 'pids') }
set :unicorn_pid, -> { File.join(fetch(:pids_dir), "unicorn.pid") }
set :unicorn_config_path, -> { File.join(current_path, "config", "unicorn", "#{fetch(:rails_env)}.rb") }
set :unicorn_roles, -> { :app }
set :unicorn_options, -> { "" }
set :unicorn_rack_env, -> { fetch(:rails_env) == "development" ? "development" : "deployment" }
set :unicorn_restart_sleep_time, 3
end