Architecture

Tangram is a single binary that contains both a client and a server. When you run a client command like tg build, if no server is running, then one will be spawned in the background automatically.

Check the server's status.

$ tg server status

Start or stop the server.

$ tg server start
$ tg server stop

The server can also be run explicitly in the foreground, which can be useful for debugging.

$ tg server run

The server can be configured with a configuration file at $HOME/.config/tangram/config.json. See the schema.

Servers require three resources to store their state: a data directory, a database, and a message broker. Multiple server processes, potentially running on multiple machines, can share the database and message broker to form a single logical server.

The default path for the data directory is $HOME/.tangram. It has the following entries:

  • artifacts: The mountpoint for the virtual filesystem, either FUSE or NFS.
  • blobs: A directory that contains files with blob data, to prevent having to write large amounts of data to the database.
  • cache: A directory that contains artifacts, both to speed up virtual filesystem access and to defer adding artifacts to the database.
  • database: By default, path for the SQLite database.
  • lock: A file used for managing shared and exclusive access to the directory when multiple servers are running.
  • log: The server's stdout and stderr are redirected to this file.
  • logs: A directory that contains build logs, to defer adding them to the database.
  • socket: The default path bound to the server's Unix domain socket.
  • tmp: A directory to store temporary files.
  • version: A file that indicates the current version of the layout of the directory.

The database is used to store the server's state, including builds, objects, tags, and more. The default database is SQLite, but a PostgreSQL compatible database can be used for distributed deployments.

The default message broker is a simple in-memory implementation, but NATS can be used for distributed deployments.