Skip to content

Instantly share code, notes, and snippets.

View jalaziz's full-sized avatar

Jameel Al-Aziz jalaziz

View GitHub Profile
@jalaziz
jalaziz / unicorn.d
Created October 7, 2012 10:19
init.d script for unicorn with RVM
#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# based on git://gist.github.com/504875.git [http://github.com/jaygooby]
# support for RVM on Mac OS X
# Modified by JeremyWei<http://github.com/jeremy>
#
# run the code below, you will get a script named bootup_unicorn in ~/.rvm/bin.
@jalaziz
jalaziz / graphite.nginx
Created October 12, 2012 03:24
uWSGI and nginx configuration for Graphite (assumes /opt/graphite/conf/graphite.wsgi.example has been renamed to /opt/graphite/conf/wsgi.py)
server {
listen 8080 default_server deferred;
charset utf-8;
access_log /var/log/nginx/graphite.access.log;
error_log /var/log/nginx/graphite.error.log;
root /opt/graphite/webapp;
location /static/admin/ {
@jalaziz
jalaziz / carbon-cache.conf
Last active December 14, 2015 08:09
Graphite Upstart + uWSGI + Nginx
description "Graphite Carbon Cache Daemon"
start on runlevel [2345]
stop on runlevel [06]
expect daemon
respawn limit 10 5
chdir /opt/graphite
pre-start exec rm -f /opt/graphite/storage/carbon-cache-a.pid
@jalaziz
jalaziz / riemann-dash.conf
Created March 1, 2013 05:41
Riemann Upstart
description "Riemann Dashboard"
start on runlevel [2345]
stop on runlevel [06]
respawn limit 10 5
setuid riemann
exec riemann-dash
@jalaziz
jalaziz / nginx.conf
Last active December 14, 2015 12:08
html5bp nginx config for Ubuntu
# Set another default user than root for security reasons
user www-data;
# As a thumb rule: One per CPU. If you are serving a large amount
# of static files, which requires blocking disk reads, you may want
# to increase this from the number of cpu_cores available on your
# system.
#
# The maximum number of connections for Nginx is calculated by:
# max_clients = worker_processes * worker_connections
@jalaziz
jalaziz / graphiti.conf
Last active December 14, 2015 19:49
Graphiti Upstart + Unicorn + Nginx
description "Graphiti"
start on runlevel [2345]
stop on runlevel [06]
respawn limit 10 5
chdir /opt/graphiti
kill signal QUIT
exec bundle exec unicorn -c config/unicorn.rb -E production
"""
Queries the slowlog database table maintained by Amazon RDS and outputs it in
the normal MySQL slow log text format. Modified version of the script by
memonic (Thanks!) at https://gist.github.com/1481025
Things to change in this script for your own setup:
<root_user> to your mysql root user (e.g. "root")
<root_pass> to your mysql root password (e.g. "hunter2")
<host_domain> to your mysql root password (e.g. "prod-01.w3rfs2.us-east-1.rds.amazonaws.com")
@jalaziz
jalaziz / redis-command.conf
Created September 16, 2013 08:07
Redis Commander Upstart
description "Redis Commander"
start on runlevel [2345]
stop on runlevel [06]
respawn limit 10 5
setuid www-data
exec redis-commander
@jalaziz
jalaziz / README.md
Last active December 23, 2015 19:39
Localshop upstart and nginx configs -- WIP

Setup

  1. Create a new user on the system:

    adduser --system --group --shell /bin/sh --home /opt/localshop localshop
  2. Clone localshop into /opt/localshop. (as of writing this README, localshop is outdated on pypi)

@jalaziz
jalaziz / RedisConnectionManager.cs
Created September 30, 2013 20:01
Booksleeve Redis Connection Manager
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BookSleeve;
namespace Redis
{
public class RedisConnectionManager : IDisposable
{