This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Example data... | |
{ | |
LivePicsImpressionsDaily : { //column family | |
54 : { // row (pic id) | |
timeuuid : 54 // 54 views on this day | |
// ... other columns, one for each day (or 10-min period) | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- monitor memory usage | |
check process unicorn_worker0 | |
with pidfile unicorn_worker0.pid | |
if mem > 280.0 MB for 2 cycles then exec "/bin/bash -c '/bin/kill -3 `cat unicorn_worker0.pid` && sleep 1'" | |
-- write a worker pid in unicorns after_fork |server, worker| | |
worker_pid = File.join(File.dirname(server.config[:pid]), "unicorn_worker#{worker.nr}.pid") | |
File.open(worker_pid, "w") { |f| f.puts Process.pid } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This stuff is from a Rails 2 app, but I don't think *too* much has changed in 3.0 | |
class MaintenanceMigrator < ActiveRecord::Migrator | |
def self.schema_migrations_table_name | |
"#{super}_maintenance" | |
end | |
end | |
# To Run | |
MaintenanceMigrator.migrate("db/maintenance/") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ey web disable -e weplay_p # SITE DOWN | |
ey ssh -e weplay_p --utilities=redisslave # ssh redisslave | |
sudo monit stop redis # stop redis slave | |
ey ssh -e weplay_p --utilities=redismaster # ssh redismaster | |
sudo monit stop redis # stop redis master | |
sudo monit start redis # start redis master | |
tail -f /data/redis/redis.log # wait for log output to indicate dataset is loaded | |
# This should take about 4 minutes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[x] ey recipes upload -e CLOUD_ENV # upload the latest recipes, including the redis upgrade | |
[x] ey web disable -e CLOUD_ENV # take the site down | |
[x] ey rebuild -e CLOUD_ENV # run all of EYs recipes (installs a gem) | |
# and our custom recipes (install redis) | |
[x] sudo monit stop redis on redisslave # stop redis 1.2.2, use ps to ensure it has exited | |
[x] sudo monit stop redis on redismaster |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# code in cookbooks/main/definitions/ey_cloud_report.rb | |
if node[:output_cloud_reporting_locally] | |
# output locally with "puts" statements | |
else | |
# use engineyard's specialized reporting | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
function proml { | |
local BLUE="\[\033[0;34m\]" | |
local RED="\[\033[0;31m\]" | |
local LIGHT_RED="\[\033[1;31m\]" | |
local GREEN="\[\033[0;32m\]" | |
local LIGHT_GREEN="\[\033[1;32m\]" |