Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<openbox_menu xmlns="http://openbox.org/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://openbox.org/
file:///usr/share/openbox/menu.xsd">
<menu id="root-menu" label="Openbox 3">
<item label="Run Program">
<action name="Execute">
@kaedroho
kaedroho / fig-prod.yml
Created December 11, 2014 23:30
Production Fig configration for wagtail-template based projects
web:
build: .
links:
- postgres
- elasticsearch
- redis
ports:
- "8000:80"
environment:
- "ALLOWED_HOSTS=localhost"
@kaedroho
kaedroho / fig-dev.yml
Created December 11, 2014 23:29
Development Fig configration for wagtail-template based projects
web:
build: .
command: dj runserver 0.0.0.0:80
links:
- postgres
- elasticsearch
- redis
ports:
- "8000:80"
volumes:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'mysite',
'USER': 'mysite',
'PASSWORD': '',
'HOST': os.environ['POSTGRES_PORT_5432_TCP_ADDR'],
'PORT': os.environ['POSTGRES_PORT_5432_TCP_PORT'],
'CONN_MAX_AGE': 600,
}
[uwsgi]
http-socket = :80
module = myproject.wsgi
chmod-socket = 666
master = true
processes = 10
vacuum = true
FROM kaedroho/wagtail-base
MAINTAINER Karl Hobley
# PIP install uwsgi before adding the code so it's cached (and doesn't rebuild from scratch on every run of docker build)
RUN pip install uwsgi
# Add the code and cd to it
ADD . /usr/local/django/mysite
WORKDIR /usr/local/django/mysite
DELETE FROM wagtailimages_rendition WHERE image_id || '-' || filter_id IN (SELECT image_id || '-' || filter_id FROM (SELECT image_id, filter_id, COUNT(*) AS count FROM wagtailimages_rendition GROUP BY image_id, filter_id) AS renditions WHERE count > 1);
# operations.py
class Operation(object):
def __init__(self, image):
self.image = image
def get_args(self):
return ()
def apply(self, backend):
method = getattr(backend, self.method_name)
@kaedroho
kaedroho / useful.txt
Last active August 29, 2015 14:06
Useful stuff
# Fetch media from remote server
rsync -avz -e ssh user@host:/path/to/media/ .
FROM ubuntu:trusty
MAINTAINER Karl Hobley
# Base packages
RUN apt-get update
RUN apt-get install -y build-essential
RUN apt-get install -y python python-dev python-setuptools
RUN apt-get install -y libpq-dev
# PIP