SYNAPSE_PORT_DB(1)

πŸ“¦
version 1.132.0 Β· 2 versions
, in opensuse-leap 16.0

πŸ’… SYNAPSE_PORT_DB β€” the porting glow-up πŸ’…

Okay bestie, so this is synapse_port_db, a script from the SYNAPSE_PORT_DB(1) manual, and it is literally the thing that moves your existing synapse SQLite database over to a shiny new PostgreSQL database. Glow-up era ✨


🌸 SYNOPSIS 🌸

synapse_port_db [-v] --sqlite-database=dbfile
--postgres-config=yamlconfig [--curses] [--batch-size=batch-size]

πŸ¦‹ DESCRIPTION πŸ¦‹

So synapse_port_db ports an existing synapse SQLite database to a new PostgreSQL database. That's it, that's the whole vibe. πŸ’–

You tell it which SQLite database you're working with using the --sqlite-database option, and then you hand it the PostgreSQL configuration it needs to actually connect to the PostgreSQL database via --postgres-config. That configuration is specified in YAML format β€” yes, YAML, we love a structured moment. πŸŽ€


✨ OPTIONS ✨

  • -v β€” Print log messages at debug level instead of info level. Not me wanting all the tea in the logs πŸ”₯
  • --sqlite-database β€” The snapshot of the SQLite database file. Heads up though: this must not be currently used by a running synapse server. Like, nobody else can be touching it, okay? πŸ™ˆ
  • --postgres-config β€” The database config file for the PostgreSQL database. Give it the YAML and it's off πŸ‘‘
  • --curses β€” Display a curses based progress UI. Aesthetic progress bar energy, honestly iconic ✨

πŸ’œ CONFIG FILE πŸ’œ

The postgres configuration file must be a valid YAML file with the following options. Let's break it down, bestie 🫢

  • database: Database configuration section. This section header can be ignored and the options below may be specified as top level keys. (So yes, you can skip the wrapper if that's more your vibe πŸ’…)
  • name: Connector to use when connecting to the database. This value must be psycopg2. No substitutions, no cap. ⭐
  • args: DB API 2.0 compatible arguments to send to the psycopg2 module. Inside of which:
    • dbname β€” the database name
    • user β€” user name used to authenticate
    • password β€” password used to authenticate
    • host β€” database host address (defaults to UNIX socket if not provided)
    • port β€” connection port number (defaults to 5432 if not provided)
  • synchronous_commit: Optional. Default is True. If the value is False, enable asynchronous commit and donΒ΄t wait for the server to call fsync before ending the transaction. See: https://www.postgresql.org/docs/current/static/wal-async-commit.html 🧚

Following example illustrates the configuration file format.

database:
  name: psycopg2
  args:
    dbname: synapsedb
    user: synapseuser
    password: ORohmi9Eet=ohphi
    host: localhost
  synchronous_commit: false
Lowkey obsessed with how clean that YAML looks ngl 🌸

This man page was written by Sunil Mohan Adapa <mailto:sunil@medhas.org> for Debian GNU/Linux distribution. Shoutout to Sunil, we stan πŸ’–


⭐ SEE ALSO ⭐

synctl(1), hash_password(1), register_new_matrix_user(1), synapse_review_recent_signups(1) β€” go read those too, iykyk πŸ‘‘


And that's the whole page, bestie β€” brought to you by the SYNAPSE_PORT_DB(1) manual, July 2021, SYNAPSE_PORT_DB(1) energy all the way through. Periodt. πŸ’…πŸŽ€πŸ¦‹