I’m having trouble getting my Elixir app to start on fly.io. I’m using the Dockerfile
that flyctl
created, although it looks straightforward enough to me. My app has a GenServer application that reads some static files when it starts up. If I docker build
the image locally and shell in to it, the files are present (eg. /lib/myapp-0.1.0/priv/vocabs/condition.ttl
).
But the logs on fly.io show:
2022-10-27T11:26:12Z app[601b7009] lhr [info]
{"Kernel pid terminated",application_controller,"{application_start_failure,myapp,
{{shutdown,{failed_to_start_child,'Elixir.KnowledgeGraph.Graph',
{#{'__exception__' => true,'__struct__' => 'Elixir.File.Error',
action => <<\"open\">>,
path => <<\"priv/vocabs/condition.ttl\">>, reason => enoent},
[{'Elixir.File','open!',3,[{file,\"lib/file.ex\"},{line,1511}]},
{'Elixir.RDF.Serialization.Reader','do_read_file!',4,
[{file,\"lib/rdf/serialization/reader.ex\"},{line,81}]},
To get enoent
, either the file priv/vocabs/condition.ttl
didn’t get copied to the image (but I can see that it did, assuming it’s in the right place), or there’s something else I need to do to allow the Elixir process to access the file system in a container.
This is my first time building a Docker image for Elixir, although I’ve done it several times for Ruby and Python apps. But I thought that reading from the file system was usually straightforward. So I’m feeling a bit stuck!