Command-line interface

Shared command-line interface

swh

Command line interface for Software Heritage.

swh [OPTIONS] COMMAND [ARGS]...

Options

-l, --log-level <log_level>

Log level (defaults to INFO).

Options

NOTSET|DEBUG|INFO|WARNING|ERROR|CRITICAL

--log-config <log_config>

Python yaml logging configuration file.

--sentry-dsn <sentry_dsn>

DSN of the Sentry instance to report to

Database initialization utilities

swh db init

Initialize the database for every Software Heritage module found in the configuration file. For every configuration section in the config file that:

  1. has the name of an existing swh package,

  2. has credentials for a local db access,

it will run the initialization scripts from the swh package against the given database.

Example for the config file:

|   storage:
|     cls: local
|     args:
|       db: postgresql:///?service=swh-storage
|   objstorage:
|     cls: remote
|     args:
|       url: http://swh-objstorage:5003/

the command:

swh db -C /path/to/config.yml init

will initialize the database for the storage section using initialization scripts from the swh.storage package.

swh db init [OPTIONS]

swh db-init

Initialise a database for the Software Heritage <module>. By default, does not attempt to create the database.

Example:

swh db-init -d swh-test storage

If you want to specify non-default postgresql connection parameters, please provide them using standard environment variables. See psql(1) man page (section ENVIRONMENTS) for details.

Example:

PGPORT=5434 swh db-init indexer

swh db-init [OPTIONS] MODULE...

Options

-d, --db-name <db_name>

Database name. [default: softwareheritage-dev]

-C, --create-db, --no-create-db

Attempt to create the database.

Arguments

MODULE

Required argument(s)