Update README.md
[discourse_docker.git] / README.md
index cd8f8414b717883d80d6f3cfce7ffb19736ae02e..10b6f1abd4186f5f32a0de0c4c6a786d06eb7b65 100644 (file)
--- a/README.md
+++ b/README.md
@@ -3,30 +3,33 @@
 - [Docker](https://www.docker.io/) is an open source project to pack, ship and run any Linux application in a lighter weight, faster container than a traditional virtual machine.
 
 - Docker makes it much easier to deploy [a Discourse forum](https://github.com/discourse/discourse) on your servers and keep it updated. For background, see [Sam's blog post](http://samsaffron.com/archive/2013/11/07/discourse-in-a-docker-container). 
-- 
+
 - The templates and base image configure Discourse with the Discourse team's recommended optimal defaults. 
 
 
-### IMPORTANT: Before you start
+### IMPORTANT: Before You Start
+
+1. Make sure you're running a **64 bit** version of either [Ubuntu 12.04 LTS](http://releases.ubuntu.com/precise/), [Ubuntu 13.04](http://releases.ubuntu.com/13.04/) or [Ubuntu 13.10](http://releases.ubuntu.com/13.10/).
+1. Upgrade to the [latest version of Docker](http://docs.docker.io/en/latest/installation/ubuntulinux/).
+1. Create a directory for Discourse Docker (the expected path is `/var/docker`): `install -g docker -m 2775 -d /var/docker`
+1. Run the docker installation and launcher as **root** or a member of the **docker** group.
+1. Add your user account to the docker group: `usermod -a -G docker yourusername` and re-login.
 
-1. Run docker and launcher as root.
-2. Use [Ubuntu 12.04 LTS](http://releases.ubuntu.com/precise/) or [Ubuntu 13.04](http://releases.ubuntu.com/13.04/) or [Ubuntu 13.10](http://releases.ubuntu.com/13.10/). Device mapper support in docker is still rough.
-3. Upgrade to the [latest version of Docker](http://docs.docker.io/en/latest/installation/ubuntulinux/).
-4. Install Discourse docker into `/var/docker`
+If you do not do any of the above, as RoboCop once said, ["there will be… trouble."](http://www.youtube.com/watch?v=XxarhampSNI) *Please double check the above list before proceeding!*
 
-### Getting started
+### Getting Started
 
 The simplest way to get started is the  **standalone** template:
 
-1. **Clone** this project from github: `git clone https://github.com/SamSaffron/discourse_docker.git /var/docker`
+1. **Clone** this project from github into `/var/docker` on your server: `git clone https://github.com/discourse/discourse_docker.git /var/docker`
 2. **Copy** the standalone sample into the containers directory: `cp samples/standalone.yml containers/app.yml`
 3. **Edit** `containers/app.yml` with your environment specific information
   - [bindings](#expose)
-  - [volumes](#volumes) (make sure you create the appropriate directories on the host)
+  - [volumes](#volumes)
 4. **Bootstrap** the image: `sudo ./launcher bootstrap app`
 5. **Start** the image: `sudo ./launcher start app`
 
-Note: you can add yourself to the docker group if you wish to avoid `sudo` with `usermod -aG docker <your-user-name>`.
+Note: you can add yourself to the Docker group if you wish to avoid `sudo` with `usermod -aG docker <your-user-name>`.
 
 ### Directory Structure
 
@@ -36,7 +39,7 @@ Contains container ids for currently running Docker containers. cids are Docker'
 
 #### `/containers`
 
-This directory is to contain container definitions for your various Discourse containers. You are in charge of this directory, it ships empty.
+This directory is for container definitions for your various Discourse containers. You are in charge of this directory, it ships empty.
 
 #### `/samples`
 
@@ -52,7 +55,7 @@ Placeholder spot for shared volumes with various Discourse containers. You may e
 
 #### `/image`
 
-Dockerfile for both the base image `samsaffron/discoruse_base` and discourse image `samsaffron/discourse`.
+Dockerfile for both the base image `samsaffron/discourse_base` and discourse image `samsaffron/discourse`.
 
 - `samsaffron/discourse_base` contains all the OS dependencies including sshd, runit, postgres, nginx, ruby.
 
@@ -77,7 +80,7 @@ Commands:
 ```
 
 
-### About the container configuration
+### Container Configuration
 
 The beginning of the container definition will contain 3 "special" sections:
 
@@ -96,9 +99,10 @@ This template is "composed" out of all these child templates, this allows for a
 ```
 expose:
   - "2222:22"
+  - "127.0.0.1:20080:80"
 ```
 
-Expose port 22 inside the container on port 2222 on ALL local host interfaces.
+Expose port 22 inside the container on port 2222 on ALL local host interfaces. In order to bind to only one interface, you may specify the host's IP address as `([<host_interface>:[host_port]])|(<host_port>):]<container_port>[/udp]` as defined in the [docker port binding documentation](http://docs.docker.io/en/latest/use/port_redirection/) 
 
 
 #### volumes:
@@ -106,49 +110,57 @@ Expose port 22 inside the container on port 2222 on ALL local host interfaces.
 ```
 volumes:
   - volume:
-      host: /var/docker/data
+      host: /var/docker/shared
       guest: /shared
 
 ```
 
 Expose a directory inside the host inside the container.
 
-### Upgrading discourse
+### Upgrading Discourse
 
-The docker setup gives you multiple upgrade options:
+The Docker setup gives you multiple upgrade options:
 
-1. You can use the front end at http://yoursite.com/admin/docker to upgrade an already running image.
+1. Use the front end at http://yoursite.com/admin/docker to upgrade an already running image.
 
-2. You can create a new base image by running:
-  - `./launcher bootstrap my_image`
+2. Create a new base image by running:
   - `./launcher destroy my_image`
+  - `./launcher bootstrap my_image`
   - `./launcher start my_image`
 
-### Single container vs. Multiple container
+### Single Container vs. Multiple Container
 
-The samples directory contains a standalone (single container) template. This template will bundle all of the programs required to run discourse into a single container. The advantage is that it is very easy to get started as you do not need to wire up communications between containers.
+The samples directory contains a standalone template. This template bundles all of the software required to run Discourse into a single container. The advantage is that it is easy.
 
-However, the disadvantage is that the bootstrapping process will launch a new postgres instance, having 2 postgres instances running against a single directory can lead to unexpected results. Due to that, if you are ever to bootstrap the `standalone` template again you should first stop the existing container.
+The multiple container configuration setup is far more flexible and robust, however it is also more complicated to set up. A multiple container setup allows you to:
 
-A multi images setup allows you to bootstrap new web processes while your site is running and only after it is built, switch the new image in. The setup is far more flexible and robust, however is a bit more complicated to setup. See the `data.yml` and `web_only.yml` templates in the samples directory. To ease this process, `launcher` will inject an env var called `DISCOURSE_HOST_IP` which will be available inside the image.
+- Minimize downtime when upgrading to new versions of Discourse. You can bootstrap new web processes while your site is running and only after it is built, switch the new image in. 
+- Scale your forum to multiple servers.
+- Add servers for redundancy.
+- Have some required services (e.g. the database) run on beefier hardware.
 
-WARNING: If you launch multiple images, **make sure** you setup iptables or some other firewall to protect various ports (for postgres/redis).
+If you want a multiple container setup, see the `data.yml` and `web_only.yml` templates in the samples directory. To ease this process, `launcher` will inject an env var called `DISCOURSE_HOST_IP` which will be available inside the image.
 
-### Email setup
+WARNING: In a multiple container configuration, *make sure* you setup iptables or some other firewall to protect various ports (for postgres/redis).
+On Ubuntu, install the `ufw` or `iptables-persistent` package to manage firewall rules.
 
-For a Discourse instance to function properly Email must be setup. Use the `SMTP_URL` env var to set your SMTP address, see sample templates for an example. The docker image does not contain postfix, exim or another MTA, it was omitted because it is very tricky to set up correctly.
+### Email
 
-### Troubleshooting
+For a Discourse instance to function properly Email must be set up. Use the `SMTP_URL` env var to set your SMTP address, see sample templates for an example. The Docker image does not contain postfix, exim or another MTA, it was omitted because it is very tricky to set up correctly.
 
-It is strongly recommended you have ssh access to your running containers, this allows you very easily take sneak peak of the internals. Simplest way to gain access is:
+### Troubleshooting
 
-1. Run a terminal as root
-2. cd `~/.ssh`
-3. `ssh-key-gen`
-4. paste the contents of `id_rsa.pub` into your templates (see placeholder in samples)
-5. bootstrap and run your container
-6. `./launcher ssh my_container`
+You can ssh into your container using `./launcher ssh my_container`, we will automatically set up ssh access during bootstrap.
 
 ### 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.
+Directory permissions in Linux are UID/GID based, if your numeric IDs on the
+host do not match the IDs 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 UID 1000.
+
+
+### Advanced topics
+
+- [Setting up SSL with Discourse Docker](https://meta.discourse.org/t/allowing-ssl-for-your-discourse-docker-setup/13847)
+- [Multisite configuration with Docker](https://meta.discourse.org/t/multisite-configuration-with-docker/14084)