技術文章 - CS327927

Mapping docker PostgreSQL volumes as per documentation in docker-compose-postgres.yml file causes creation of unhealthy container in Ubuntu

修改時間: 21-Feb-2024   


套用到

  • ThingWorx Platform 8.5 to 9.3
  • Ubuntu

描述

  • Mapping docker PostgreSQL volumes as per documentation in docker-compose-postgres.yml file causes creation of unhealthy container
  • Using docker-compose on following docker-compose-postgres.yml creates unhealthy container :
version: '2.2'

services:
  postgresql:
    image: thingworx/postgres-db:latest
    ports:
      - "5432"
    healthcheck:
      test: pg_isready -U postgres
      interval: 15s
    environment:
      - "POSTGRES_USER=postgres"
      - "POSTGRES_PASSWORD=<Password>"
      - "POSTGRES_DB=postgres"
      # NOTE: Set TWX_DATABASE_USERNAME, TWX_DATABASE_PASSWORD TWX_DATABASE_SCHEMA for
      # the thingworx database setup that will be created in this database.
      - "TWX_DATABASE_USERNAME=twadmin"
      - "TWX_DATABASE_SCHEMA=twadmin"
      - "TWX_DATABASE_PASSWORD=<Password>"
    volumes:
      - "./thingworx-postgres-storage/ThingworxPostgresqlStorage:/ThingworxPostgresqlStorage"
      - "./thingworx-postgres-storage/postgres-data:/var/lib/postgresql/data"

  platform:
    image: thingworx/platform-postgres:latest
    healthcheck:
      test: curl -f localhost:8080/Thingworx/health
      interval: 15s
    depends_on:
      postgresql:
        condition: service_healthy
    ports:
      - "8081:8080"
      - "8443:8443"
    environment:
      - "ENABLE_CLUSTERED_MODE=false"
      - "INITIAL_HEAP=2"
      - "MAX_HEAP=4"
      - "DATABASE_HOST=postgresql"
      - "DATABASE_PORT=5432"
      - "DATABASE_ADMIN_USERNAME=postgres"
      - "DATABASE_ADMIN_PASSWORD=<Password>"
      - "DATABASE_ADMIN_SCHEMA=postgres"
      # NOTE: Set TWX_DATABASE_USERNAME, TWX_DATABASE_PASSWORD TWX_DATABASE_SCHEMA for
      # the thingworx database setup that will either be created by the docker image,
      # or connected to if it already exists.
      - "TWX_DATABASE_USERNAME=twadmin"
      - "TWX_DATABASE_SCHEMA=twadmin"
      - "TWX_DATABASE_PASSWORD=<Password>"
      # NOTE: The following must be set for the Platform to start. This will be
      # the initial Administrator password.
      - "THINGWORX_INITIAL_ADMIN_PASSWORD=<Password>"
      - "ENABLE_HTTP=true"
      - "ENABLE_HTTPS=false"
    volumes:
      - "./thingworx-postgres-storage/ThingworxPlatform:/ThingworxPlatform"
      - "./thingworx-postgres-storage/ThingworxStorage:/ThingworxStorage"
      - "./thingworx-postgres-storage/ThingworxBackupStorage:/ThingworxBackupStorage"
      - "./thingworx-postgres-storage/tomcat-logs:/opt/apache-tomcat/logs"
  • postgres container reports error
database “thingworx” does not exist

 
This is a PDF version of Article 327927 and may be out of date. For the latest version CS327927