諸事情で自宅鯖ちゃんが死んだのでノリでさくら VPS 借りた — Gist
ひとまずは一番アクセスの多い Undersky を復活させつつ
Apache+Passenger から乗り換えるべく Nginx+Unicorn 環境を試行錯誤してみた
以下は Undersky における設定もとい作業ログ
設定はググって出てきたものを寄せ集めてコピペしてきただけである
諸事情で自宅鯖ちゃんが死んだのでノリでさくら VPS 借りた — Gist
ひとまずは一番アクセスの多い Undersky を復活させつつ
Apache+Passenger から乗り換えるべく Nginx+Unicorn 環境を試行錯誤してみた
以下は Undersky における設定もとい作業ログ
設定はググって出てきたものを寄せ集めてコピペしてきただけである
| ERROR :: | |
| if you get the following error message when you try to open your app in Heroku :: | |
| ActionView::Template::Error (images/apple-touch-icon-144x144-precomposed.png isn't precompiled): | |
| =============================================================================================================== | |
| SOLUTION :: |
| # Sample implementation of quicksort and mergesort in ruby | |
| # Both algorithm sort in O(n * lg(n)) time | |
| # Quicksort works inplace, where mergesort works in a new array | |
| def quicksort(array, from=0, to=nil) | |
| if to == nil | |
| # Sort the whole array, by default | |
| to = array.count - 1 | |
| end |
| 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 |
| #! /bin/csh | |
| while (1) | |
| curl -silent -A "iMacAppStore/1.0.1 (Macintosh; U; Intel Mac OS X 10.6.7; en) AppleWebKit/533.20.25" 'http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewGrouping?id=29526&mt=12' | grep -i "mountain lion" > /dev/null | |
| if ($? == 0) then | |
| echo "Available" | |
| say "MOUNTAIN LION MAY BE AVAILABLE" | |
| else | |
| echo "Nada" | |
| endif | |
| sleep 600 |
| # Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed. | |
| # We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies. | |
| # Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module | |
| # | |
| # Deployment structure | |
| # | |
| # SERVER: | |
| # /etc/init.d/nginx (1. nginx) | |
| # /home/app/public_html/app_production/current (Capistrano directory) | |
| # |
| This playbook has been removed as it is now very outdated. |
| require 'active_support/all' | |
| require 'timeout' | |
| class CacheMutex | |
| INTERVAL = 0.01 | |
| TIMEOUT = 20 | |
| def initialize(name) | |
| @name = name | |
| @have_lock = false |
| ActiveAdmin::Dashboards.build do | |
| # Add this section in your dashboard... | |
| section "Background Jobs" do | |
| now = Time.now.getgm | |
| ul do | |
| li do | |
| jobs = Delayed::Job.where('failed_at is not null').count(:id) | |
| link_to "#{jobs} failing jobs", admin_jobs_path(q: {failed_at_is_not_null: true}), style: 'color: red' | |
| end |