I followed this guide
I have set DNS_CLUSTER_QUERY, RELEASE_COOKIE and FLY_APP_NAME as secrets but can’t get the clustering and see this error in the logs. I am using docker, What am I missing ?
I followed this guide
I have set DNS_CLUSTER_QUERY, RELEASE_COOKIE and FLY_APP_NAME as secrets but can’t get the clustering and see this error in the logs. I am using docker, What am I missing ?
Did you set them in your rel/env.sh.eex
as the error shows?
If you ran fly launch
it should have tried to inject these into the file for you, but ensure your rel/env.sh
looks like this:
#!/bin/sh
export ERL_AFLAGS="-proto_dist inet6_tcp"
export RELEASE_DISTRIBUTION=name
export RELEASE_NODE="${FLY_APP_NAME}-${FLY_IMAGE_REF##*-}@${FLY_PRIVATE_IP}"
yes I have the file and it seems ok, I am using docker.io/hexpm/elixir:1.16.1-erlang-26.2.2-alpine-3.19.1
What does your Dockerfile look like? RELEASE_DISTRIBUTION=name
is what is setting the “longnames” so if you are still having that error, then the release/beam is not executing that env file.
FROM docker.io/hexpm/elixir:1.16.1-erlang-26.2.2-alpine-3.19.1 AS base
RUN apk add --no-cache --virtual build-deps \
build-base \
git \
ca-certificates
ENV PROJECT_ROOT /src/maverick
ENV PATH ${PROJECT_ROOT}/bin:$PATH
WORKDIR ${PROJECT_ROOT}
# Install Hex+Rebar
RUN mix local.hex --force && mix local.rebar --force
ARG MIX_ENV
ARG S3_ACCESS_KEY
ARG S3_SECRET_KEY
ENV MIX_ENV prod
ENV S3_ACCESS_KEY="${S3_ACCESS_KEY}"
ENV S3_SECRET_KEY="${S3_SECRET_KEY}"
COPY mix.exs mix.lock ./
RUN mix deps.get --only prod
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 common configuration files
COPY config/*.exs config/
# Copy environment-specific configuration file based on RELEASE_ENV
RUN mix deps.compile
COPY priv priv
COPY assets assets
# compile assets
RUN mix assets.deploy
# compile and build the release
COPY lib lib
RUN MIX_ENV=prod mix compile
# changes to config/runtime.exs don't require recompiling the code
COPY config/runtime.exs config/
# uncomment COPY if rel/ exists
# COPY rel rel
RUN MIX_ENV=prod mix release
# ---- Application Stage ----
FROM docker.io/alpine:3.19.1 AS app
ENV LANG=C.UTF-8
# Install openssl
RUN apk add --no-cache --virtual build-dep \
build-base \
openssl \
ncurses \
ffmpeg
ENV PROJECT_ROOT /src/maverick
ENV PATH ${PROJECT_ROOT}/bin:$PATH
WORKDIR ${PROJECT_ROOT}
# set build ENV
ARG MIX_ENV
ENV MIX_ENV prod
COPY --from=base ${PROJECT_ROOT}/_build/${MIX_ENV}/rel/maverick ./
ENTRYPOINT [ "bin/maverick" ]
# Usage:
# * build: sudo docker image build -t elixir/maverick .
# * shell: sudo docker container run --rm -it --entrypoint "" -p 127.0.0.1:4000:4000 elixir/maverick sh
# * run: sudo docker container run --rm -it -p 127.0.0.1:4000:4000 --name maverick elixir/maverick
# * exec: sudo docker container exec -it maverick sh
# * logs: sudo docker container logs --follow --tail 100 maverick
CMD [ "start" ]
You need to uncomment this line
It works, thanks
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.