Error in airbyte-temporal container setup

Summary

The error indicates that the database ‘temporal’ and ‘temporal_visibility’ already exist, causing permission denied and relation errors. The setup process is unable to create these databases due to existing conflicts.


Question

I’m trying to run local setup.
Here’s my docker-compose file:

  airbyte-server:
    image: airbyte/server:0.40.32
    container_name: airbyte-server
    restart: unless-stopped
    environment:
      - AIRBYTE_VERSION=0.40.32
      - CONFIG_ROOT=/data
      - WORKSPACE_ROOT=/tmp/airbyte_workspace
      - AIRBYTE_LOCAL_ROOT=/tmp/airbyte_local
      - DATABASE_HOST=airbyte-db
      - DATABASE_PORT=5432
      - DATABASE_DB=airbyte
      - DATABASE_USER=airbyte_user
      - DATABASE_PASSWORD=your_db_password
      - DATABASE_URL=jdbc:<postgresql://airbyte-db:5432/airbyte>
      - TEMPORAL_HOST=airbyte-temporal
      - TEMPORAL_PORT=7233
      - LOG_LEVEL=info
    ports:
      - "8001:8001"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - airbyte_data:/data
    depends_on:
      airbyte-db:
        condition: service_healthy
      airbyte-temporal:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "curl", "-f", "<http://localhost:8001/api/v1/health>"]
      interval: 30s
      retries: 3
      start_period: 30s
      timeout: 10s
    networks:
      - temporal_webnet

  airbyte-temporal:
    image: airbyte/temporal:0.40.32
    container_name: airbyte-temporal
    restart: unless-stopped
    environment:
      - DB=postgresql
      - DB_PORT=5432
      - POSTGRES_SEEDS=airbyte-db
      - POSTGRES_USER=airbyte_user
      - POSTGRES_PWD=your_db_password
      - DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development.yaml
      - LOG_LEVEL=debug
    networks:
      - temporal_webnet
    depends_on:
      airbyte-db:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "curl", "-f", "<http://localhost:7233/metrics>"]
      interval: 30s
      retries: 3
      start_period: 30s
      timeout: 10s

  airbyte-webapp:
    image: airbyte/webapp:0.40.32
    container_name: airbyte-webapp
    restart: unless-stopped
    environment:
      - AIRBYTE_ROLE=
      - AIRBYTE_VERSION=0.40.32
      - API_URL=<http://airbyte-server:8001/api/v1/>
      - CONNECTOR_BUILDER_API_URL=
      - INTERNAL_API_HOST=airbyte-server:8001
      - CONNECTOR_BUILDER_API_HOST=
      - OPENREPLAY=
      - PAPERCUPS_STORYTIME=
      - TRACKING_STRATEGY=segment
    ports:
      - "8000:80"
    depends_on:
      airbyte-server:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "curl", "-f", "<http://localhost/api/v1/health>"]
      interval: 30s
      retries: 3
      start_period: 30s
      timeout: 10s
    networks:
      - temporal_webnet

  airbyte-worker:
    image: airbyte/worker:0.40.32
    container_name: airbyte-worker
    restart: unless-stopped
    environment:
      - AIRBYTE_VERSION=0.40.32
      - DATABASE_USER=airbyte_user
      - DATABASE_PASSWORD=your_db_password
      - DATABASE_URL=jdbc:<postgresql://airbyte-db:5432/airbyte>
      - WORKSPACE_ROOT=/tmp/airbyte_workspace
      - WORKSPACE_DOCKER_MOUNT=/tmp/airbyte_workspace
      - CONFIG_ROOT=/data
      - TEMPORAL_HOST=airbyte-temporal:7233
      - LOG_LEVEL=INFO
      - JOB_ERROR_REPORTING_SENTRY_DSN=
      - WEBAPP_URL=<http://airbyte-webapp:80>
      - WORKER_ENVIRONMENT=docker
      - GITHUB_STORE_BRANCH=
      - MICRONAUT_ENVIRONMENTS=control-plane
      - AUTO_DETECT_SCHEMA=true
      - SECRETS_PERSISTENCE=LOCAL
      - LOCAL_ROOT=/tmp/airbyte_local
      - AIRBYTE_API_HOST=<http://airbyte-server:8001>
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - airbyte_workspace:/tmp/airbyte_workspace
      - airbyte_local:/tmp/airbyte_local
      - airbyte_data:/data
    depends_on:
      airbyte-db:
        condition: service_healthy
      airbyte-temporal:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "curl", "-f", "<http://localhost:8080/health>"]
      interval: 30s
      retries: 3
      start_period: 30s
      timeout: 10s
    networks:
      - temporal_webnet

  airbyte-db:
    image: airbyte/db:0.40.32
    container_name: airbyte-db
    restart: unless-stopped
    environment:
      - POSTGRES_DB=airbyte
      - POSTGRES_USER=airbyte_user
      - POSTGRES_PASSWORD=your_db_password
    volumes:
      - airbyte_db_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U airbyte_user"]
      interval: 30s
      retries: 3
      start_period: 30s
      timeout: 10s
    networks:
      - temporal_webnet

volumes:
  airbyte_data:
  airbyte_workspace:
  airbyte_local:
  airbyte_db_data:

networks:
  temporal_webnet:
    external: true```
I got this error on airbyte-tempora:
```docker-compose logs airbyte-temporal
airbyte-temporal  | Start init
airbyte-temporal  | Done init
airbyte-temporal  | PostgreSQL started.
airbyte-temporal  | touch: CONTAINER_ALREADY_STARTED_PLACEHOLDER: Permission denied
airbyte-temporal  | 2024-08-19T04:50:58.788Z	ERROR	Unable to create SQL database.	{"error": "pq: database \"temporal\" already exists", "logging-call-at": "handler.go:97"}
airbyte-temporal  | 2024-08-19T04:50:58.797Z	INFO	Starting schema setup	{"config": {"SchemaFilePath":"","InitialVersion":"0.0","Overwrite":false,"DisableVersioning":false}, "logging-call-at": "setuptask.go:57"}
airbyte-temporal  | 2024-08-19T04:50:58.797Z	DEBUG	Setting up version tables	{"logging-call-at": "setuptask.go:67"}
airbyte-temporal  | 2024-08-19T04:50:58.798Z	ERROR	Unable to setup SQL schema.	{"error": "pq: relation \"schema_version\" already exists", "logging-call-at": "handler.go:57"}
airbyte-temporal  | 2024-08-19T04:50:58.806Z	ERROR	Unable to create SQL database.	{"error": "pq: database \"temporal_visibility\" already exists", "logging-call-at": "handler.go:97"}
airbyte-temporal  | 2024-08-19T04:50:58.814Z	INFO	Starting schema setup	{"config": {"SchemaFilePath":"","InitialVersion":"0.0","Overwrite":false,"DisableVersioning":false}, "logging-call-at": "setuptask.go:57"}
airbyte-temporal  | 2024-08-19T04:50:58.814Z	DEBUG	Setting up version tables	{"logging-call-at": "setuptask.go:67"}
airbyte-temporal  | 2024-08-19T04:50:58.815Z	ERROR	Unable to setup SQL schema.	{"error": "pq: relation \"schema_version\" already exists", "logging-call-at": "handler.go:57"}
airbyte-temporal  | Starting to update the temporal DB
airbyte-temporal  | 2024-08-19T04:50:58.822Z	INFO	UpdateSchemeTask started	{"config": {"DBName":"","TargetVersion":"","SchemaDir":"/etc/temporal/schema/postgresql/v96/temporal/versioned","IsDryRun":false}, "logging-call-at": "updatetask.go:98"}
airbyte-temporal  | 2024-08-19T04:50:58.823Z	DEBUG	found zero updates from current version 1.6	{"logging-call-at": "updatetask.go:128"}
airbyte-temporal  | 2024-08-19T04:50:58.823Z	INFO	UpdateSchemeTask done	{"logging-call-at": "updatetask.go:121"}
airbyte-temporal  | Update the temporal DB is done
airbyte-temporal  | Starting to update the temporal visibility DB
airbyte-temporal  | 2024-08-19T04:50:58.832Z	INFO	UpdateSchemeTask started	{"config": {"DBName":"","TargetVersion":"","SchemaDir":"/etc/temporal/schema/postgresql/v96/visibility/versioned","IsDryRun":false}, "logging-call-at": "updatetask.go:98"}
airbyte-temporal  | 2024-08-19T04:50:58.833Z	DEBUG	found zero updates from current version 1.1	{"logging-call-at": "updatetask.go:128"}
airbyte-temporal  | 2024-08-19T04:50:58.833Z	INFO	UpdateSchemeTask done	{"logging-call-at": "updatetask.go:121"}
airbyte-temporal  | Update the temporal visibility DB is done
airbyte-temporal  | starting temporal server
airbyte-temporal  | Temporal CLI address: 172.18.0.14:7233.
airbyte-temporal  | 2024/08/19 04:50:58 Loading config; env=docker,zone=,configDir=config
airbyte-temporal  | 2024/08/19 04:50:58 Loading config files=[config/docker.yaml]
airbyte-temporal  | {"level":"info","ts":"2024-08-19T04:50:58.851Z","msg":"Updated dynamic config","logging-call-at":"file_based_client.go:143"}
airbyte-temporal  | {"level":"info","ts":"2024-08-19T04:50:58.851Z","msg":"Starting server for services","value":["history","matching","frontend","worker"],"logging-call-at":"server.go:123"}```
How do I resolve this? Thanks

<br>

---

This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. [Click here](https://airbytehq.slack.com/archives/C021JANJ6TY/p1724048751610309) if you want 
to access the original thread.

[Join the conversation on Slack](https://slack.airbyte.com)

<sub>
["docker-compose", "airbyte-temporal", "error", "database", "setup", "permission-denied", "relation"]
</sub>

Docker Compose deployment is deprecated. I strongly recommend you to migrate to abctl or use Kubernetes with Helm.

If you’re not working with an existing instance, I’d highly recommend trying abctl since the Docker Compose method is deprecated:
https://docs.airbyte.com/using-airbyte/getting-started/oss-quickstart