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.
1.7 KiB
Pre-built Images
The pre-built Postgres Docker image described in Docker Images 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
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
clientstable. If those columns do not have default values, ensure the server is configured withCREATE_CLIENTS=falseas described below. - Insert rows into the
clientstable, using default values for all columns exceptclient_idand any application-specific columns. - Delete rows from the
clientstable. 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.