如何在dokku中使用docker compose?

6

我正在尝试在Dokku实例中使用https://github.com/rclement/dokku-matomo来运行Matomo。

这个Dokku设置使用了一个Docker镜像:https://github.com/crazy-max/docker-matomo

上述Dokku设置使用了相当旧版本的docker-matomo镜像(3.5.1)。我尝试更新Dockerfile以拉取crazymax/matomo:latest(3.13.4-RC1),看起来似乎可以,但现在我的Dokku容器返回一个nginx 404。

从我理解的这个问题中:https://github.com/crazy-max/docker-matomo/issues/14需要更新traefik.frontend.rule=Host:matomo.example.com变量在docker-compose.yml的配置,指向我的Dokku主机名。

我已经尝试编辑并将docker-compose.yml文件放置在我的Dokku存储库的根目录下,但它似乎没有效果。我困惑于如何使用docker-compose与Dokku?


在Dokku上安装Matomo非常简单。请记住,所有Dokku应用程序都是在推送时构建的Docker容器。因此,您可以获取一个Docker镜像,重新标记它(如文档中所述)并运行它。对于Matomo,您将需要mysql。只需安装Dokku MySQL插件并使用“--link”命令即可。对于大型组合文件,可能需要一种工具。 - Noah
1个回答

11

您无需使用docker-compose.yml即可部署到Dokku。以下是如何通过直接从Docker Hub拉取镜像来在Dokku上设置docker-matomo的操作步骤。您应该可以通过使用此不同的部署方法重新使用旧数据库。

# Pull image and tag it
docker pull crazymax/matomo:latest
docker tag crazymax/matomo:latest dokku/matomo:v3.13.5

# Create app
dokku apps:create matomo
dokku config:set --no-restart matomo TZ=Europe/Berlin MEMORY_LIMIT=256M UPLOAD_MAX_SIZE=16M OPCACHE_MEM_SIZE=128 REAL_IP_FROM=0.0.0.0/32 REAL_IP_HEADER=X-Forwarded-For LOG_LEVEL=WARN

# Set domain
dokku domains:set matomo matomo.example.com

# Create database
dokku mariadb:create matomo-mariadb

# Create and mount persistent volume
mkdir /var/lib/dokku/data/storage/matomoo
# UID:GUID are set to 101 in the nginx image that crazymax/matomo uses
chown 101:101 /var/lib/dokku/data/storage/matomo
dokku storage:mount matomo /var/lib/dokku/data/storage/matomo:/data

# Add correct proxy ports
dokku proxy:ports-add matomo http:80:8000
dokku proxy:ports-remove matomo http:80:5000

# Deploy app for the first time
dokku tags:deploy matomo v3.13.5

# Setup Let's Encrypt
dokku config:set --no-restart matomo DOKKU_LETSENCRYPT_EMAIL=letsencrypt@example.com
dokku letsencrypt matomo
dokku letsencrypt:auto-renew matomo

# Grep MariaDB information for the setup
dokku mariadb:info mariadb-matomo

我还创建了一个拉取请求来更新rclement/dokku-matomohttps://github.com/rclement/dokku-matomo/pull/2


我会尽快查看PR/更新,非常感谢您的解释和PR! - waffl
这个PR已经合并了,所以你只需要在仓库中checkout master分支! - Michael Gecht

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接