0

我正在尝试在 AWS EC2 上运行mattermost-docker 4.10.1 。

我希望我的app容器连接到自定义 AWS RDS。所以我对文件进行了以下更改docker-compose.yml

  1. 移除db容器。
  2. 使用团队版本。
  3. 更改数据库连接信息。

```

 version: "2"

 services:
-
-  db:
-    build: db
-    read_only: true
-    restart: unless-stopped
-    volumes:
-      - ./volumes/db/var/lib/postgresql/data:/var/lib/postgresql/data
-      - /etc/localtime:/etc/localtime:ro
-    environment:
-      - POSTGRES_USER=mmuser
-      - POSTGRES_PASSWORD=mmuser_password
-      - POSTGRES_DB=mattermost
-    # uncomment the following to enable backup
-    #  - AWS_ACCESS_KEY_ID=XXXX
-    #  - AWS_SECRET_ACCESS_KEY=XXXX
-    #  - WALE_S3_PREFIX=s3://BUCKET_NAME/PATH
-    #  - AWS_REGION=us-east-1
-
   app:
     build:
       context: app
       # comment out following lines for team edition or change UID/GID
-      # args:
-      #   - edition=team
-      #   - PUID=1000
-      #   - PGID=1000
+      args:
+        - edition=team
+        - PUID=1000
+        - PGID=1000
     restart: unless-stopped
     volumes:
       - ./volumes/app/mattermost/config:/mattermost/config:rw
@@ -35,12 +17,17 @@ services:
       - /etc/localtime:/etc/localtime:ro
     environment:
       # set same as db credentials and dbname
-      - MM_USERNAME=mmuser
-      - MM_PASSWORD=mmuser_password
-      - MM_DBNAME=mattermost
+      - MM_USERNAME=myusername
+      - MM_PASSWORD=mypassword
+      - MM_DBNAME=my-mattermost
+      - DB_HOST=myrds.rds.amazonaws.com
+      - DB_PORT_NUMBER=3306
+      - MM_SQLSETTINGS_DRIVERNAME=mysql
+      - 

MM_SQLSETTINGS_DATASOURCE="myusername:mypassword@tcp(myrds.rds.amazonaws.com:3306)/my-mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s"

+
       # in case your config is not in default location
       #- MM_CONFIG=/mattermost/config/config.json
-
   web:
     build: web
     ports:
@@ -52,6 +39,6 @@ services:
       # This directory must have cert files if you want to enable SSL
       - ./volumes/web/cert:/cert:ro
       - /etc/localtime:/etc/localtime:ro
-    # Uncomment for SSL
-    # environment:
-    #  - MATTERMOST_ENABLE_SSL=true
+    environment:
+      - APP_HOST=app
+

```

然后Failed to ping DB retrying in 10 seconds err=time: unknown unit s\" in duration 30s\"当我使用docker-compose up -d.

错误信息可以在 中找到volumes/app/mattermost/logs/mattermost.log

为什么会这样?我没有在配置文件中找到任何指定时间单位的内容。

我已经确认我的 EC2 能够通过运行连接到我的 RDS mysql -h myrds.rds.amazonaws.com -umyusername -pmypassword

有人知道如何db用 AWS RDS 替换最重要的容器吗?

4

1 回答 1

1

MM_SQLSETTINGS_DATASOURCE变量中删除双引号后,问题就解决了。

我的意思是我换行MM_SQLSETTINGS_DATASOURCE="myusername:mypassword@tcp(myrds.rds.amazonaws.com:3306)/my-mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s"

MM_SQLSETTINGS_DATASOURCE=myusername:mypassword@tcp(myrds.rds.amazonaws.com:3306)/my-mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s

于 2018-07-18T06:18:10.090 回答