How to include `fly-log-shipper` in a project?

Hello,

I’m wondering how y’all are adding fly-log-shipper to your applications?

I’ve added the repo as a git submodule so I can keep my local copy up to date with any new PRs from the maintainers. The problem is I need to supply [env] values in the fly.toml file. This obviously causes a change that git picks up on. I don’t want to create a branch and push these changes to the origin.

I’m wondering if y’all are copy and pasting this repo into your project and tracking is as a part of your project. Or are you forking this project and creating your own version?

Thanks!

Usually ran as a separate Fly app (a shared-1x cpu with 256mb mem should be enough is my guess) on a forked repo. Typically, you’d keep main unchanged and in-sync with upstream, and merge that main into your own branch with changes specific to your app carried forward, forever.

Or, you can instruct fly deploy to ignore values in fly.toml by supplying either a different my.fly.toml with the --config switch, or by supplying args against --env, --app etc to fly deploy itself.

There are multiple ways to set env vars for a Fly app. As an example, fly secrets set ... is one (abusive) way to set env for an app. ENVs set in Dockerfiles also carried in to your app’s vm. As mentioned above, yet another way is to pass env with the fly deploy -e k1=v1 -e k2=v2 ... switch (doing so, makes fly deploy ignore the [env] section in fly.toml, entirely).

2 Likes

Thanks for the information.
For the main time am setting the Env as this flyctl deploy --build-secret FUSION_AUTH_URL=$FUSION_AUTH_URL --remote-only

This was able to set the environment variable but this issue is that when i tried to set multiple key it does not run at all
flyctl deploy --build-secret FUSION_AUTH_URL=$FUSION_AUTH_URL --build-secret FUSION_AUTH_PUBLIC_KEY=$FUSION_AUTH_PUBLIC_KEY

So how can i set multiple variables ?

See this discussion: Best practice for build-time secrets? (spoiler, there are no answers).


I haven’t needed this, so I can’t tell if it stopped working now or whether it was never supposed to work this way (cc: @fideloper-fly), but I want to point out that you can always pass multiple --build-args to fly deploy (ref) and set them as ENVs in dockerfile which are then available as env vars to your app instance running on Fly. nb, it is not recommended to use --build-arg for sensitive data.

1 Like

Thanks, i will try that.

1 Like

I believe it should work with multiple arguments. Try out a syntax like this:

flyctl deploy \
    --build-secret="FUSION_AUTH_URL=$FUSION_AUTH_URL" \
    --build-secret="FUSION_AUTH_PUBLIC_KEY=$FUSION_AUTH_PUBLIC_KEY"

I added = equal signs and put the "KEY=VALUE" parts in double quotes.

1 Like

I tried this it gives an error

Error: accepts at most 1 arg(s), received 27
Error accepts at most 1 arg(s), received 27