Hubs-Foundation / reticulum

Phoenix web server for Hubs
Mozilla Public License 2.0
448 stars 180 forks source link

config.toml keyfile ignored when running production release #491

Open mkg20001 opened 3 years ago

mkg20001 commented 3 years ago

Currently trying to get a DIY hubs on ubuntu running

Ubuntu 20.04 in LXD deployed with this script

Added some patches for sql via socket and to fix startup errors

    sed "s|hostname: \"localhost\"|socket_dir: \"/run/postgresql\"|g" -i config/prod.exs
    sed "s|username: \"postgres\",|username: \"root\",|g" -i config/prod.exs
    sed "s|password: \"postgres\",|show_sensitive_data_on_connection_error: true,|g" -i config/prod.exs

    sed "s%password = session_lock_db_config |> Keyword.get(:password)%socket_dir = session_lock_db_config |> Keyword.get(:socket_dir)%" -i ./lib/ret/locking.ex
    sed "s|password: password,|socket_dir: socket_dir,|" -i ./lib/ret/locking.ex

    echo 'config :ret, Ret.Habitat, ip: "127.0.0.1", http_port: 9631' >> config/prod.exs

Then I compiled with MIX_ENV=prod mix distillery.release

Then I added config entries to _build/prod/rel/ret/config.toml among others

[ret."Elixir.RetWeb.Endpoint".https]
cacertfile = "/var/reticulum/cert-hubs.local.pem"
certfile = "/var/reticulum/cert-hubs.local.pem"
keyfile = "/var/reticulum/key-hubs.local.pem"
port = 4544

Now when starting reticulum using LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 REPLACE_OS_VARS=true NODE_NAME=test NODE_COOKIE=testetset _build/prod/rel/ret/bin/ret foreground it complains about missing keyfile

Also cat _build/prod/rel/ret/var/sys.config | grep key does not contain keyfile

On Hubs Personal AWS it does, even when I directly launch it it picks up config properly.

Can anyone point me to what I'm doing wrong?

Error msg

12:13:54.553 [info] Application ret exited: Ret.Application.start(:normal, []) returned an error: shutdown: failed to start child: RetWeb.Endpoint
    ** (EXIT) an exception was raised:
        ** (ArgumentError) could not start Cowboy2 adapter, missing option :key/:keyfile
            (plug_cowboy 2.1.3) lib/plug/cowboy.ex:310: Plug.Cowboy.fail/1
            (plug_cowboy 2.1.3) lib/plug/cowboy.ex:62: Plug.Cowboy.args/4
            (plug_cowboy 2.1.3) lib/plug/cowboy.ex:170: Plug.Cowboy.child_spec/1
            (phoenix 1.4.17) lib/phoenix/endpoint/cowboy2_adapter.ex:44: Phoenix.Endpoint.Cowboy2Adapter.child_spec/3
            (phoenix 1.4.17) lib/phoenix/endpoint/supervisor.ex:108: anonymous fn/6 in Phoenix.Endpoint.Supervisor.server_children/4
            (elixir 1.11.2) lib/enum.ex:2181: Enum."-reduce/3-lists^foldl/2-0-"/3
            (phoenix 1.4.17) lib/phoenix/endpoint/supervisor.ex:99: Phoenix.Endpoint.Supervisor.server_children/4
            (phoenix 1.4.17) lib/phoenix/endpoint/supervisor.ex:59: Phoenix.Endpoint.Supervisor.init/1

(commit ca443c520f5a2cb9f0e5da1367b72bddedc8a38a)

mkg20001 commented 3 years ago

I've got most things running on nixOS now https://github.com/mkg20001/hubs-flake

Just this bug left (development is done on ubuntu, production later nixOS - but issue occurs on both)

justincolangelo commented 1 year ago

Have you solved this? We are experiencing the same issue. Tried updating to Elixir 1.11 OTP 23 to fix other things. This one remains.