9mm

9mm

I’m looking to deploy a Phoenix API to AWS. I don’t need any fancy features, I just need to be able to select a specific node type (high compute), and ideally it could be easy to deploy nodes.

There are thousands of guides I’m finding, and the 3 i’ve tried were all broken.

Is there a really good guide (in terms of security, scalability, configuration, etc), which I can just fully commit to going through?

Showing Posts 1 to 10

gavsim

gavsim

Have you considered nanobox.io? I know they support deploying to AWS and have Elixir / Phoenix as a supported platform: https://guides.nanobox.io/elixir/phoenix/

9mm

9mm OP

That guide is so broken that I just stopped following it.

This is the one I’m doing now:

https://cloud.google.com/community/tutorials/elixir-phoenix-on-kubernetes-google-container-engine

It works great so far, the only part I’m confused on is where I define my environment variables so that REPLACE_OS_VARS from distillery can replace them. I’m assuming its not when i package the release, but after.

idi527

idi527

You can set REPLACE_OS_VARS in a pre configure hook.

As for the distillery guide, it wasn’t broken at all when I followed it a few months ago.

9mm

9mm OP

Hmm weird. I encountered like 3 or 4 places that I fixed easily enough but it didn’t give me confidence in the guide. ultimately I stopped though because I didnt want to depend on amazon blackbox services which Ive had experience with before. Granted, my current method deals with Google blackbox services but I trust those more for some reason.

If you look at that link you will see REPLACE_OS_VARS in the docker image, so I basically do this (all the environment variables at this point look like "${THIS_FORMAT}":

MIX_ENV=prod mix release --env=prod

At this point I can do:

REPLACE_OS_VARS=true MIX_ENV=prod DATABASE_NAME=... REDIS_URL=... _build/whatever/whatever foreground

and it works…

Then

docker build --no-cache -t hello .

I can see in their docker image they have REPLACE_OS_VARS I’m just wondering where they fit in AFTER release but before docker build? Can you explain what you mean by pre-configure hook?

Also as a side question. One thing I found really strange was that I could mix release with your standard "${VAR_HERE}".. and then when i would RUN the release with REPLACE_OS_VARS=true ... foreground it would work! This part I dont understand, how does the app know AT RUN TIME to replace the variables? Is that some code distilierry injects into my app to make it know to do that at run time rather than at compile time?

9mm

9mm OP

Oh I see, its in the deploy scripts in _build/prod/rel/app/lib/

clever

idi527

idi527

You can set REPLACE_OS_VARS just before running the app. It’s being deprecated in favor of config providers, though.

See Runtime Configuration - Distillery Documentation for more.

Can you explain what you mean by pre-configure hook?

9mm

9mm OP

Damn well this looks super confusing. I’ll have to get docker running start to finish first then ill figure out how to do that.

How might I do that with this current strategy I’m doing, can you give me an examle of a single variable and where I put it so I don’t have to read all that (for now)

idi527

idi527

Let’s say you have something like

config :app, db_path: "${DB_PATH}"

in your config.exs somewhere.

To make it replaceable at runtime, you’d need to set REPLACE_OS_VARS before starting the release. One way to do it is in a pre configure hook.

9mm

9mm OP

Oh I’m talking about doing away with this method “${DB_PATH}” and REPLACE_OS_VARS and just doing it the proper way with config providers

im actually just reading now to see how to do it

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
bradley
I really like the adapter patterns that ecto, nebulex, waffle, etc. use and would love find something similar for a key management servic...
New
unaware8150
Hello folks! So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
Alvinkariuki
How Can I Optimise Compile Time Dependencies I have been building an elixir application for about 2 years now. Many modules and files ha...
New
dillonoconnor
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews