matthieuchabert

matthieuchabert

Hi!

I’m migrating a big Phoenix project from Heroku to Render and I’d like to know if someone has done it before.

We’ll use a custom Dockerfile because we need to install a bunch of dependencies. Do you know of any good Docker image that I can use?

I came across this Medium tutorial (paywall) but it uses Docker Compose which we won’t need.

Also I’m evaluating potential unknowns. What gotchas should I be aware of?

Thank you.

Showing Posts 1 to 2

stefanchrobot

stefanchrobot

I’ve ran an app on Render for some time, but I’ve moved to Digital Ocean’s App Platform and I’m happy with it so far. It has the same features as Render, but the console and logs feel snappier. You get some basic charts (RAM, CPU usage) out of the box for free. Other than that both do Docker + ENV and they handle HTTPS for you, which is really nice.

The advantage of Docker is that once you’re happy with your Dockerfile, you can run the same image on any platform (Heroku, Render, Digital Ocean).

Either way, here’s what Phoenix guides suggest for the Dockerfile. And here’s mine:

FROM hexpm/elixir:1.11.3-erlang-23.3.2-alpine-3.13.3 AS builder

# Install build tools.
RUN apk add --no-cache build-base nodejs=14.16.1-r1 npm=14.16.1-r1

# Prepare build directory.
WORKDIR /app

# Copy the sources.
COPY . ./

# Install Hex and Rebar.
RUN mix local.hex --force && \
    mix local.rebar --force

# Build in prod env.
ENV MIX_ENV=prod

# Get and build dependencies.
RUN mix deps.get && \
    mix deps.compile

# Build assets.
RUN cd assets && \
    npm install && \
    npm run build

# Prepare assets.
RUN mix phx.digest

# Assemble the release.
RUN mix release

# Prepare the release image.
FROM alpine:3.11.3 AS release

# Install dependencies:
# - Erlang requires ncurses-libs
# - the :ssl module dynamically links to openssl
RUN apk add --no-cache openssl ncurses-libs

WORKDIR /app
COPY --from=builder --chown=nobody:nobody /app/_build/prod/rel/app ./

# Use the user with minimal permissions.
RUN chown -R nobody:nobody /app
USER nobody:nobody
ENV HOME=/app

CMD ["sh", "-c", "bin/app eval MyApp.Release.migrate && bin/app start"]

One thing I’m doing differently is that I control the files I copy to the builder image with .dockerignore.

matthieuchabert

matthieuchabert OP

Thank you for your answer :slight_smile:

I agree that Render logs and charts aren’t perfect but with (paid?) addons you can have them.

Thanks I missed this part of the documentation.

We’ll stick with Render for now and I’ll update this thread if I run in any issue.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
ryanwinchester
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted” Version...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews