├── launch.bash ├── LICENSE ├── Dockerfile └── README.md /launch.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ -z "$MONGODB_URL" ]; then 3 | export MONGODB_URL="mongodb://mongodb/errbit" 4 | fi 5 | export PATH=/opt/ruby/bin:$PATH 6 | if [ -z "$SECRET_TOKEN" -a ! -f "config/initializers/__secret_token.rb" ]; then 7 | echo "Errbit::Application.config.secret_token = '$(bundle exec rake secret)'" > config/initializers/__secret_token.rb 8 | fi 9 | if [ "$1" == "web" ]; then 10 | bundle exec unicorn -c ./config/unicorn.default.rb 11 | elif [ "$1" == "seed" ]; then 12 | bundle exec rake errbit:bootstrap 13 | elif [ "$1" == "upgrade" ]; then 14 | bundle exec rake db:migrate 15 | bundle exec rake db:mongoid:create_indexes 16 | bundle exec rake db:mongoid:remove_undefined_indexes 17 | else 18 | bundle exec "$@" 19 | fi 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Brian Olsen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | MAINTAINER Brian Olsen 3 | 4 | # Install packages for building ruby 5 | RUN apt-get update 6 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential curl git 7 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y zlib1g-dev libssl-dev libreadline-dev libyaml-dev libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev 8 | 9 | # Install ruby 10 | RUN git clone https://github.com/sstephenson/ruby-build.git /usr/local/ruby-build 11 | ENV RUBY_VERSION 2.1.4 12 | RUN /usr/local/ruby-build/bin/ruby-build $RUBY_VERSION /opt/ruby 13 | 14 | ENV RACK_ENV production 15 | ENV RAILS_ENV production 16 | ENV USE_ENV true 17 | ENV ERRBIT_EMAIL_FROM errbit@example.com 18 | ENV PORT 3000 19 | 20 | # Install bundler 21 | RUN /opt/ruby/bin/gem install bundler 22 | 23 | RUN /usr/sbin/useradd --create-home --home-dir /opt/errbit --shell /bin/bash errbit 24 | USER errbit 25 | 26 | # Install errbit 27 | RUN git clone https://github.com/griff/errbit.git /opt/errbit/app 28 | 29 | WORKDIR /opt/errbit/app 30 | RUN /opt/ruby/bin/bundle install --deployment 31 | RUN PATH=/opt/ruby/bin:$PATH bundle exec rake assets:precompile 32 | 33 | ADD launch.bash /opt/launch.bash 34 | EXPOSE 3000 35 | ENTRYPOINT ["/opt/launch.bash"] 36 | CMD ["web"] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Errbit Docker image 2 | 3 | Dockerfile and repository for running [errbit] in a docker container. 4 | 5 | It is automatically built as [griff/errbit]. 6 | 7 | The short version of how to get it running: 8 | ``` 9 | docker run -d --name mongodb mongo 10 | docker run --rm --link mongodb:mongodb griff/errbit seed 11 | docker run -d --name errbit --link mongodb:mongodb -p 3000:3000 griff/errbit 12 | ``` 13 | 14 | And then point your browser at ```http://localhost:3000``` 15 | 16 | 17 | ## Configuration 18 | 19 | The image supports configuration using environment variables. 20 | See the errbit documentation for list of [available variables]. 21 | 22 | ### Changing the port 23 | 24 | Normally you don't need to change the port inside the container because you 25 | can just change what the port is published as while still keeping the same 26 | port inside the container. 27 | 28 | In short you can do this to have errbit be on port 5000: 29 | 30 | ``` 31 | docker run -d --name errbit --link mongodb:mongodb -p 5000:3000 griff/errbit 32 | ``` 33 | 34 | But should you need to change the port inside the container you can do so by 35 | setting the ```PORT``` environment variable like this: 36 | 37 | ``` 38 | docker run -d --name errbit --link mongodb:mongodb -e PORT=5000 -p 5000:5000 griff/errbit 39 | ``` 40 | 41 | ## Upgrade 42 | 43 | To upgrade you need to replace the errbit container and upgrade the database. 44 | ``` 45 | docker stop errbit 46 | docker rm errbit 47 | docker pull griff/errbit 48 | docker run --rm --link mongodb:mongodb griff/errbit upgrade 49 | docker run -d --name errbit --link mongodb:mongodb -p 3000:3000 griff/errbit 50 | ``` 51 | 52 | [errbit]: https://github.com/errbit/errbit 53 | [griff/errbit]: https://hub.docker.com/r/griff/errbit/ 54 | [available variables]: https://github.com/errbit/errbit/blob/master/docs/configuration.md 55 | --------------------------------------------------------------------------------