ausimian/forecastle

Sys.config File question

Opened this issue · 1 comments

Hi There, my name is Thiago Esteves and I'm working on an application that should execute 2 main tasks:

  • Handle deployments for another Elixir app, monitoring, restarting or updating when needed
  • Handle hot upgrades for the monitored Elixir app

For the hot upgrade, I'm using part of the distillery code to generate the .appup files and for the upgrade release functions, the deployer app is connecting via OTP distribution and executing pretty much the steps in this script (but using Elixir syntax). So far I can execute the hot upgrades with no problems, the last issue is related to the config. While looking at your repo, I found the part I was missing which was the sys.config (Thanks!!!)

The idea I have now is to load the sys.config and save the original file, and using the OTP distribution, The deployer app can then run the config providers and generate a sys.config with all needed configurations and save it in the release folder. The next step is to execute the hot upgrade, and later on move the original file to sys.config to avoid having secrets in files.

Sorry for the long explanation, but the question is why you created another file boot.config for the configuration and didn't use the original sys.config?

Thanks in advance

Hi Thiago, so when castle system boots, it brings a 'preboot' instance of the vm up first. The purpose of this instance is only to generate the sys.config for the 'real' system boot, after which it shuts down.

Hot-code upgrades to systems that get their boot config from files other than sys.config leads to misconfiguration after upgrade.