I’ve been trying to deploy my umbrella app for longer than a week now but every time having a different issue which is driving me crazy now.
I’ve got a Dockerfile
which is used for the deployment. Once I deploy the app I get this weird error in logs saying that SECRET_KEY_BASE
doesn’t exist however it’s already in my secrets. I am not sure what the problem is.
I can even see the SECRET_KEY_BASE
environment variable when I ssh
into the server and run env
.
Could you please help?
Logs
$ fly logs -a wild-fog-4280
Waiting for logs...
2022-06-24T01:25:03.726 app[14fdfcd4] fra [info] (elixir 1.13.4) src/elixir.erl:274: :elixir.eval_forms/3
2022-06-24T01:25:03.726 app[14fdfcd4] fra [info] (elixir 1.13.4) lib/code.ex:404: Code.validated_eval_string/3
2022-06-24T01:25:03.726 app[14fdfcd4] fra [info] (elixir 1.13.4) lib/config.ex:260: Config.__eval__!/3
2022-06-24T01:25:03.726 app[14fdfcd4] fra [info] (elixir 1.13.4) lib/config/reader.ex:92: Config.Reader.read!/2
2022-06-24T01:25:03.732 app[14fdfcd4] fra [info] {"init terminating in do_boot",{#{'__exception__'=>true,'__struct__'=>'Elixir.RuntimeError',message=><<101,110,118,105,114,111,110,109,101,110,116,32,118,97,114,105,97,98,108,101,32,83,69,67,82,69,84,95,75,69,89,95,66,65,83,69,32,105,115,32,109,105,115,115,105,110,103,46,10,89,111,117,32,99,97,110,32,103,101,110,101,114,97,116,101,32,111,110,101,32,98,121,32,99,97,108,108,105,110,103,58,32,109,105,120,32,112,104,120,46,103,101,110,46,115,101,99,114,101,116,10>>},[{erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,685},{error_info,#{module=>'Elixir.Exception'}}]},{erl_eval,expr,5,[{file,"erl_eval.erl"},{line,446}]},{erl_eval,exprs,5,[{file,"erl_eval.erl"},{line,123}]},{elixir,recur_eval,3,[{file,"src/elixir.erl"},{line,296}]},{elixir,eval_forms,3,[{file,"src/elixir.erl"},{line,274}]},{'Elixir.Code',validated_eval_string,3,[{file,"lib/code.ex"},{line,404}]},{'Elixir.Config','__eval__!',3,[{file,"lib/config.ex"},{line,260}]},{'Elixir.Config.Reader','read!',2,[{file,"lib/config/reader.ex"},{line,92}]}]}}
2022-06-24T01:25:03.733 app[14fdfcd4] fra [info] init terminating in do_boot ({,[{erl_eval,do_apply,6,[{_},{_},{_}]},{erl_eval,expr,5,[{_},{_}]},{erl_eval,exprs,5,[{_},{_}]},{elixir,recur_eval,3,[{_},{_}]},{elixir,eval_forms,3,[{_},{_}]},{Elixir.Code,validated_eval_string,3,[{_},{_}]},{Elixir.Config,__eval__!,3,[{_},{_}]},{Elixir.Config.Reader,read!,2,[{_},{_}]}]})
2022-06-24T01:25:03.875 app[14fdfcd4] fra [info] Crash dump is being written to: erl_crash.dump...done
2022-06-24T01:25:04.255 app[14fdfcd4] fra [info] Main child exited normally with code: 1
2022-06-24T01:25:04.255 app[14fdfcd4] fra [info] Reaped child process with pid: 570 and signal: SIGUSR1, core dumped? false
2022-06-24T01:25:04.256 app[14fdfcd4] fra [info] Starting clean up.
2022-06-24T01:26:10.479 runner[eac8983d] fra [info] Starting instance
2022-06-24T01:26:11.438 runner[eac8983d] fra [info] Configuring virtual machine
2022-06-24T01:26:11.441 runner[eac8983d] fra [info] Pulling container image
2022-06-24T01:26:14.391 runner[eac8983d] fra [info] Unpacking image
2022-06-24T01:26:15.823 runner[eac8983d] fra [info] Preparing kernel init
2022-06-24T01:26:16.439 runner[eac8983d] fra [info] Configuring firecracker
2022-06-24T01:26:16.536 runner[eac8983d] fra [info] Starting virtual machine
2022-06-24T01:26:16.794 app[eac8983d] fra [info] Starting init (commit: e21acb3)...
2022-06-24T01:26:16.815 app[eac8983d] fra [info] Preparing to run: `bin/dert_gg_web start` as nobody
2022-06-24T01:26:16.825 app[eac8983d] fra [info] 2022/06/24 01:26:16 listening on [fdaa:0:6e5f:a7b:67:eac8:983d:2]:22 (DNS: [fdaa::3]:53)
2022-06-24T01:26:17.821 app[eac8983d] fra [info] Reaped child process with pid: 549, exit code: 0
2022-06-24T01:26:20.603 app[eac8983d] fra [info] 01:26:20.602 [info] Running DertGGWeb.Endpoint with cowboy 2.9.0 at :::4000 (http)
2022-06-24T01:26:20.605 app[eac8983d] fra [info] 01:26:20.604 [info] Access DertGGWeb.Endpoint at http://example.com
2022-06-24T01:26:20.825 app[eac8983d] fra [info] Reaped child process with pid: 570 and signal: SIGUSR1, core dumped? false
2022-06-24T01:26:25.608 app[eac8983d] fra [info] 01:26:25.607 [info] tzdata release in place is from a file last modified Fri, 22 Oct 2021 02:20:47 GMT. Release file on server was last modified Wed, 16 Mar 2022 13:36:02 GMT.
2022-06-24T01:26:27.161 app[eac8983d] fra [info] 01:26:27.160 [info] Tzdata has updated the release from 2021e to 2022a
2022-06-24T01:51:26.312 runner[eac8983d] fra [info] Shutting down virtual machine
2022-06-24T01:51:26.521 app[eac8983d] fra [info] Sending signal SIGINT to main child process w/ PID 515
2022-06-24T01:51:26.525 app[eac8983d] fra [info] BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo
2022-06-24T01:51:26.525 app[eac8983d] fra [info] (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution
2022-06-24T01:51:27.526 app[eac8983d] fra [info] Rein child exited normally with code: 0
2022-06-24T01:51:27.527 app[eac8983d] fra [info] Seaped child process with pid: 572 and signal: SIGUSR1, core dumped? false
2022-06-24T01:51:27.527 app[eac8983d] fra [info] Starting clean up.
2022-06-24T01:51:30.362 runner[3fdb11b8] fra [info] Starting instance
2022-06-24T01:51:30.969 runner[3fdb11b8] fra [info] Configuring virtual machine
2022-06-24T01:51:30.995 runner[3fdb11b8] fra [info] Pulling container image
2022-06-24T01:51:33.798 runner[3fdb11b8] fra [info] Unpacking image
2022-06-24T01:51:35.236 runner[3fdb11b8] fra [info] Preparing kernel init
2022-06-24T01:51:35.924 runner[3fdb11b8] fra [info] Configuring firecracker
2022-06-24T01:51:36.033 runner[3fdb11b8] fra [info] Starting virtual machine
2022-06-24T01:51:36.271 app[3fdb11b8] fra [info] Starting init (commit: e21acb3)...
2022-06-24T01:51:36.293 app[3fdb11b8] fra [info] Preparing to run: `bin/dert_gg_web start` as nobody
2022-06-24T01:51:36.312 app[3fdb11b8] fra [info] 2022/06/24 01:51:36 listening on [fdaa:0:6e5f:a7b:67:3fdb:11b8:2]:22 (DNS: [fdaa::3]:53)
2022-06-24T01:51:37.304 app[3fdb11b8] fra [info] Reaped child process with pid: 549, exit code: 0
2022-06-24T01:51:39.885 app[3fdb11b8] fra [info] ERROR! Config provider Config.Reader failed with:
2022-06-24T01:51:39.886 app[3fdb11b8] fra [info] ** (RuntimeError) environment variable SECRET_KEY_BASE is missing.
2022-06-24T01:51:39.886 app[3fdb11b8] fra [info] You can generate one by calling: mix phx.gen.secret
2022-06-24T01:51:39.886 app[3fdb11b8] fra [info] (stdlib 3.17.2) erl_eval.erl:685: :erl_eval.do_apply/6
2022-06-24T01:51:39.886 app[3fdb11b8] fra [info] (stdlib 3.17.2) erl_eval.erl:446: :erl_eval.expr/5
2022-06-24T01:51:39.886 app[3fdb11b8] fra [info] (stdlib 3.17.2) erl_eval.erl:123: :erl_eval.exprs/5
2022-06-24T01:51:39.886 app[3fdb11b8] fra [info] (elixir 1.13.4) src/elixir.erl:296: :elixir.recur_eval/3
2022-06-24T01:51:39.886 app[3fdb11b8] fra [info] (elixir 1.13.4) src/elixir.erl:274: :elixir.eval_forms/3
2022-06-24T01:51:39.886 app[3fdb11b8] fra [info] (elixir 1.13.4) lib/code.ex:404: Code.validated_eval_string/3
2022-06-24T01:51:39.886 app[3fdb11b8] fra [info] (elixir 1.13.4) lib/config.ex:260: Config.__eval__!/3
2022-06-24T01:51:39.886 app[3fdb11b8] fra [info] (elixir 1.13.4) lib/config/reader.ex:92: Config.Reader.read!/2
2022-06-24T01:51:39.893 app[3fdb11b8] fra [info] {"init terminating in do_boot",{#{'__exception__'=>true,'__struct__'=>'Elixir.RuntimeError',message=><<101,110,118,105,114,111,110,109,101,110,116,32,118,97,114,105,97,98,108,101,32,83,69,67,82,69,84,95,75,69,89,95,66,65,83,69,32,105,115,32,109,105,115,115,105,110,103,46,10,89,111,117,32,99,97,110,32,103,101,110,101,114,97,116,101,32,111,110,101,32,98,121,32,99,97,108,108,105,110,103,58,32,109,105,120,32,112,104,120,46,103,101,110,46,115,101,99,114,101,116,10>>},[{erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,685},{error_info,#{module=>'Elixir.Exception'}}]},{erl_eval,expr,5,[{file,"erl_eval.erl"},{line,446}]},{erl_eval,exprs,5,[{file,"erl_eval.erl"},{line,123}]},{elixir,recur_eval,3,[{file,"src/elixir.erl"},{line,296}]},{elixir,eval_forms,3,[{file,"src/elixir.erl"},{line,274}]},{'Elixir.Code',validated_eval_string,3,[{file,"lib/code.ex"},{line,404}]},{'Elixir.Config','__eval__!',3,[{file,"lib/config.ex"},{line,260}]},{'Elixir.Config.Reader','read!',2,[{file,"lib/config/reader.ex"},{line,92}]}]}}
2022-06-24T01:51:39.895 app[3fdb11b8] fra [info] init terminating in do_boot ({,[{erl_eval,do_apply,6,[{_},{_},{_}]},{erl_eval,expr,5,[{_},{_}]},{erl_eval,exprs,5,[{_},{_}]},{elixir,recur_eval,3,[{_},{_}]},{elixir,eval_forms,3,[{_},{_}]},{Elixir.Code,validated_eval_string,3,[{_},{_}]},{Elixir.Config,__eval__!,3,[{_},{_}]},{Elixir.Config.Reader,read!,2,[{_},{_}]}]})
2022-06-24T01:51:40.053 app[3fdb11b8] fra [info] Crash dump is being written to: erl_crash.dump...done
2022-06-24T01:51:40.310 app[3fdb11b8] fra [info] Rein child exited normally with code: 1
2022-06-24T01:51:40.311 app[3fdb11b8] fra [info] Seaped child process with pid: 570 and signal: SIGUSR1, core dumped? false
2022-06-24T01:51:40.312 app[3fdb11b8] fra [info] Starting clean up.
2022-06-24T01:51:43.392 runner[74d3a551] fra [info] Starting instance
2022-06-24T01:51:44.027 runner[74d3a551] fra [info] Configuring virtual machine
2022-06-24T01:51:44.034 runner[74d3a551] fra [info] Pulling container image
2022-06-24T01:51:44.636 runner[74d3a551] fra [info] Unpacking image
2022-06-24T01:51:44.644 runner[74d3a551] fra [info] Preparing kernel init
2022-06-24T01:51:46.300 runner[74d3a551] fra [info] Configuring firecracker
2022-06-24T01:51:46.538 runner[74d3a551] fra [info] Starting virtual machine
2022-06-24T01:51:46.839 app[74d3a551] fra [info] Starting init (commit: e21acb3)...
2022-06-24T01:51:46.861 app[74d3a551] fra [info] Preparing to run: `bin/dert_gg_web start` as nobody
2022-06-24T01:51:46.872 app[74d3a551] fra [info] 2022/06/24 01:51:46 listening on [fdaa:0:6e5f:a7b:67:74d3:a551:2]:22 (DNS: [fdaa::3]:53)
2022-06-24T01:51:47.869 app[74d3a551] fra [info] Reaped child process with pid: 549, exit code: 0
2022-06-24T01:51:50.787 app[74d3a551] fra [info] 01:51:50.787 [info] Running DertGGWeb.Endpoint with cowboy 2.9.0 at :::4000 (http)
2022-06-24T01:51:50.791 app[74d3a551] fra [info] 01:51:50.790 [info] Access DertGGWeb.Endpoint at http://example.com
2022-06-24T01:51:50.874 app[74d3a551] fra [info] Reaped child process with pid: 570 and signal: SIGUSR1, core dumped? false
2022-06-24T01:51:54.343 app[74d3a551] fra [info] 01:51:54.343 [info] tzdata release in place is from a file last modified Fri, 22 Oct 2021 02:20:47 GMT. Release file on server was last modified Wed, 16 Mar 2022 13:36:02 GMT.
2022-06-24T01:51:55.988 app[74d3a551] fra [info] 01:51:55.987 [info] Tzdata has updated the release from 2021e to 2022a
2022-06-24T01:52:22.872 runner[74d3a551] fra [info] Shutting down virtual machine
2022-06-24T01:52:23.199 app[74d3a551] fra [info] Sending signal SIGINT to main child process w/ PID 515
2022-06-24T01:52:23.200 app[74d3a551] fra [info] BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo
2022-06-24T01:52:23.200 app[74d3a551] fra [info] (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution
2022-06-24T01:52:24.202 app[74d3a551] fra [info] Main child exited normally with code: 0
2022-06-24T01:52:24.203 app[74d3a551] fra [info] Reaped child process with pid: 572 and signal: SIGUSR1, core dumped? false
2022-06-24T01:52:24.203 app[74d3a551] fra [info] Starting clean up.
2022-06-24T01:52:25.987 runner[be6e65fd] fra [info] Starting instance
2022-06-24T01:52:26.545 runner[be6e65fd] fra [info] Configuring virtual machine
2022-06-24T01:52:26.551 runner[be6e65fd] fra [info] Pulling container image
2022-06-24T01:52:29.365 runner[be6e65fd] fra [info] Unpacking image
2022-06-24T01:52:30.974 runner[be6e65fd] fra [info] Preparing kernel init
2022-06-24T01:52:33.317 runner[be6e65fd] fra [info] Configuring firecracker
2022-06-24T01:52:33.428 runner[be6e65fd] fra [info] Starting virtual machine
2022-06-24T01:52:33.694 app[be6e65fd] fra [info] Starting init (commit: e21acb3)...
2022-06-24T01:52:33.713 app[be6e65fd] fra [info] Preparing to run: `bin/dert_gg_web start` as nobody
2022-06-24T01:52:33.723 app[be6e65fd] fra [info] 2022/06/24 01:52:33 listening on [fdaa:0:6e5f:a7b:67:be6e:65fd:2]:22 (DNS: [fdaa::3]:53)
2022-06-24T01:52:34.720 app[be6e65fd] fra [info] Reaped child process with pid: 549, exit code: 0
2022-06-24T01:52:37.292 app[be6e65fd] fra [info] 01:52:37.292 [info] Running DertGGWeb.Endpoint with cowboy 2.9.0 at :::4000 (http)
2022-06-24T01:52:37.294 app[be6e65fd] fra [info] 01:52:37.294 [info] Access DertGGWeb.Endpoint at http://example.com
2022-06-24T01:52:37.725 app[be6e65fd] fra [info] Reaped child process with pid: 570 and signal: SIGUSR1, core dumped? false
2022-06-24T01:52:40.853 app[be6e65fd] fra [info] 01:52:40.853 [info] tzdata release in place is from a file last modified Fri, 22 Oct 2021 02:20:47 GMT. Release file on server was last modified Wed, 16 Mar 2022 13:36:02 GMT.
2022-06-24T01:52:42.532 app[be6e65fd] fra [info] 01:52:42.530 [info] Tzdata has updated the release from 2021e to 2022a
Dockerfile
FROM elixir:1.13.4-alpine AS build
ARG SENTRY_DSN
# install build dependencies
RUN apk add --no-cache build-base npm git
# prepare build dir
WORKDIR /app
# install hex + rebar
RUN mix local.hex --force && \
mix local.rebar --force
# set build ENV
ENV MIX_ENV=prod
# copy umbrella apps
COPY apps/dert_gg apps/dert_gg
COPY apps/dert_gg_web/ apps/dert_gg_web/
# install mix dependencies
COPY mix.exs mix.lock ./
COPY config config
RUN mix do deps.get --only prod, deps.compile
RUN mix phx.digest
RUN mix do compile, release
# build assets
# COPY apps/dert_gg_web/assets/package.json apps/dert_gg_web/assets/package-lock.json ./apps/dert_gg_web/assets/
# COPY apps/dert_gg_web/priv apps/dert_gg_web/assets apps/dert_gg_web/assets/
# RUN npm --prefix ./apps/dert_gg_web/assets ci --progress=false --no-audit --loglevel=error
# RUN npm run --prefix ./apps/dert_gg_web/assets deploy
# RUN mix phx.digest
# # compile and build release
# COPY . .
# RUN mix do compile, release
# # prepare release image
FROM alpine:3 AS app
RUN apk add --no-cache openssl ncurses-libs libgcc libstdc++
WORKDIR /app
RUN chown nobody:nobody /app
USER nobody:nobody
COPY --from=build --chown=nobody:nobody /app/_build/prod/rel/dert_gg_web ./
ENV HOME=/app
CMD ["bin/dert_gg_web", "start"]
Fly.toml
# fly.toml file generated for wild-fog-4280 on 2022-06-24T03:20:49+02:00
app = "wild-fog-4280"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
[build]
dockerfile = "./Dockerfile"
build-target = "app"
[env]
[experimental]
allowed_public_ports = []
auto_rollback = true
[[services]]
http_checks = []
internal_port = 8080
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"
[[services.ports]]
force_https = true
handlers = ["http"]
port = 80
[[services.ports]]
handlers = ["tls", "http"]
port = 443
[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"
Secrets
╰─$ fly secrets list
Update available 0.0.332 -> v0.0.335.
Run "fly version update" to upgrade.
NAME DIGEST DATE
DATABASE_URL 112634846a9c0ea63229ffd31795d364 41m25s ago
SECRET_KEY_BASE 90f400390e3e1c14462683d9299173c9 37m18s ago
SENTRY_DSN 01f6ad7ecdd209e8c8cb11fb5e18d967 11m19s ago