# Local Cluster, external persistence

**URL:** <https://community.temporal.io/t/local-cluster-external-persistence/5891>\
**Category:** Community Support\
**Tags:** postgresql\
**Created:** [September 5, 2022, 10:57pm UTC](https://community.temporal.io/t/local-cluster-external-persistence/5891 "2022-09-05T22:57:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tstepro](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tstepro/32/666_2.png) [@tstepro](https://community.temporal.io/u/tstepro)\
**Post date:** [September 5, 2022, 10:57pm UTC](https://community.temporal.io/t/local-cluster-external-persistence/5891/1 "2022-09-05T22:57:07Z")

</div>

I’d like to create a temporal cluster locally but spin up persistence in a hosted postgres instance. I’ve been hacking away with some of the docker-compose examples but keep running into tls issues when attempting to connect to the persistence layer.

Before I start another thread on the specific errors, is there a good guide for doing something like this?

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [September 5, 2022, 11:18pm UTC](https://community.temporal.io/t/local-cluster-external-persistence/5891/2 "2022-09-05T23:18:35Z")

</div>

What issues are you running into?  
[Here](https://github.com/temporalio/temporal/blob/master/docker/config_template.yaml) is the docker template for reference.  
[This](https://community.temporal.io/t/run-mysql-database-outside-of-docker/2694/9) forum post has a sample compose file with mysql running locally.  
Would encourage you not to use auto-setup server image for anything but local testing. [Here](https://github.com/tsurdilo/my-temporal-dockercompose#deploying-without-auto-setup) is a sample compose that deploys each server role in own container.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![tstepro](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tstepro/32/666_2.png) [@tstepro](https://community.temporal.io/u/tstepro)\
**Post date:** [September 6, 2022, 7:22pm UTC](https://community.temporal.io/t/local-cluster-external-persistence/5891/3 "2022-09-06T19:22:19Z")

</div>

Thank you for the reply! That does help.

Here’s what I’m trying to do:

I want to point my local cluster to a postgres instance hosted on [render.com](http://render.com). I’ve been able to spin up a postgres instance and created the temporal, temporal\_visibility dbs.

Here’s my docker-compose:

```auto
version: "3.5"
services:
  elasticsearch:
    container_name: temporal-elasticsearch
    environment:
      - cluster.routing.allocation.disk.threshold_enabled=true
      - cluster.routing.allocation.disk.watermark.low=512mb
      - cluster.routing.allocation.disk.watermark.high=256mb
      - cluster.routing.allocation.disk.watermark.flood_stage=128mb
      - discovery.type=single-node
      - ES_JAVA_OPTS=-Xms256m -Xmx256m
      - xpack.security.enabled=false
    image: elasticsearch:${ELASTICSEARCH_VERSION}
    networks:
      - temporal-network
    expose:
      - 9200
  temporal:
    container_name: temporal
    depends_on:
      - elasticsearch
    environment:
      - SQL_TLS=true
      - SQL_TLS_ENABLED=true
      - SQL_HOST_VERIFICATION=false
      - DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development-sql.yaml
      - DB=postgresql
      - SKIP_DB_CREATE=true
      - POSTGRES_USER=<USER>
      - POSTGRES_PWD=<PWD>
      - DB_PORT=5432
      - POSTGRES_SEEDS=<POSTGRES_HOST>
      - ENABLE_ES=true
      - ES_SEEDS=elasticsearch
      - ES_VERSION=v7
    image: temporalio/auto-setup:${TEMPORAL_VERSION}
    networks:
      - temporal-network
    ports:
      - 7233:7233
    labels:
      kompose.volume.type: configMap
    volumes:
      - ./dynamicconfig:/etc/temporal/config/dynamicconfig
  temporal-admin-tools:
    container_name: temporal-admin-tools
    depends_on:
      - temporal
    environment:
      - TEMPORAL_CLI_ADDRESS=temporal:7233
    image: temporalio/admin-tools:${TEMPORAL_VERSION}
    networks:
      - temporal-network
    stdin_open: true
    tty: true
  temporal-ui:
    container_name: temporal-ui
    depends_on:
      - temporal
    environment:
      - TEMPORAL_ADDRESS=temporal:7233
      - TEMPORAL_CORS_ORIGINS=http://localhost:3000
    image: temporalio/ui:${TEMPORAL_UI_VERSION}
    networks:
      - temporal-network
    ports:
      - 8080:8080
  temporal-web:
    container_name: temporal-web
    depends_on:
      - temporal
    environment:
      - TEMPORAL_GRPC_ENDPOINT=temporal:7233
      - TEMPORAL_PERMIT_WRITE_API=true
    image: temporalio/web:${TEMPORAL_WEB_VERSION}
    networks:
      - temporal-network
    ports:
      - 8088:8088
networks:
  temporal-network:
    driver: bridge
    name: temporal-network

```

I can see the auto-setup logs from this [script](https://github.com/temporalio/docker-builds/blob/main/docker/auto-setup.sh). I can see that it correctly applies the schemas and verifies them. That it’s able to connect to my hosted db.

It’s failing to start with this error:  
`Unable to start server. Error: could not build arguments for function "go.temporal.io/server/common/pprof".LifetimeHooks (/home/builder/temporal/common/pprof/fx.go:39): failed to build *pprof.PProfInitializerImpl: could not build arguments for function "go.temporal.io/server/common/pprof".NewInitializer (/home/builder/temporal/common/pprof/pprof.go:56): failed to build *config.PProf: received non-nil error from function "go.temporal.io/server/temporal".ServerOptionsProvider (/home/builder/temporal/temporal/fx.go:152): sql schema version compatibility check failed: EOF`

I’ve tried digging into the source code but cannot find where it could fail with an EOF. I suspect it has something to do with the TLS settings (and not providing certs).

Any pointers would be deeply appreciated.

---

<div class="post-metadata">

**Author:** ![tstepro](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tstepro/32/666_2.png) [@tstepro](https://community.temporal.io/u/tstepro)\
**Post date:** [September 6, 2022, 9:03pm UTC](https://community.temporal.io/t/local-cluster-external-persistence/5891/4 "2022-09-06T21:03:18Z")

</div>

I was able to resolve it. Basically I had to setup a VPN to hook up my local cluster to my hosted db.

I had to setup a [tailscale subnet router](https://github.com/render-examples/tailscale) for render.

Then I had to set  
SQL\_HOST\_VERIFICATION=true  
SQL\_CA=\<path to ca for tailscale (using a tailscale subnet router and configuring certs for my local machine)\>  
SQL\_CERT=\<path to the cert for my local machine (generated from tailscale)\>  
SQL\_CERT\_KEY=\<path to the cert for my local machine (generated from tailscale)\>

Then I was able to hook up my local cluster to a db in render. Thank you for the help!

---

<div class="post-metadata">

**Author:** ![tstepro](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tstepro/32/666_2.png) [@tstepro](https://community.temporal.io/u/tstepro)\
**Post date:** [September 7, 2022, 1:25am UTC](https://community.temporal.io/t/local-cluster-external-persistence/5891/5 "2022-09-07T01:25:11Z")

</div>

> [@tstepro](#):
>
> `SQL_HOST_VERIFICATION=false`

Actually this just needs to be set to **true**. Tailscale is not required.
