Skip to content

Instantly share code, notes, and snippets.

View eduardodeoh's full-sized avatar
🏠
Working from home

Eduardo de Oliveira Hernandes eduardodeoh

🏠
Working from home
  • São José do Rio Preto / SP / Brasil
View GitHub Profile
@eduardodeoh
eduardodeoh / statsd
Created October 26, 2012 17:56
Statsd Init Script
#!/bin/bash
#
# /etc/rc.d/init.d/is24-statsd
#
# Starts the is24 statsd daemon
#
# chkconfig: 2345 20 80
# description: Frontend aggregatation of messages destined for graphite daemon
# processname: is24-statsd
@eduardodeoh
eduardodeoh / gist:3964742
Created October 27, 2012 14:04 — forked from chalmerj/gist:1492384
Init script for Graphite carbon-cache
#! /bin/sh
### BEGIN INIT INFO
# Provides: carbon-cache
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: carbon-cache init script
# Description: An init script for Graphite's carbon-cache daemon.
### END INIT INFO
@eduardodeoh
eduardodeoh / gitlab-resque
Created November 1, 2012 00:58
Gitlab Resque Init Script for Ubuntu 12.04
#! /bin/bash
# GITLAB
# Maintainer: @randx
# App Version: 3.0
# Modified by @eduardodeoh (Start GITLAB Resque only)
### BEGIN INIT INFO
# Provides: gitlab
# Required-Start: $local_fs $remote_fs $network $syslog redis-server
@eduardodeoh
eduardodeoh / gunicorn-graphite
Created November 1, 2012 03:56
Init Script for Gunicorn for Graphite
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: GitLab git repository management
# Description: GitLab git repository management
### END INIT INFO
APP_ROOT="/opt/graphite/webapp/graphite"
NAME="gunicorn-graphite"
DESC="Gunicorn Workers"
@eduardodeoh
eduardodeoh / send_metric_to_statsd.sh
Created November 1, 2012 19:37 — forked from nstielau/send_metric_to_statsd.sh
Send a metric to StatsD from bash
# Send a metric to statsd from bash
#
# Useful for:
# deploy scripts (http://codeascraft.etsy.com/2010/12/08/track-every-release/)
# init scripts
# sending metrics via crontab one-liners
# sprinkling in existing bash scripts.
#
# netcat options:
# -w timeout If a connection and stdin are idle for more than timeout seconds, then the connection is silently closed.
@eduardodeoh
eduardodeoh / unicorn_init.sh
Created November 2, 2012 20:21
Unicorn Init
#!/bin/sh
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Manage unicorn server
# Description: Start, stop, restart unicorn server for a specific application.
### END INIT INFO
@eduardodeoh
eduardodeoh / unicorn.rb
Created November 2, 2012 20:38
Unicorn Configuration Example
#APP DIRECTORY
app_dir="/var/www/rails_apps/todolist/current"
# Use at least one worker per core if you're on a dedicated server,
# more will usually help for _short_ waits on databases/caches.
worker_processes 1
# Help ensure your application will always spawn in the symlinked
# "current" directory that Capistrano sets up.
working_directory app_dir
@eduardodeoh
eduardodeoh / nginx.conf
Created November 2, 2012 20:53
Nginx Basic Example
user www-data;
worker_processes 2;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
@eduardodeoh
eduardodeoh / upstream.conf
Created November 2, 2012 21:02
Upstream configuration for nginx
#Upstream for Graphite
upstream graphite_app {
server 127.0.0.1:8000 fail_timeout=0;
}
#Upstream for my app
upstream unicorn-todolist {
server unix:/var/www/rails_apps/todolist/current/tmp/sockets/unicorn.socket fail_timeout=0;
}
@eduardodeoh
eduardodeoh / todolist
Created November 2, 2012 21:05
Todolist - My Rails App conf for nginx
server {
listen 80 default deferred;
server_name app1.eduardodeoh.com.br;
root /var/www/rails_apps/todolist/current/public;
charset utf-8;
location ^~ /assets/ {
gzip_static on;
expires max;