DEV Community

flisk
flisk

Posted on

Register Goose with the Fastify Command

Part 3 of Any language on Flisk. From the Flisk project root, with the Dockerfile from part 2 already in place:

flisk resource goose-api --type bring-your-own --stack shop \
  --dockerfile ./Dockerfile --health-path /health \
  --path services/shop/goose-api --port 4500 --yes
Enter fullscreen mode Exit fullscreen mode

That is the Fastify command with the names changed. --yes skips the create prompt. --port 4500 must be free and inside 4000–5999. Drop --port to take the next free port.

--path must stay inside the project directory. A path outside it is refused with Path must be within the project directory.

The manifest Flisk writes

Your Dockerfile stays. The new file looks like the example at the top of the BYO doc:

{
  "appName": "goose-api",
  "appType": "bring-your-own",
  "stack": "shop",
  "port": 4500,
  "healthCheckPath": "/health",
  "dockerfile": "./Dockerfile"
}
Enter fullscreen mode Exit fullscreen mode

Read what the CLI wrote before you edit it. An unknown JSON key is kept and ignored.

You want Flag
This Dockerfile --dockerfile ./Dockerfile
Health path --health-path /health
A fixed port --port 4500
An image you already built --image name:tag, and no Dockerfile is created
No Traefik route --no-proxy, which writes exposeViaProxy: false
A job that must exit --restart no

Leave the proxy on for an API. Leave restart at the default, unless-stopped. --restart is rejected on every type except bring-your-own.

Route

Through flisk up, the service is at:

http://api.<project>.localhost/api/<name without -api>/...
Enter fullscreen mode Exit fullscreen mode

The prefix is stripped before it reaches the process. goose-api is /api/goose/... outside the container and /health inside it. <project> is the Flisk project name, not the stack name. flisk up shop --dry-run prints the real URL.

Resource names must be unique across Flisk projects that share one Docker daemon. Two goose-api resources drop routes. Traefik watches every container.

If the compiler cannot live in the resource directory, set buildContext to a path relative to that directory. dockerfile is then relative to the context. buildContext may point outside the project. service.json may not.

Part 4 boots the stack. The image check from part 2 is necessary and not sufficient.

Top comments (0)