mirror of
https://github.com/GothenburgBitFactory/taskchampion-sync-server.git
synced 2026-04-07 10:10:39 +00:00
Finish building Postgres support (#133)
This includes: - Building a Docker image for Postgres as well as SQLite - Fuller instructions for usage of the package, including the Postgres builds. A few related things changed here: - `.env` is not used anymore -- the defaults in the Dockerfiles are sufficient - The Rust version in the Dockerfiles is increased to match the MSRV, and with it the Alpine version bumped to one built with that Rust version. - Cargo dependencies on native-tls and openssl updated to include only the `vendored` feature, so as not to require a system openssl installation. - Two GitHub jobs are set up, to build the two different Docker images - The documentation incorrectly suggested using `DELETE .. CASCADE` to delete clients. This syntax does not exist, as the cascading delete is configured in the schema.
This commit is contained in:
committed by
GitHub
parent
820aaf363c
commit
ab6df362bf
17
docs/src/integration/crates.md
Normal file
17
docs/src/integration/crates.md
Normal file
@ -0,0 +1,17 @@
|
||||
# Rust Crates
|
||||
|
||||
This project publishes several Rust crates on `crates.io`:
|
||||
|
||||
- [`taskchampion-sync-server-core`](https://docs.rs/taskchampion-sync-server-core)
|
||||
implements the core of the protocol
|
||||
- [`taskchampion-sync-server-storage-sqlite`](https://docs.rs/taskchampion-sync-server-storage-sqlite)
|
||||
implements an SQLite backend for the core
|
||||
- [`taskchampion-sync-server-storage-postgres`](https://docs.rs/taskchampion-sync-server-storage-postgres)
|
||||
implements a Postgres backend for the core
|
||||
|
||||
If you are building an integration with, for example, a custom storage system,
|
||||
it may be helpful to use the `core` crate and provide a custom implementation
|
||||
of its `Storage` trait.
|
||||
|
||||
We suggest that any generally useful extensions, such as additional storage
|
||||
backends, be published as open-source packages.
|
||||
40
docs/src/integration/pre-built.md
Normal file
40
docs/src/integration/pre-built.md
Normal file
@ -0,0 +1,40 @@
|
||||
# Pre-built Images
|
||||
|
||||
The pre-built Postgres Docker image described in [Docker
|
||||
Images](../usage/docker-images.md) may be adequate for a production deployment.
|
||||
The image is stateless and can be easily scaled horizontally to increase
|
||||
capacity.
|
||||
|
||||
## Database Schema
|
||||
|
||||
The schema defined in
|
||||
[`postgres/schema.sql`](https://github.com/GothenburgBitFactory/taskchampion-sync-server/blob/main/postgres/schema.sql)
|
||||
must be applied to the database before the container will function.
|
||||
|
||||
The schema is stable, and any changes to the schema will be made in a major
|
||||
version with migration instructions provided.
|
||||
|
||||
An integration may:
|
||||
|
||||
- Add additional tables to the database
|
||||
- Add additional columns to the `clients` table. If those columns do not have
|
||||
default values, ensure the server is configured with `CREATE_CLIENTS=false` as
|
||||
described below.
|
||||
- Insert rows into the `clients` table, using default values for all columns
|
||||
except `client_id` and any application-specific columns.
|
||||
- Delete rows from the `clients` table. Note that this table is configured to
|
||||
automatically delete all data associated with a client when the client's row is
|
||||
deleted.
|
||||
|
||||
## Managing Clients
|
||||
|
||||
By default, taskchampion-sync-server creates a new, empty client when it
|
||||
receives a connection from an unrecognized client ID. Setting
|
||||
`CREATE_CLIENTS=false` disables this functionality, and is recommended in
|
||||
production deployments to avoid abuse.
|
||||
|
||||
In this configuration, it is the responsibility of the integration to create
|
||||
new client rows when desired, using a statement like `INSERT into clients
|
||||
(client_id) values ($1)` with the new client ID as a parameter. Similarly,
|
||||
clients may be deleted, along with all stored task data, using a statement like
|
||||
`DELETE from clients where client_id = $1`.
|
||||
10
docs/src/integration/protocol-impl.md
Normal file
10
docs/src/integration/protocol-impl.md
Normal file
@ -0,0 +1,10 @@
|
||||
# Sync Protocol Implementation
|
||||
|
||||
The [sync protocol](https://gothenburgbitfactory.org/taskchampion/sync.html) is
|
||||
an open specification, and can be re-implemented from that specification as
|
||||
desired. This specification is not battle-tested, so refer to
|
||||
taskchampion-sync-server's implementation to resolve any ambiguities, and
|
||||
please create pull requests to resolve the ambiguity in the specification.
|
||||
|
||||
We suggest that new implementations be published as open-source packages where
|
||||
possible.
|
||||
Reference in New Issue
Block a user