]> cat aescling's git repositories - mastodon.git/commitdiff
Adding a docker-compose template for running Mastodon easily
authorEugen Rochko <eugen@zeonfederated.com>
Mon, 14 Mar 2016 20:39:39 +0000 (21:39 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Mon, 14 Mar 2016 20:39:39 +0000 (21:39 +0100)
.dockerignore [new file with mode: 0644]
.env.production.sample [new file with mode: 0644]
.gitignore
Dockerfile [new file with mode: 0644]
README.md
config/database.yml
docker-compose.yml [new file with mode: 0644]

diff --git a/.dockerignore b/.dockerignore
new file mode 100644 (file)
index 0000000..4c49bd7
--- /dev/null
@@ -0,0 +1 @@
+.env
diff --git a/.env.production.sample b/.env.production.sample
new file mode 100644 (file)
index 0000000..704eb6b
--- /dev/null
@@ -0,0 +1,5 @@
+REDIS_HOST=redis
+LOCAL_DOMAIN=example.com
+LOCAL_HTTPS=true
+PAPERCLIP_SECRET=
+SECRET_KEY_BASE=
index b4a53fe1bf3da3a31119448a75185dc03f39fec3..a7d30b9e7535c27959c83b402dd3a583c7f1d286 100644 (file)
@@ -17,3 +17,5 @@
 /tmp
 coverage
 public/system
+public/assets
+.env
diff --git a/Dockerfile b/Dockerfile
new file mode 100644 (file)
index 0000000..f569dbe
--- /dev/null
@@ -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
index 273d1a1b31c933625d736d94f6b4885159b0ad39..592e150c02f4fe44711868d6220485c50800bb50 100644 (file)
--- a/README.md
+++ b/README.md
@@ -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
 
@@ -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
index 13e176a2d40393cf804103e8db43d152a4e3d23d..8914ab16d9f3c982c2c7843212655e66f73b51f8 100644 (file)
@@ -2,6 +2,7 @@ default: &default
   adapter: postgresql
   pool: 5
   timeout: 5000
+  encoding: unicode
 
 development:
   <<: *default
@@ -16,4 +17,7 @@ test:
 
 production:
   <<: *default
-  database: mastodon_production
+  database: postgres
+  username: postgres
+  password:
+  host: db
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644 (file)
index 0000000..20fb500
--- /dev/null
@@ -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