Skip to content

Instantly share code, notes, and snippets.

server {
listen 443 default ssl;
server_name *.example.com;
ssl_certificate /etc/nginx/ssl/wildcard.example.com.crt;
ssl_certificate_key /etc/nginx/ssl/wildcard.example.com.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
location / {
server {
listen 80 default;
server_name _;
client_max_body_size 0;
rewrite ^ https://$http_host$request_uri? permanent;
}
server {
listen 443 default ssl;
server_name *.example.com;
#!/bin/bash -el
while read oldrev newrev refname
do
COMMIT=${newrev}
done
generate_archive() {
url="${ARCHIVE_SERVER_WRITE}/"
result=`curl -sNd "path=${1}&refid=${2}" $url`
@jblancett
jblancett / rebuild_routes.py
Created December 29, 2014 19:03
rebuild tsuru routes
#!/usr/bin/env python
import pymongo, redis, os
REDIS_HOST = os.getenv('REDIS_HOST', 'localhost')
REDIS_PORT = os.getenv('REDIS_PORT', 6379)
MONGO_HOST = os.getenv('MONGODB_HOST', 'localhost')
MONGO_PORT = os.getenv('MONGODB_PORT', 27017)
mongo = pymongo.MongoClient(MONGO_HOST, MONGO_PORT)
# see dh_installdeb(1)
# Automatically added by dh_installinit
if [ -x "/etc/init.d/gandalf-server" ]; then
if [ ! -e "/etc/init/gandalf-server.conf" ]; then
update-rc.d gandalf-server defaults >/dev/null
fi
fi
# End automatically added section
# Automatically added by dh_installinit
update-rc.d -f gandalf-server remove >/dev/null || exit $?
hooks:
build:
- bundle exec rake assets:precompile
restart:
before:
- bundle exec rake db:migrate
healthcheck:
path: /users/sign_in
@jblancett
jblancett / migrate_tsuru.py
Created September 23, 2014 20:56
migrate cname in redis and mongodb from tsuru 0.6.2 to 0.7.0
import pymongo, redis, os
REDIS_HOST = os.getenv("REDIS_HOST", "localhost")
REDIS_PORT = os.getenv("REDIS_PORT", 6379)
MONGO_HOST = os.getenv("MONGODB_HOST", "localhost")
MONGO_PORT = os.getenv("MONGODB_PORT", 27017)
redis = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
cnames = redis.keys("cname:*")
@jblancett
jblancett / migrate_tsuru.py
Created September 23, 2014 20:40
migrate cname in redis and mongodb from tsuru 0.6.2 to 0.7.0
import pymongo, redis, os
REDIS_HOST = os.getenv("REDIS_HOST", "localhost")
REDIS_PORT = os.getenv("REDIS_PORT", 6379)
MONGO_HOST = os.getenv("MONGODB_HOST", "localhost")
MONGO_PORT = os.getenv("MONGODB_PORT", 27017)
redis = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
cnames = redis.keys("cname:*")
@jblancett
jblancett / migrate_cname.py
Created September 23, 2014 16:01
migrate cname in redis from tsuru 0.6.2 to 0.7.0
import redis, os
HOST = os.getenv("HOST", "localhost")
PORT = os.getenv("PORT", 6379)
r = redis.StrictRedis(host=HOST, port=PORT)
cnames_app = r.keys("cname:*")
for cname_app in cnames_app:
cname = r.get(cname_app)
@jblancett
jblancett / gist:6c4e3457a03614c22a27
Created August 12, 2014 16:26
knife-linode bootstrap template
<% if @config[:private_ip] %>
(
cat <<'EOP'
# The loopback interface
auto lo
iface lo inet loopback
# Configuration for eth0 and aliases
# This line ensures that the interface will be brought up during boot.