# Towards a v1 version of discourse docker image

**URL:** https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138
**Category:** Feature
**Tags:** rfc, spec
**Created:** [Juillet 3, 2014, 12:45 UTC](https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138 "2014-07-03T00:45:30Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [Juillet 3, 2014, 12:45 UTC](https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138/1 "2014-07-03T00:45:31Z")

</div>

As we march towards v1 I would like us to tighten up our base docker image for release.

Issues I would like to see addressed:

1. Sane/comprehensive logging strategy.
2. Review of cron jobs.
3. Update all software, add missing stuff.
4. Document the base image

### Comprehensive logging strategy

Logging is a bit all-over-the-place, some stuff shows up in `./launcher logs` , some stuff is trapped in `/var/logs`. We need to have sane simple logging story. Log rotation should be running, logs should be pulled out of container in sample configs so you don’t lose a pile of logs on re-bootstrap.

### Review of cron jobs

What cron jobs do we need to run? Does it make sense to even backup discourse seeing it is built in?

### Update all software, add missing stuff.

For v1 we should be on latest ruby 2.0, NGINX should be updated, PG updated to latest stable, OS packages updated. I always trip on VIM missing, I think we should add it.

Anything else?

###Document the base image

Explain what the base image is, what it has and how its configured somewhere. Even as a meta topic.

@supermathie feedbacks? anything missing? Ideally you can take this one.

Also, we should review @honglilai’s [GitHub - phusion/baseimage-docker: A minimal Ubuntu base image modified for Docker-friendliness · GitHub](https://github.com/phusion/baseimage-docker) to see if we want to borrow any concepts.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [Juillet 3, 2014, 8:40 UTC](https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138/2 "2014-07-03T08:40:32Z")

</div>

> [@sam](#):
>
> I always trip on VIM missing, I think we should add it.

This. 👍 +9000

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [Juillet 30, 2014, 8:20 UTC](https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138/3 "2014-07-30T20:20:04Z")

</div>

> [@sam](#):
>
> Sane/comprehensive logging strategy

```
volumes:
  - volume:
      host: /var/docker/shared/app/rails-log
      guest: /shared/log/rails
  - volume:
      host: /var/docker/shared/app/var-log
      guest: /var/log
  - volume:
      host: /var/docker/shared/app/uploads
      guest: /shared/uploads
  - volume:
      host: /var/docker/shared/app/backups
      guest: /shared/backups

```

This lets us pull all of the state right out of the container and leave it on the host filesystem. Log rotation can then also be done from the host or the guest as we decide. The only slightly weird thing is the `/shared/log/rails` mount - it’s there due to the symlinks in the app dir:

```
- ln -s /shared/log/rails $home/log
- ln -s /shared/uploads $home/public/uploads
- ln -s /shared/backups $home/public/backups

```

but I’d rather have it slightly weird there than worry about breaking any existing installs.

So… _how_ do we tell unicorn to rotate logfiles?

---

<div class="post-metadata">

### Author: ![elberet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elberet/32/122404_2.png) [@elberet](https://meta.discourse.org/u/elberet)
#### Post date: [Juillet 30, 2014, 9:14 UTC](https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138/4 "2014-07-30T21:14:54Z")

</div>

Would it be possible to move the container management scripts (i.e. discourse\_docker) out of `/var/docker`? That location is wrong on so many levels…

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [Juillet 31, 2014, 12:28 UTC](https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138/5 "2014-07-31T00:28:45Z")

</div>

This is not trivial to change to say the least.

I wanted all Discourse Docker stuff under one roof and /var/docker seemed like the best compromise.

We could put `./launcher` in `/usr` or `/opt` configuration in `/etc` and data in `/var` but it becomes hard to get a handle of things.

I really like that I can go to any system and just look at `/var/docker` to get a handle on things despite it not being an “ideal” structure.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [Juillet 31, 2014, 12:31 UTC](https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138/6 "2014-07-31T00:31:18Z")

</div>

I much prefer not adding a gazzilion volumes and just keeping shared and going the symlink route.

We should do all log rotation with logrotate in a cron job. Also we should log runits stuff into /logs as opposed to piping it to docker logs which is hard to find and consume.

---

<div class="post-metadata">

### Author: ![Lid](https://avatars.discourse-cdn.com/v4/letter/l/2bfe46/32.png) [@Lid](https://meta.discourse.org/u/Lid)
#### Post date: [Juillet 31, 2014, 1:01 UTC](https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138/7 "2014-07-31T01:01:24Z")

</div>

I also prefer one roof to rule them all approach.

I don’t know why but at first I expected having  
/var/discourse/ rather the /var/docker

but I got used to it by now… so no complains.

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [Juillet 31, 2014, 5:10 UTC](https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138/8 "2014-07-31T05:10:28Z")

</div>

> [@sam](#):
>
> Also, we should review @honglilai’s [GitHub - phusion/baseimage-docker: A minimal Ubuntu base image modified for Docker-friendliness · GitHub](https://github.com/phusion/baseimage-docker) to see if we want to borrow any concepts.

We certainly do - I’ve pulled one in and I’m sure there’s more we can “borrow” 😃

---

<div class="post-metadata">

### Author: ![RabidFX](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rabidfx/32/114395_2.png) [@RabidFX](https://meta.discourse.org/u/RabidFX)
#### Post date: [Juillet 31, 2014, 12:44 UTC](https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138/9 "2014-07-31T12:44:59Z")

</div>

I concur. I personally installed everything under `/var/docker-discourse` because I was afraid of overwriting anything important in `/var/docker` (other containers are used on the same server).

I never ran into trouble so far, but I’m not using evry single configuration option, so I might be in for some surprises…

---

<div class="post-metadata">

### Author: ![elberet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elberet/32/122404_2.png) [@elberet](https://meta.discourse.org/u/elberet)
#### Post date: [Juillet 31, 2014, 8:18 UTC](https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138/10 "2014-07-31T20:18:42Z")

</div>

Well, if you wanted to follow the POSIX norm…

- `launcher` should be called `discoursectl` and live in `/usr/bin`,
- `templates`, `containers`, `scripts` and `samples` go into `/usr/share/discourse`,
- `app.yml` and any others go into `/etc/discourse`,
- and the _var_iable data files belong into `/var/lib/discourse`.

At least if discourse\_docker is installed via package manager. For manual installation, put the launcher and static stuff into `/usr/local/discourse`.

Then again… I’m still not even using Docker. 😆

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [Août 1, 2014, 1:04 UTC](https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138/11 "2014-08-01T01:04:40Z")

</div>

> [@Lid](#):
>
> I don’t know why but at first I expected having  
> /var/discourse/ rather the /var/docker

I kind of agree with this @sam. I like Docker fine but where is OUR branding in that path? Docker could be anything, it is just a container..

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [Août 1, 2014, 1:53 UTC](https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138/12 "2014-08-01T01:53:37Z")

</div>

I don’t mind changing this to /var/discourse really its just a documentation update … nothing else is needed

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [Août 1, 2014, 3:09 UTC](https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138/13 "2014-08-01T03:09:52Z")

</div>

We should make that change before V1 otherwise we are stuck with generic container name path forever.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [Septembre 8, 2014, 3:14 UTC](https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138/14 "2014-09-08T03:14:11Z")

</div>

Is this all complete, can this be closed?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [Septembre 8, 2014, 3:21 UTC](https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138/15 "2014-09-08T03:21:28Z")

</div>

Yes pretty much, closing

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [Septembre 8, 2014, 3:21 UTC](https://meta.discourse.org/t/towards-a-v1-version-of-discourse-docker-image/17138/16 "2014-09-08T03:21:30Z")

</div>


