Server CLI

Livingdocs provides a powerful server CLI where you can execute maintenance and administration tasks.

To execute a livingdocs-server CLI command, go to your Livingdocs Server folder and

  • run npx livingdocs-server to get help for all available commands (see the list below)
  • run npx livingdocs-server <command> to get help for a specific command
CommandDescription
cleanup-documentsTruncate stale revisions, publications and metadata.
cleanup-migrationsTruncate accepted migrations.
cleanup-metadataTruncate metadata with no reference to documents or publications.
data-migration-runExecute a data migration (create/prepare/accept)
databasePostgres database actions
design-addUpload a design to the design server
design-set-activeSet active design version of a project
elasticsearch-delete-indexDelete Elasticsearch index
elasticsearch-indexIndex documents into Elasticsearch
migrateExecute database migrations
project-seedSetup multiple projects with a seed configuration
project-deleteDelete a project
project-truncateTruncate documents/events
redis-flushdbFlush Redis DB
revision-migrationMigrate document revisions
testExecute livingdocs tests
transform-to-configurable-channelTransform a static channel to a configurable channel
user-assign-groupAssign a user to a group in a project
user-create-adminCreate an admin user
user-create-adminsCreate admin users
secret-addAdd a secret and optionally update the project config with it
secret-reencryptRe-encrypt all secrets with the configured encryption key
key-generateGenerate a signing or encryption json web key
completiongenerate completion script for livingdocs-server CLI

Create PostgreSQL database

The livingdocs-server utility allows you to easily manage your PostgreSQL database. When you execute livingdocs-server database create, the database will be created with the provided superuser, but it will also configure a migrate (owner) user and write user as specified in the Server configuration, if configuration bellow are not defined it will take default values.

  db: {
    // name of the databse
    database: 'li_test',

    // write user: gets created automatically
    username: 'user_li_test_write',
    password: 'something',

    // migrate user: gets created automatically, used to run database migrations
    migrate: {
      username: 'li_test_owner',
      password: 'something2'
    },

    // this is the superuser that has permissions to create the users above
    setup: {
      username: 'postgres',
      password: 'something3',
      writeRole: `role_database_write`,
      readRole: `role_database_read`
    }
  },