HomePhabricator
Diffusion Comm 583fedc0998d

[services][backup] Introduce cmdline args config

Description

[services][backup] Introduce cmdline args config

Summary:
Leveraged clap library to configure the service via command line args. I find this extremely useful when running the service in various environments: nix or docker, localstack/sandbox or real aws, or together with other services outside docker.

Added possibility to configure the following:

  • gRPC listening port (defaults to 50051)
  • to run in sandbox mode (previously (and still) available via the COMM_SERVICES_SANDBOX env var)
  • localstack url (useful because it differs inside/outside docker). Defaults to localhost:4566
  • blob service url (also differs inside/outside docker). Defaults to localhost:50053.

Related linear issue (for blob service, but the same applies here): https://linear.app/comm/issue/ENG-2310/make-blob-service-configurable

Depends on D5843

Test Plan:

  • cargo run -- --help should display this help screen:
Backup service

Usage: backup [OPTIONS]

Options:
      --port <LISTENING_PORT>
          gRPC server listening port [default: 50051]
      --sandbox
          Run the service in sandbox [env: COMM_SERVICES_SANDBOX=]
      --localstack-url <LOCALSTACK_URL>
          AWS Localstack service URL, applicable in sandbox mode [default: http://localhost:4566]
      --blob-service-url <BLOB_SERVICE_URL>
          Blob service URL [default: http://localhost:50053]
  -h, --help
          Print help information
  -V, --version
          Print version information
  • cargo run without args should start service on default port 50051
  • cargo run -- --port 50052 should start service on port 50052 (or any other specified unless already used)

Reviewers: varun, jon, tomek, max

Reviewed By: varun, jon, tomek

Subscribers: ashoat, atul

Differential Revision: https://phab.comm.dev/D6161

Details

Provenance
bartekAuthored on Jan 4 2023, 6:02 AM
Reviewer
varun
Differential Revision
D6161: [services][backup] Introduce cmdline args config
Parents
rCOMM174fffba3a18: [services][backup] Scaffold gRPC server
Branches
Unknown
Tags
Unknown