I solved my problem by using docker to deploy. Haven’t tried to use anything beyond http but at least it works.
Here are my files:
Dockerfile:
ARG ELIXIR_VERSION=1.13.2
ARG OTP_VERSION=24.3.2
ARG DEBIAN_VERSION=bullseye-20210902-slim
ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"
FROM ${BUILDER_IMAGE} as builder
# install build dependencies
RUN apt-get update -y && apt-get install -y build-essential \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
# prepare build dir
WORKDIR /app
# install hex + rebar
RUN mix local.hex --force && \
mix local.rebar --force
# set build ENV
ENV MIX_ENV="prod"
# install mix dependencies
RUN mkdir apps/
RUN mkdir apps/wind_world/
RUN mkdir apps/wind_world_web/
COPY apps/wind_world/mix.exs ./apps/wind_world/
COPY apps/wind_world_web/mix.exs ./apps/wind_world_web/
COPY mix.exs mix.lock ./
RUN mix deps.get --only $MIX_ENV
RUN mkdir config
# copy compile-time config files before we compile dependencies
# to ensure any relevant config change will trigger the dependencies
# to be re-compiled.
COPY config/config.exs config/${MIX_ENV}.exs config/
RUN mix deps.compile
COPY apps/wind_world/lib/ apps/wind_world/lib/
COPY apps/wind_world/priv/ apps/wind_world/priv/
COPY apps/wind_world_web/lib/ apps/wind_world_web/lib/
COPY apps/wind_world_web/priv/ apps/wind_world_web/priv/
COPY apps/wind_world_web/assets/ apps/wind_world_web/assets/
# compile assets
RUN mix cmd --app wind_world_web mix assets.deploy
# Compile the release
RUN mix compile
# Changes to config/runtime.exs don't require recompiling the code
COPY config/runtime.exs config/
COPY rel rel
RUN mix release
# start a new build stage so that the final image will only contain
# the compiled release and other runtime necessities
FROM ${RUNNER_IMAGE}
RUN apt-get update -y && apt-get install -y libstdc++6 openssl libncurses5 locales \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
# Set the locale
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
WORKDIR /app
RUN chown nobody /app
# set runner ENV
ENV MIX_ENV="prod"
ARG DATABASE_PATH
ENV DATABASE_PATH=${DATABASE_PATH}
ARG SECRET_KEY_BASE
ENV SECRET_KEY_BASE=${SECRET_KEY_BASE}
ARG PORT=4000
ENV PORT=${PORT}
# Only copy the final release from the build stage
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/wind_world_umbrella ./
USER nobody
CMD ["/app/bin/server"]
.dockerignore:
.git
!.git/HEAD
!.git/refs
.hg
# Common development/test artifacts
**/cover/
**/doc/
**/test/
**/tmp/
**/.elixir_ls
# Mix artifacts
**/_build/
**/deps/
**/*.ez
# Database
*.db
*.db-*
# Generated on crash by the VM
**/erl_crash.dump
# Static artifacts - These should be fetched and built inside the Docker image
apps/wind_world_web/assets/node_modules/
apps/wind_world_web/priv/static/assets/
apps/wind_world_web/priv/static/cache_manifest.json
# My personal ignores
tmpassets/