Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .docker/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

/etc/init.d/redis-server restart
cd bennett && rake bennett:start


#wtf? avoid shell exits after "docker run -d <image>"
cd bennett; tail -f log/*
54 changes: 54 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
FROM ubuntu:12.04
MAINTAINER zdkaster "nx2zdk@gmail.com"

# apt-get deps

RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list

RUN apt-get update -y
RUN apt-get install -y -q sudo
RUN apt-get install -y -q git
RUN apt-get install -y -q build-essential
RUN apt-get install -y -q libicu-dev
RUN apt-get install -y -q gcc
RUN apt-get install -y -q make
RUN apt-get install -y -q g++
RUN apt-get install -y -q libc6-dev
RUN apt-get install -y -q redis-server
RUN apt-get install -y -q curl
RUN apt-get install -y -q libssl-dev
RUN apt-get install -y -q zlib1g-dev
RUN apt-get install -y -q sendmail

EXPOSE 6379

#Install rbenv ruby 1.9.3-p327 and bundler

RUN git clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv
RUN mkdir /usr/local/rbenv/plugins
RUN git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build

ENV RBENV_ROOT /usr/local/rbenv
ENV PATH /usr/local/rbenv/shims:/usr/local/rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

RUN rbenv install 1.9.3-p327

ENV RBENV_VERSION 1.9.3-p327

RUN gem install bundler
ENV PATH /usr/local/rbenv/versions/1.9.3-p327/bin:${PATH}

#Deploy Bennnet

RUN apt-get install -y -q libsqlite3-dev
RUN apt-get install -y -q nodejs
RUN apt-get install -y -q cron

RUN git clone https://github.com/zdk/bennett -b deploy-docker
ENV RAILS_ENV production
RUN (cd bennett && bundle install && rake bennett:setup)
EXPOSE 4000
ADD ./.docker/start.sh ./start.sh
RUN chmod +x ./start.sh
EXPOSE 4000
CMD ["./start.sh"]
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,23 @@ It is designed to be full-featured yet simple to use, somewhere half-way between
![](http://platypus.belighted.com/bennett/bennett_scr1.png)
![](http://platypus.belighted.com/bennett/bennett_scr2.png)

## Quick Setup using Docker
- Install Docker, check installation details at https://www.docker.io/gettingstarted/#h_installation

- After docker installed, then pull bennett-docker image

docker pull zdkaster/bennett-docker

or

`git clone git@github.com:belighted/bennett.git -b deploy-docker`

`docker build -t zdkaster/bennett-docker .`

- Run a new container using zdkaster/bennett-docker image

docker run -d -p :4000 zdkaster/bennett-docker

## Setup

#### Redis
Expand Down
6 changes: 5 additions & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@
config.active_support.deprecation = :notify

config.action_mailer.delivery_method = :sendmail
HOST = "ci.belighted.com"

config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true

HOST = ENV['HOSTNAME'] || "ci.belighted.com"
config.action_mailer.default_url_options = {
:host => HOST,
}
Expand Down
33 changes: 16 additions & 17 deletions config/redis.conf
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ dbfilename redis_dump.rdb
# Also the Append Only File will be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir db/

################################# REPLICATION #################################

Expand Down Expand Up @@ -176,7 +175,7 @@ slave-serve-stale-data yes
#
# maxclients 128

# Don't use more memory than the specified amount of bytes.
# Don't use more memory than the d amount of bytes.
# When the memory limit is reached Redis will try to remove keys with an
# EXPIRE set. It will try to start freeing keys that are going to expire
# in little time and preserve keys with a longer time to live.
Expand Down Expand Up @@ -310,8 +309,8 @@ no-appendfsync-on-rewrite no
# Specify a precentage of zero in order to disable the automatic AOF
# rewrite feature.

auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
#auto-aof-rewrite-percentage 100
#auto-aof-rewrite-min-size 64mb

################################## SLOW LOG ###################################

Expand Down Expand Up @@ -351,7 +350,7 @@ slowlog-max-len 1024
# To enable VM just set 'vm-enabled' to yes, and set the following three
# VM parameters accordingly to your needs.

vm-enabled no
#vm-enabled no
# vm-enabled yes

# This is the path of the Redis swap file. As you can guess, swap files
Expand All @@ -365,7 +364,7 @@ vm-enabled no
# *** WARNING *** if you are using a shared hosting the default of putting
# the swap file under /tmp is not secure. Create a dir with access granted
# only to Redis user and configure Redis to create the swap file there.
vm-swap-file redis.swap
#vm-swap-file redis.swap

# vm-max-memory configures the VM to use at max the specified amount of
# RAM. Everything that deos not fit will be swapped on disk *if* possible, that
Expand All @@ -375,7 +374,7 @@ vm-swap-file redis.swap
# default, just specify the max amount of RAM you can in bytes, but it's
# better to leave some margin. For instance specify an amount of RAM
# that's more or less between 60 and 80% of your free RAM.
vm-max-memory 0
#vm-max-memory 0

# Redis swap files is split into pages. An object can be saved using multiple
# contiguous pages, but pages can't be shared between different objects.
Expand All @@ -386,7 +385,7 @@ vm-max-memory 0
# If you use a lot of small objects, use a page size of 64 or 32 bytes.
# If you use a lot of big objects, use a bigger page size.
# If unsure, use the default :)
vm-page-size 32
#vm-page-size 32

# Number of total memory pages in the swap file.
# Given that the page table (a bitmap of free/used pages) is taken in memory,
Expand All @@ -399,7 +398,7 @@ vm-page-size 32
#
# It's better to use the smallest acceptable value for your application,
# but the default is large in order to work in most conditions.
vm-pages 134217728
#vm-pages 134217728

# Max number of VM I/O threads running at the same time.
# This threads are used to read/write data from/to swap file, since they
Expand All @@ -410,35 +409,35 @@ vm-pages 134217728
#
# The special value of 0 turn off threaded I/O and enables the blocking
# Virtual Memory implementation.
vm-max-threads 4
#vm-max-threads 4

############################### ADVANCED CONFIG ###############################

# Hashes are encoded in a special way (much more memory efficient) when they
# have at max a given numer of elements, and the biggest element does not
# exceed a given threshold. You can configure this limits with the following
# configuration directives.
hash-max-zipmap-entries 512
hash-max-zipmap-value 64
#hash-max-zipmap-entries 512
#hash-max-zipmap-value 64

# Similarly to hashes, small lists are also encoded in a special way in order
# to save a lot of space. The special representation is only used when
# you are under the following limits:
list-max-ziplist-entries 512
list-max-ziplist-value 64
#list-max-ziplist-entries 512
#list-max-ziplist-value 64

# Sets have a special encoding in just one case: when a set is composed
# of just strings that happens to be integers in radix 10 in the range
# of 64 bit signed integers.
# The following configuration setting sets the limit in the size of the
# set in order to use this special memory saving encoding.
set-max-intset-entries 512
#set-max-intset-entries 512

# Similarly to hashes and lists, sorted sets are also specially encoded in
# order to save a lot of space. This encoding is only used when the length and
# elements of a sorted set are below the following limits:
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
#zset-max-ziplist-entries 128
#zset-max-ziplist-value 64

# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
# order to help rehashing the main Redis hash table (the one mapping top-level
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/bennett.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace :bennett do
task :start do
Rails.env = ENV['RAILS_ENV'] || 'production'
system <<-CMD
redis-server config/redis.conf
redis-server #{Rails.root}/config/redis.conf
CMD
Rake::Task['workers:restart'].invoke
Rake::Task['unicorn:restart'].invoke
Expand Down