Running Discourse docker image in the environment on Amazon EC2 Container Service

AI-generated summary

In a discussion about running the Discourse Docker image on Amazon EC2 Container Service, golden_eagle reports issues starting the container, encountering a Ruby error during boot: undefined method '[]' for nil:NilClass. Falco asks for clarification on the deployment process, noting potential misconfigurations in volumes, environment variables, ports, or service dependencies. golden_eagle explains they cloned the official Discourse Docker repo, ran ./discourse-setup, modified app.yml, rebuilt with ./launcher rebuild app, pushed the image to an AWS ECR repository (not Git, despite earlier mention), and created a task definition with two containers — one for Discourse and another for pulling the image — but omitted volumes. Port mappings were set to expose 443 on the host. Falco corrects the misunderstanding about pushing to Git instead of a Docker registry and recommends following the standard EC2 Ubuntu install guide. DanielMarquard suggests alternatives like Elastic Beanstalk and shares external resources. Finally, codinghorror reminds users not to mention names directly to avoid suspension. The core issue appears to stem from incomplete or misconfigured container definitions, particularly missing volumes and possibly incorrect environment setup for Discourse’s dependency on Redis and PostgreSQL.

I have installed discourse. I have the docker image of discourse. Can anybody help me how to run Discourse docker image in the environment on Amazon EC2 Container Service?

I am getting few errors when I m trying to run the task. It’s getting stopped and giving me errors like this in my logs:

I, [2017-06-27T18:26:47.304367 #13] INFO -- : Loading --stdin
/pups/lib/pups/config.rb:23:in `initialize': undefined method `[]' for nil:NilClass (NoMethodError)
from /pups/lib/pups/cli.rb:27:in `new'
from /pups/lib/pups/cli.rb:27:in `run'
from /pups/bin/pups:8:in `<main>'

What was your process to getting the image there in the first place?

You did a local bootstrap, pushed the image to a registry somewhere, and is now trying to run that custom image?

Are all the volumes and env variables the same? Open ports, and db and redis servers accessible?

I will tell you what I did from start. Firstly I cloned the official discourse docker in my terminal. Then did

./discourse-setup

Then Edited containers/app.yml

./launcher rebuild app

Then pushed it on my git account.
Made a repo on AWS EC2 container service.
Then pushed the image that I had on my machine to the EC2 repo.
Then In task definition, I added 2 containers in my task definition. One is discourse and the other is about pulling discourse docker image from the environment I have deployed on as an independent entity.

I was not sure about volumes so I didn’t add it in my task definition.

Here are details of port mapping of my discourse container:

Host Port	Container Port	Protocol
80	                  443	           TCP

Port mapping for another container

Host Port   Container Port    Protocol
0                       443             TCP

@Falco Can you tell me what I did wrong?

git? You want to push the resulting image to a compatible docker registry.

I really recommend using the standard install guide on a standard EC2 Ubuntu.

I pushed it on my git so that I can have some back up if ever I loose my work on my machine. I have pushed the image on my AWS EC2 repo and that is a docker compatible. So we don’t have to worry about git at all. My main question is why is it not working for my EC2 environment?

@Falco

I haven’t deployed Discourse on EC2 Container Service, but at least a few websites have done this with Elastic Beanstalk.

Some resources for you that I’ve stumbled upon in the past:

https://github.com/ento/discourse_aws
http://stroupaloop.com/blog/discourse-setup-using-aws/

Do not mention people’s names in this manner, please, or you will be suspended.