Hi everyone, I just deployed my first Django app with a PostGres database. I have users with a to-do list and I’d like to send them a daily reminder of overdue tasks. I wrote a script for that and I wanted to use a scheduled machine for this. I tried running flyctl machine run
, but it asks for <image>
and I have no idea what this means. It is also not explained in the documentation. Can someone help me?
Hey! A machine requires a docker image to run. So you could use an existing docker image from a registry or include a docker file in your project that gets built when a machine is created.
Thank you! Are there any tutorials/guides you recommend for someone who has never worked with a docker file or docker image before?
Sure thing! Here’s a docs reference that is helpful for learning about creating a starter dockerfile: Containerize an application | Docker Documentation
For machines, a quick way to get started would be to run machines with an existing docker image, something like:
fly machine run flyio/fastify-functions --app <APPNAME>
Otherwise this is an example docker file you can run if you’re running an app with fastify
FROM alpine
RUN apk add nodejs npm
COPY package.json package.json
COPY package-lock.json package-lock.json
RUN npm install
COPY server.js server.js
COPY start.sh start.sh
EXPOSE 8080
RUN chmod +x /start.sh
CMD /start.sh
start.sh
#!/bin/sh
node server
You can also refer to this guide for more step by step instructions on running machine stuff may be helpful for figuring out machines stuff: Running user code on Fly Machines · Fly Docs Hope that helps!
Thank you so much this is really helpful!
Sure thing!