LostKobrakai

LostKobrakai

Afaik the problem is not “reading config”, but that the configuration file a release loads must be an erlang formatted file and everything being able to read .exs files using the Config module of elixir it not yet available early enough in the boot sequence to configure things like :kernel. This creates a chicken/egg type problem, where one way of solving it is booting twice and persisting the read config from the first boot, so the second one can read the result in erlang terms.

1
Post #11
hauleth

hauleth

Well, if you provide sys.config directly instead of using any provider, then you will not need writeable FS. But as Elixir developers rarely do so, and prefer “easier” solutions - this is how @LostKobrakai described.

0
Post #12
josevalim

josevalim

Creator of Elixir

It will be the case in Elixir v1.11 if using config/runtime.exs. The reboot will have to be opt-in.

3
Post #13
LostKobrakai

LostKobrakai

I just tried this out on a system of mine, but I’m hitting a few of Cannot configure {app} because :reboot_after_config has been set to false and {app} has already been loaded errors (which are neither kernel nor stdlib, but dependencies / my app itself)

0
Post #14
josevalim

josevalim

Creator of Elixir

How does your config file look like? Are you starting any applications within it?

If you go to your release and then in releases/VERSION/start.script, what are the applications listed before {apply,{'Elixir.Config.Provider',boot,[]}}?

If you do add a IO.puts "hello" to your “config/releases.exs”, does it print once or twice when you boot?

Finally, can you isolate this issue somehow?

Thanks!

0
Post #15
LostKobrakai

LostKobrakai

My releases.exs file is basically just a bunch of config … calls setting data from System.fetch_env!. Nothing special, not starting anything. The start.script does only :start_boot :kernel and :stdlib before the config provider, which however looks like this for me: {apply,{'Elixir.Config.Provider',boot,[elixir,config_providers]}}. I’ll try to see if I can replicate this in a fresh project.

0
Post #16
LostKobrakai

LostKobrakai

Seems like this was quite easy to reproduce: GitHub - LostKobrakai/elixir_release_repro · GitHub
I’ve used a commit per logical step, so it should be easy to follow how I got there.

Edit:

It can be as simple as mix new project and adding the following:

# releases.exs
import Config

config :project, key: "something"

and

# mix.exs project/0 
releases: [
      other: [
        reboot_system_after_config: false
      ]
    ]
0
Post #17
tristan

tristan

Rebar3 Core Team

To support read only file systems along with the relx start scripts that replace os vars in sys.config and vm.args I use an in memory volume, like running docker with --read-only and --tmpfs /tmp, and set the output (in this case $RELX_OUT_FILE_PATH) to go to /tmp.

It is discussed Docker | Adopting Erlang – I now feel it needs to be a section to better highlight this, right now it is just sort of intertwined with the rest of the chapter.

1
Post #18
josevalim

josevalim

Creator of Elixir

Thank you! I could reproduce the issue and it has been fixed in Elixir master. We should have a RC out shortly.

2
Post #19
LostKobrakai

LostKobrakai

Yeah, saw that it worked on master yesterday. I’m wondering if this should be fixed for 1.10 though? Or at least the documentation being adjusted to say that it won’t work with releases.exs config.

0
Post #20
— All posts loaded —