使用 Portainer 安装 Discourse

I use Portainer to manage my Containers. I wanted to install Discourse in a new container but I’m unable to do so. If anyone can help me with this would be appreciated.

WHAT I TRIED?
I read the GitHub File and tried to follow it but I was unable to run console commands as I have not created a container. So I created/cloned an image of Discourse in DockerHub and installed it through Portainer but when I run it says exited with error code 0.

Why is this unsupported install @rishabh? Portainer is just a Docker Control Panel.

Because they only support one installation type, which is in a clean VPS where all the modifications and scripts run without any issue. Anything else is a custom installation and they won’t support it as the ways to use containers is infinite.

To be able to install Discourse, you need to run the bootstrapping done via the launcher utility. If you can add scripts to Portainer it should be relatively easy to do. Or you can just install Discourse in a VPS and push the resulting container to see if that works.

Other way, which could be easier is to decouple everything and deploy them individually, this means (in no way a complete list):

  • PostgreSQL
  • Redis
  • Unicorns
  • Discourse
1 个赞

Yes we have only one official install largely to allow our community to support it well. If we had more, it would be difficult for everyone to provide quality troubleshooting and setup advice.

4 个赞

What you’ll need to do is use ./launcher to build your container and then launch it with portainer, passing all of the environment variables needed.

See Can Discourse ship frequent Docker images that do not need to be bootstrapped? for more discussion.

The easy solution that you can get free help with is to follow the official install instructions. If you need help with portainer and have a budget you can ask in marketplace or contact me. I’m not familiar with portainer, but have built containers to launch with other tools.

1 个赞

不想显得无知,这个启动器实用程序在哪里?我查看了我拉取的 Docker 镜像的 /discourse 路径,但找不到任何脚本……再次,也许我看错了?我可能会运行一个标准的 Ubuntu Docker 容器并自己配置它进行测试,就像标准安装一样?

找到了类似以下的说明:
获取 Bitnami Discourse Docker 镜像的推荐方法是从 Docker Hub Registry 拉取预构建镜像。

docker pull bitnami/discourse:latest

要使用特定版本,您可以拉取版本化的标签。您可以在 Docker Hub Registry 中查看可用版本列表

docker pull bitnami/discourse:[TAG]

如果需要,您也可以通过克隆仓库、切换到包含 Dockerfile 的目录并执行 docker build 命令来自己构建镜像。请记住将下面示例命令中的 APPVERSIONOPERATING-SYSTEM 路径占位符替换为正确的值。

git clone https://github.com/bitnami/containers.git
cd bitnami/APP/VERSION/OPERATING-SYSTEM
docker build -t bitnami/APP:latest .

如何使用此镜像

Discourse 需要访问 PostgreSQL 数据库来存储信息。我们将使用 Bitnami PostgreSQL Docker 镜像⁠ 来满足数据库需求。

使用 Docker 命令行

步骤 1:创建网络

docker network create discourse-network

步骤 2:创建用于 PostgreSQL 持久化的卷并创建 PostgreSQL 容器

$ docker volume create --name postgresql_data
docker run -d --name postgresql \
  --env ALLOW_EMPTY_PASSWORD=yes \
  --env POSTGRESQL_USERNAME=bn_discourse \
  --env POSTGRESQL_PASSWORD=bitnami123 \
  --env POSTGRESQL_DATABASE=bitnami_discourse \
  --network discourse-network \
  --volume postgresql_data:/bitnami/postgresql \
  bitnami/postgresql:latest

步骤 3:创建用于 Redis 持久化的卷并创建 Redis 容器

$ docker volume create --name redis_data
docker run -d --name redis \
  --env ALLOW_EMPTY_PASSWORD=yes \
  --network discourse-network \
  --volume redis_data:/bitnami/redis \
  bitnami/redis:latest

步骤 4:创建用于 Discourse 持久化的卷并启动容器

$ docker volume create --name discourse_data
docker run -d --name discourse \
  -p 8080:8080 -p 8443:8443 \
  --env ALLOW_EMPTY_PASSWORD=yes \
  --env DISCOURSE_DATABASE_USER=bn_discourse \
  --env DISCOURSE_DATABASE_PASSWORD=bitnami123 \
  --env DISCOURSE_DATABASE_NAME=bitnami_discourse \
  --env DISCOURSE_HOST=www.example.com \
  --network discourse-network \
  --volume discourse_data:/bitnami/discourse \
  bitnami/discourse:latest

步骤 5:启动 Sidekiq 容器

docker run -d --name sidekiq \
  --network discourse-network \
  --volume discourse_data:/bitnami/discourse \
  bitnami/discourse:latest /opt/bitnami/scripts/discourse-sidekiq/run.sh

http://your-ip/ 访问您的应用程序

使用 Docker Compose 运行应用程序
curl -sSL https://raw.githubusercontent.com/bitnami/containers/main/bitnami/discourse/docker-compose.yml > docker-compose.yml
docker-compose up -d

请注意,此文件未经内部测试。因此,我们建议仅将其用于开发或测试目的。对于生产就绪的部署,我们强烈建议使用其关联的 Bitnami Helm chart⁠

如果您在 docker-compose.yaml 文件中发现任何问题,请随时通过遵循我们的贡献指南⁠ 来报告或贡献修复。

故障排除 discourse

如果您需要运行 discourse 管理命令,例如从控制台创建管理员帐户⁠,您可以通过在容器内执行 shell 并使用正确的环境变量来运行。

cd /opt/bitnami/discourse
RAILS_ENV=production bundle exec rake admin:create