Skip to content

grapity serve ​

Start the local Grapity Registry server and optionally the Hub developer portal.

Usage ​

bash
grapity serve [options]

Description ​

grapity serve starts the Registry HTTP server on the configured port. By default, it also starts the Hub developer portal on a separate port.

All connection configuration (database, Keycloak) is read from ~/.grapity/config.yaml, which is created by grapity init. Use GRAPITY_DATABASE_URL to keep database credentials out of the config file.

Running grapity serve with no flags starts:

  • Registry on port 3750
  • Hub on port 3000
  • Database: SQLite at ~/.grapity/registry.db
  • Auth: enabled if configured in ~/.grapity/config.yaml; otherwise the command fails unless you pass --no-auth

grapity serve requires a config file. Run grapity init first. It is for local mode only and refuses to start when mode: remote.

WARNING

--no-auth disables authentication entirely. It is intended only for local development. Do not use it in production or on any shared network.

Options ​

OptionDescriptionDefault
-p, --port <port>Port for the Registry server3750
--hub-port <port>Port for the Hub developer portal3000
--no-hubSkip starting the developer portal(starts hub)
--no-authStart without authentication(uses auth config)

External dependencies ​

Depending on your config, grapity serve expects other services to be reachable.

FeatureRequired serviceExample file
AuthA reachable Keycloak server matching serverUrl and realmdocker-compose.keycloak.yml
Gateway provisioningA reachable Kong Admin API and the deck binarydocker-compose.kong.yml
PostgreSQLA reachable PostgreSQL serverdocker-compose.grapity-db.yml

grapity serve itself only starts the Registry and Hub. It does not start Keycloak, Kong, or PostgreSQL for you. Download the example files from Examples.

Examples ​

Default local mode without Keycloak ​

bash
grapity serve --no-auth

Output:

text
  ◆  grapity  ·  v0.3.0

  ◆  grapity Registry
  ·  Port: 3750
  ·  Database: sqlite
  ·  Path: /Users/.../.grapity/registry.db
  ·  Auth: none

  ●  Server ready  ·  http://localhost:3750

Default local mode with Keycloak auth ​

Start the local Keycloak stack first:

bash
mkdir -p grapity-examples/keycloak
curl -L https://grapity.dev/docs/examples/docker-compose.keycloak.yml \
  -o grapity-examples/docker-compose.keycloak.yml
curl -L https://grapity.dev/docs/examples/keycloak/realm-export.json \
  -o grapity-examples/keycloak/realm-export.json
cd grapity-examples
docker compose -f docker-compose.keycloak.yml down -v
docker compose -f docker-compose.keycloak.yml up -d

Then configure and start grapity:

bash
grapity init --local --auth keycloak \
  --keycloak-server http://localhost:8080 \
  --keycloak-realm grapity \
  --keycloak-client-id grapity-cli \
  --keycloak-audience grapity-cli

grapity serve

Output:

text
  ◆  grapity  ·  v0.3.0

  ◆  grapity Registry
  ·  Port: 3750
  ·  Database: sqlite
  ·  Path: /Users/.../.grapity/registry.db
  ·  Auth: keycloak

  ●  Server ready  ·  http://localhost:3750

Registry only ​

bash
grapity serve --no-hub

Graceful shutdown ​

Press Ctrl+C to stop both servers cleanly.

See also ​

Released under the Apache 2.0 License.