`different value set for key :instance` on 3.0.0-beta.1
I'm having trouble understanding the configuration system of elixir. The way I understand it, there are runtime options and compile time options, where the latter can provide default values that can be overriden at runtime. But sometimes Elixir doesn't like when these two values aren't the same, even in situations where the compile time default doesn't make sense to use (e.g. "My Mobilizon instance" as an instance name).
Then I read, that the equality check is only done when using Application.compile_env/3
, but not when using Application.get_env/3
. I had the hope, that maybe some usage of compile_env/3
slipped through, but it doesn't exist in the whole codebase.
The following log output comes from our integration test we run for the Nixos module for Mobilizon (which is wip).
vm-test-run-mobilizon> server # [ 115.974456] systemd[1]: Starting Mobilizon federated organization and mobilization platform...
vm-test-run-mobilizon> server # [ 125.801853] mobilizon_ctl[1347]: ERROR! the application :mobilizon has a different value set for key :instance during runtime compared to compile time. Since this application environment entry was marked as compile time, this difference can lead to different behaviour than expected:
vm-test-run-mobilizon> server # [ 126.058901] mobilizon_ctl[1347]: * Compile time value was set to: [name: "My Mobilizon Instance", description: "Change this to a proper description of your instance", hostname: "localhost", registrations_open: false, registration_email_allowlist: [], registration_email_denylist: [], languages: [], default_language: "en", demo: false, repository: "https://framagit.org/framasoft/mobilizon", allow_relay: true, federating: true, remote_limit: 100000, upload_limit: 10485760, avatar_upload_limit: 2097152, banner_upload_limit: 4194304, remove_orphan_uploads: true, orphan_upload_grace_period_hours: 48, remove_unconfirmed_users: true, unconfirmed_user_grace_period_hours: 48, activity_expire_days: 365, activity_keep_number: 100, enable_instance_feeds: false, email_from: "noreply@localhost", email_reply_to: "noreply@localhost"]
vm-test-run-mobilizon> server # [ 126.171742] mobilizon_ctl[1347]: * Runtime value was set to: [description: "Change this to a proper description of your instance", registration_email_allowlist: [], registration_email_denylist: [], languages: [], default_language: "en", repository: "https://framagit.org/framasoft/mobilizon", allow_relay: true, federating: true, remote_limit: 100000, upload_limit: 10485760, avatar_upload_limit: 2097152, banner_upload_limit: 4194304, remove_orphan_uploads: true, orphan_upload_grace_period_hours: 48, remove_unconfirmed_users: true, unconfirmed_user_grace_period_hours: 48, activity_expire_days: 365, activity_keep_number: 100, enable_instance_feeds: false, demo: false, email_from: "noreply@acme.test", email_reply_to: "noreply@acme.test", hostname: "acme.test", name: "Test Mobilizon", registrations_open: false]
vm-test-run-mobilizon> server # [ 126.282774] mobilizon_ctl[1347]: To fix this error, you might:
vm-test-run-mobilizon> server # [ 126.295090] mobilizon_ctl[1347]: * Make the runtime value match the compile time one
vm-test-run-mobilizon> server # [ 126.321957] systemd[1]: mobilizon.service: Control process exited, code=exited, status=1/FAILURE
vm-test-run-mobilizon> server # [ 126.354780] mobilizon_ctl[1347]: * Recompile your project. If the misconfigured application is a dependency, you may need to run "mix deps.compile mobilizon --force"
vm-test-run-mobilizon> server # [ 126.374386] mobilizon_ctl[1347]: * Alternatively, you can disable this check. If you are using releases, you can set :validate_compile_env to false in your release configuration. If you are using Mix to start your system, you can pass the --no-validate-compile-env flag
vm-test-run-mobilizon> server # [ 126.398890] mobilizon_ctl[1347]: {"init terminating in do_boot",{<<"aborting boot">>,[{'Elixir.Config.Provider',boot,2,[]}]}}
vm-test-run-mobilizon> server # [ 126.418966] mobilizon_ctl[1347]: init terminating in do_boot ({,[{Elixir.Config.Provider,boot,2,[]}]})
vm-test-run-mobilizon> server # [ 126.441435] mobilizon_ctl[1347]:
vm-test-run-mobilizon> server # [ 126.456605] systemd[1]: mobilizon.service: Failed with result 'exit-code'.
vm-test-run-mobilizon> server # [ 126.492493] mobilizon_ctl[1347]: Crash dump is being written to: erl_crash.dump...
vm-test-run-mobilizon> server # [ 126.519634] systemd[1]: Failed to start Mobilizon federated organization and mobilization platform.
vm-test-run-mobilizon> server # [ 126.585382] systemd[1]: mobilizon.service: Consumed 5.235s CPU time, no IO, no IP traffic.
This behaviour is new. It got introduced somewhere between 2.1.0 (good) and 3.0.0-beta.1 (bad).