Permalink
Browse files

Integrate s6 and newrelic monitoring on containers

  • Loading branch information...
1 parent 56858b6 commit bd9bb4366ed4a7fde27f0739f36f706aa45030b3 @zedtux committed May 29, 2015
Showing with 27 additions and 3 deletions.
  1. +8 −3 Dockerfile.production
  2. +19 −0 s6/rails_server/run
View
@@ -35,7 +35,8 @@ RUN apt-get install -y ca-certificates && \
mkdir -p /brewformulas/application/ && \
gem install rubygems-update --no-ri --no-rdoc && \
update_rubygems && \
- gem install bundler --no-ri --no-rdoc
+ gem install bundler --no-ri --no-rdoc && \
+ curl -L https://github.com/just-containers/skaware/releases/download/v1.10.0/s6-2.1.3.0-linux-amd64-bin.tar.gz | tar -C / -zx
# ~~~~ Sources Preparation ~~~~
# Prepare gems
@@ -44,7 +45,11 @@ ADD . /brewformulas/application/
RUN bundle install --without development test cucumber --jobs 8 && \
bundle exec rake assets:precompile RAILS_ENV=production
-EXPOSE 3000
+# ~~~~ S6 files ~~~~
+COPY s6 /etc/s6/
+
+# ~~~~ Container configuration ~~~~
+EXPOSE 80
ENTRYPOINT ["bundle", "exec"]
-CMD ["rails", "server", "-b", "0.0.0.0"]
+CMD ["/usr/bin/s6-svscan", "/etc/s6"]
View
@@ -0,0 +1,19 @@
+#!/usr/bin/env sh
+
+if [ -z "$NEW_RELIC_LICENSE_KEY" ]; then
+ echo "WARNING: The NEW_RELIC_LICENSE_KEY variable is undefined"
+ export NEW_RELIC_LICENSE_KEY=$NEWRELIC_LICENSE_KEY
+fi
+
+echo "Starting NewRelic ..."
+/etc/init.d/newrelic-sysmond start
+
+cd /brewformulas/application/
+
+if [ -z "$BREWFORMULAS_WORKER" ]; then
+ echo "Starting Rails server ..."
+ bundle exec rails server -b 0.0.0.0 -p 80
+else
+ echo "Starting workers ..."
+ bundle exec sidekiq
+fi

0 comments on commit bd9bb43

Please sign in to comment.