Skip to content

Commit

Permalink
Adding a docker-compose template for running Mastodon easily
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron committed Mar 14, 2016
1 parent 6fec8af commit b17202c
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 2 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
5 changes: 5 additions & 0 deletions .env.production.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
REDIS_HOST=redis
LOCAL_DOMAIN=example.com
LOCAL_HTTPS=true
PAPERCLIP_SECRET=
SECRET_KEY_BASE=
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
/tmp
coverage
public/system
public/assets
.env
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ruby:2.2.4

ENV RAILS_ENV=production

RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
RUN mkdir /mastodon

WORKDIR /mastodon

ADD Gemfile /mastodon/Gemfile
ADD Gemfile.lock /mastodon/Gemfile.lock

RUN bundle install --deployment --without test --without development

ADD . /mastodon
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ Mastodon is a federated microblogging engine. An alternative implementation of t
- Mentions and URLs converted to links in statuses
- REST API, including home and mention timelines
- OAuth2 provider system for the API
- Upload header image for profile page

Missing:

- Media attachments (photos, videos)
- UI to post, reblog, favourite, follow and unfollow
- Upload header image for profile page
- Deleting statuses, deletion propagation
- Streaming API

Expand All @@ -34,3 +34,17 @@ Missing:

- PostgreSQL
- Redis

## Running with Docker and Docker-Compose

The project now includes a Dockerfile and a docker-compose.yml. You need to turn .env.production sample into .env.production with all the variables set before you can:

docker-compose build

And finally

docker-compose up

As usual, the first thing you would need to do would be to run migrations:

docker-compose run web rake db:migrate
6 changes: 5 additions & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ default: &default
adapter: postgresql
pool: 5
timeout: 5000
encoding: unicode

development:
<<: *default
Expand All @@ -16,4 +17,7 @@ test:

production:
<<: *default
database: mastodon_production
database: postgres
username: postgres
password:
host: db
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '2'
services:
db:
image: postgres
redis:
image: redis
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
ports:
- "3000:3000"
depends_on:
- db
- redis
env_file: .env.production

0 comments on commit b17202c

Please sign in to comment.