Files
SpacetimeDB/docker-compose.yml
T
Mario Montoya 8adef2b93b Support for the PG wire protocol (#2702)
# Description of Changes

Closes
[#2686](https://github.com/clockworklabs/SpacetimeDB/issues/2686).

Add support for listening using the [PG wire
protocol](https://www.postgresql.org/docs/current/protocol.html) so `pg`
clients could be used against the database.

# API and ABI breaking changes

The output of `duration` is changed to `rfc3339`, instead of the way is
made with `sats` because is what is done in `pg`, see note below.

# Expected complexity level and risk

2

~~There is open questions that are in the [ticket
#2686](https://github.com/clockworklabs/SpacetimeDB/issues/2686). Also
the crate used here require `RustTls`, so it could be good idea to
decide if~~:

* ~~Rewrite a big chunk of code to use `OpenSSL`~~
* ~~Move to `RustTls`
https://github.com/clockworklabs/SpacetimeDB/pull/1700~~
* ~~Pay for the extra compilation cost~~.

I open another port(`5433`) to listen for `pg` connections using `ssl`.
Need to be decided if this is the way or instead try to multi-plex the
current port for both protocols.

# Testing

Only manual testing so far. Solving the above questions allow me to
implement some unit tests. Also, not yet integrated into cloud for the
same reasons.

- [x] Adding some test for the binary encoding of special and primitive
types
- [x] Smoke test using `psql` that connect to the db instance and run
some queries
- [x] Manually inspect using a UI database explorer how infer the types,
some of this tools generate special widgets when displaying `json,
duration, etc`

---------

Co-authored-by: Noa <coolreader18@gmail.com>
2025-09-10 19:58:03 +00:00

55 lines
2.1 KiB
YAML

services:
node:
labels:
app: spacetimedb
build:
context: ./
dockerfile: ./crates/standalone/Dockerfile
args:
CARGO_PROFILE: dev
volumes:
- ./crates/standalone:/usr/src/app/crates/standalone
- ./crates/core:/usr/src/app/crates/core
- ./crates/client-api:/usr/src/app/crates/client-api
- ./crates/lib:/usr/src/app/crates/lib
- ./crates/sats:/usr/src/app/crates/sats
- ./crates/bindings:/usr/src/app/crates/bindings
- ./crates/bindings-macro:/usr/src/app/crates/bindings-macro
- ./crates/bindings-sys:/usr/src/app/crates/bindings-sys
- ./crates/vm:/usr/src/app/crates/vm
- ./crates/metrics:/usr/src/app/crates/metrics
- ./crates/client-api-messages:/usr/src/app/crates/client-api-messages
- ./Cargo.toml:/usr/src/app/Cargo.toml
- ./flamegraphs:/usr/src/app/flamegraphs
- key_files:/etc/spacetimedb
- /stdb
ports:
- "3000:3000"
# Postgres
- "5432:5432"
# Tracy
- "8086:8086"
entrypoint: cargo watch -i flamegraphs -i log.conf --why -C crates/standalone -x 'run start --data-dir=/stdb/data --jwt-pub-key-path=/etc/spacetimedb/id_ecdsa.pub --jwt-priv-key-path=/etc/spacetimedb/id_ecdsa'
privileged: true
environment:
SPACETIMEDB_FLAMEGRAPH_PATH: ../../../../flamegraphs/flamegraph.folded
SPACETIMEDB_TRACY: 1
# Tracy utilizes the Time Stamp Counter (TSC) in CPUs for high-resolution timing.
# The invariant TSC is a feature that ensures the TSC runs at a constant rate,
# regardless of power-saving modes or frequency changes.
#
# This flag will instruct Tracy to proceed without verifying the presence of an invariant TSC.
# If the CPU lacks this feature, Tracy cannot guarantee accurate timing.
# So use this approach with caution, as it may affect profiling accuracy.
# TRACY_NO_INVARIANT_CHECK: 1
RUST_BACKTRACE: 1
ENV: dev
networks:
- spacetimedb_default
networks:
spacetimedb_default:
name: spacetimedb_default
volumes:
key_files: