DEV Community

flisk
flisk

Posted on

Goose Lang and Flisk.sh 101: Same Repo, Different Processes

Part 5 of Goose lang and Flisk.sh 101. This is the join, and the join is a boundary.

./total is a Goose program. It prints and exits. The orders-api container is a Go process Flisk generated. It listens until you stop the stack. Docker cannot exec a binary that only exists on your Mac unless that binary was copied into the image. Flisk will not copy it, because Goose is not a provider.

Prove the host path

From ~/src/goose-flisk-101, with part 3's binary:

goose build -o ./total total.goose
./total
Enter fullscreen mode Exit fullscreen mode

You should see the array and the sums from part 3. That process is gone when the command returns. curl cannot call it. Traefik cannot route it.

Keep using the health URL from part 4 for the API:

flisk up shop --dry-run
# then, if the stack is already up, curl the URL that command prints
Enter fullscreen mode Exit fullscreen mode

Two successes, two processes. Write that down in the README of this tutorial repo so the next person does not "fix" it.

What a merge would require

A Flisk service, generated or bring-your-own, has to:

  1. Stay running.
  2. Read PORT.
  3. Bind 0.0.0.0, not only 127.0.0.1, because Traefik is on the Docker network.
  4. Answer GET /health with 200, unless you omit healthCheckPath because the process is not HTTP. A non-HTTP process gets no HTTP probe and no pretend route.

The Goose tutorial does not include an HTTP server. extern fn can call C, and the compiler can emit C, but a socket server is not a 101 program. Do not paste a made-up listen() wrapper and call the series done.

Bring-your-own is the real escape hatch when a language has no provider. docs/byo.md in the Flisk repo is the contract for your CLI version. The schema requires appName, stack, and schemaVersion. A bring-your-own resource also needs port, from 4000 through 5999. healthCheckPath defaults to /health. dockerfile and image are optional. exposeViaProxy defaults to true.

Keep the service.json Flisk writes. Do not hand-author schemaVersion. Run:

flisk resource --help
flisk doctor --no-ping
Enter fullscreen mode Exit fullscreen mode

If you later add a BYO resource for a Goose image, the image is yours. Flisk will not live-reload source it did not generate. You compile, rebuild the image, and let Tilt pick up the new container.

A layout that stays honest

goose-flisk-101/
  hello.goose
  total.goose
  total                 # gitignore this
  services/shop/orders-api/
    service.json        # language: go, not goose
  .autogenerated/       # never edit
Enter fullscreen mode Exit fullscreen mode

.gitignore:

/total
.autogenerated/
Enter fullscreen mode Exit fullscreen mode

Add a Makefile target that does not pretend to be Flisk:

total:
    goose build -o ./total total.goose
Enter fullscreen mode Exit fullscreen mode

The API container does not run make. You run make on the host when you want the sums.

Negative tests, in order

flisk resource other-api --type backend --language goose --stack shop
flisk doctor --no-ping
flisk config verify
Enter fullscreen mode Exit fullscreen mode

The first command fails and writes nothing. Doctor and verify still pass if you did not touch generated files. If verify fails, regenerate. Do not patch .autogenerated/ so the names goose and go both appear.

Where the series stops

You can now:

  • typecheck and run a small Goose program
  • build it to a binary that is not named goose
  • scaffold a Flisk stack and read the health URL
  • tell an agent, in one sentence, not to pass --language goose and not to edit .autogenerated/

You cannot yet deploy either tool. Flisk's cluster handoff is Helm, in its own guide, and it is out of scope here. Goose's graphics, physics, and thread samples are out of scope here too.

When a Goose HTTP server exists as a real program you can read, the follow-up is a bring-your-own image that copies that binary, binds PORT, and serves /health. Until that program exists, the 101 integration is two commands in one repo, not one flag.

Top comments (0)