improve readme
[discourse_docker.git] / README.md
CommitLineData
408a9c19
SS
1##Discourse Docker
2
3A toolkit for building and managing Docker images for Discourse.
4
5### About
6
7The Discourse docker templates were designed by Sam Saffron. See the following introduction: http://samsaffron.com/archive/2013/11/07/discourse-in-a-docker-container
8
9These templates are agnostic, you may run Discourse in multiple containers or a single container.
10
11The templates and base image take care of configuring Discourse with best practices in mind. The latest version of Ruby 2.0 is included as is fairly extensive memory and GC tuning. The web template uses unicorn which helps cut down on overall memory usage making this very suitable for VPS type installs.
12
cd0f828e
SS
13###Getting started
14
15The simplest (though slightly more fragile) way of getting started is using the standalone template.
16
17- `cp samples/standalone.yml containers/app.yml`
18- **Edit** app.yml with your environment specific information, including binds and volumes
19- `sudo ./launcher bootstrap app`
20- `sudo ./launcher start app`
21
22Note: you can add yourself to the docker group if you wish to avoid `sudo` with `usermod -a -G docker your-user-name`.
23
408a9c19
SS
24### Directory Structure
25
26- cids
27
28Contains container ids for currently running Docker containers. cids are Docker's "equivalent" of pids. Each container will have a unique git like hash.
29
30- containers
31
32This directory is to contain container definitions for your various Discourse containers. You are in charge of this directory, it ships empty.
33
34- samples
35
36Sample container definitions you may use to bootstrap your environment. You can copy and amend templates here into the containers directory.
37
38- shared
39
40Placeholder spot for shared volumes with various Discourse containers. You may elect to store certain persistent information outside of a container, in our case we keep various logfiles and upload directory outside. This allows you to rebuild containers easily without losing important information. Keeping uploads outside of the container allows you to share them between multiple web instances.
41
42- templates
43
44[pups](https://github.com/samsaffron/pups) managed pups templates you may use to bootstrap your environment.
45
46- image
47
48Dockerfile for both the base image `samsaffron/discoruse_base` and discourse image `samsaffron/discourse`.
49
50`samsaffron/discourse_base` contains all the OS dependencies including sshd, runit, postgres, nginx, ruby.
51
52`samsaffron/discourse` builds on the base image and configures a discourse user and `/var/www/discourse` directory for the Discourse source.
53
54The Docker repository will always contain the latest built version at: https://index.docker.io/u/samsaffron/discourse/ , you should not need to build the base image.
55
56###launcher
57
58The base directory contains a single bash script which is used to manage containers. You can use it to "bootstrap" a new container, ssh in, start, stop and destroy a container.
59
60```
61Usage: launcher COMMAND CONFIG
62Commands:
63 start: Start/initialize a container
64 stop: Stop a running container
65 restart: Restart a container
66 destroy: Stop and remove a container
67 ssh: Start a bash shell in a running container
68 logs: Docker logs for container
69 bootstrap: Bootstrap a container for the config based on a template
70```
71
408a9c19
SS
72
73###About the container configuration
74
75The beggining of the container definition will contain 3 "special" sections:
76
77- templates:
78
79```
80templates:
81 - "templates/cron.template.yml"
82 - "templates/postgres.template.yml"
83```
84
85This template is "composed" out of all these child templates, this allows for a very flexible configuration struture. Further more you may add specific hooks that extend the templates you reference.
86
87- expose:
88
89```
90expose:
91 - "2222:22"
92```
93
94Expose port 22 inside the container on port 2222 on ALL local host interfaces.
95
96
97- volumes:
98
99```
100volumes:
101 - volume:
102 host: /var/docker/data
103 guest: /shared
104
105```
106
107Expose a directory inside the host inside the container.
108
109*short note about security* Directory permissions in Linux are sid based, if your sids on the host do not match the sids in the guest, permissions will mismatch. On clean installs you can ensure they are in sync by looking at `/etc/passwd` and `/etc/group`, the discourse account will have the sid 1000.
110
111
112
113
114