Experienced dev here. Struggling conceptually. I have flyctl
installed & working ok.
Goal: run a docker image (containing a single script) hourly, passing the contained script secrets via environment variables and command-line arguments explicitly. Each invocation of the container will be identical, and the container will execute for a few seconds then exit (usually with a 0 status code, but it may exit nonzero).
My docker image has an ENTRYPOINT
so it acts like an executable. I want to have environment variables POOLMINDER_TOKEN
& POOLMINDER_POOL_ID
contain secrets. When I run it locally, I do it like this: docker run --rm -it -e POOLMINDER_TOKEN="(a secret)" -e POOLMINDER_POOL_ID="(another secret)" poolminder:latest --verbose --topup-shortfall-strategy increase --no-dry-run
I’m not really conceptually understanding fly launch
vs fly deploy
vs fly machine
. Things I think I know:
- Applications are some kind of space.
- I can push Docker images to an application space.
- Secrets are bound to an application.
- A machine can run a Docker image.
- Machines can be scheduled.
Questions:
- If I start with zero applications in my dashboard, what are the
fly
commands to execute, exactly? - How do I pass command-line arguments to my container’s invocation? (I don’t see the position for them when I run
fly machine run --help
.) - Are environment variables present in the application’s space?
- Do secrets appear as environment variables in my docker container (as though they were passed via
-e
arguments)? - Do I really need a
fly.toml
file?
Thanks in advance for the noob help,
Matthew