Provision users and persist data

Provision users and persist data

Provision first user

Set backend.services.setupService.provision to true in your logship-database config to create configured accounts and users at startup. Set setupService as follows to provision a local test account and administrator:

{
  "enable": true,
  "provision": true,
  "accounts": [
    {
      "accountId": "00000000-0000-0000-0000-000000000000",
      "accountName": "Default Account"
    }
  ],
  "users": [
    {
      "userId": "00000000-0000-0000-0000-00000000cafe",
      "overwrite": false,
      "username": "admin",
      "password": "replace-with-a-long-passphrase",
      "firstname": "Logship",
      "lastname": "Admin",
      "email": "admin@logship.io",
      "defaultGlobalPermissions": [
        "Logship.Global.Admin"
      ],
      "defaultAccounts": [
        {
          "accountId": "00000000-0000-0000-0000-000000000000",
          "userPermissions": [
            "Logship.Account.Admin"
          ]
        }
      ]
    }
  ]
}

After startup, sign in with the configured credentials. Replace the sample credentials with deployment-specific values before using this configuration outside a local test deployment.

Provisioning creates missing users and leaves existing users matched by userId unchanged, including their passwords and roles. Set overwrite to true on a user to apply the configured profile and roles on every startup; the user keeps its password and stays disabled if an administrator disabled it. Add resetPassword: true only to restore the configured password, which ends the user's existing sessions. Both default to false. A provisioning failure stops startup. When provisioning creates a global administrator, first-run setup at /setup is not offered, even before provisioning has run.

Persistent Storage

Add this volume to the logship-database Compose service to retain data when the container is replaced:

volumes:
  - ./logship:/logship:rw

The mount must cover every configured storage path, including the metadata database and a single node's generated signing key. See the database configuration reference for paths.