s365b.cli ========= .. py:module:: s365b.cli .. autoapi-nested-parse:: The ``s365b`` command: one entry point for every container role. Examples:: s365b migrate # apply database migrations s365b api # run the web API s365b worker # run background jobs (and the scheduler tick) s365b generate-master-key # print a new master key Attributes ---------- .. autoapisummary:: s365b.cli.app Functions --------- .. autoapisummary:: s365b.cli.version s365b.cli.generate_master_key s365b.cli.migrate s365b.cli.api s365b.cli.worker s365b.cli.setup_token s365b.cli.create_local_admin s365b.cli.reset_local_admin s365b.cli.run_job s365b.cli.repository_check Module Contents --------------- .. py:data:: app .. py:function:: version() -> None Print the version. .. py:function:: generate_master_key(output: Annotated[pathlib.Path | None, typer.Option(help='Write to this file (mode 0600)')] = None) -> None Create a new master key for encrypting secrets in the database. .. py:function:: migrate() -> None Apply database migrations (app schema and job queue schema). .. py:function:: api(host: Annotated[str, typer.Option(help='Bind address')] = '0.0.0.0', port: Annotated[int, typer.Option(help='Port')] = 8000) -> None Run the web API. .. py:function:: worker(queues: Annotated[str, typer.Option(help='Comma-separated queues; empty for all')] = '', concurrency: Annotated[int, typer.Option(help='Jobs run at the same time')] = 2) -> None Run background jobs and the scheduler tick. .. py:function:: setup_token() -> None Issue a new one-time setup token for creating the first admin in the web UI. .. py:function:: create_local_admin(username: str) -> None Create a break-glass admin from the command line (prompts for password and code). Use inside the api container: ``docker compose exec api s365b create-local-admin NAME``. .. py:function:: reset_local_admin(username: str, new_password: Annotated[bool, typer.Option(help='Also set a new password')] = False) -> None Reset a break-glass admin's authenticator and recovery codes (and unlock it). For when the authenticator is lost and no other admin can sign in. Requires shell access to the server, which is the trust boundary. .. py:function:: run_job(job_id: int) -> None Queue a backup job to run now. .. py:function:: repository_check(repair: Annotated[bool, typer.Option(help='Repair around unreadable blobs')] = False) -> None Read every blob of every repository and report unreadable ones. With --repair: remove the versions that use them, reset the affected objects so the next backup stores those items again, and delete the unreadable blobs. Waits for no one: fails if a backup is running.