leishman

leishman

I’m trying to use distillery and edeliver to deploy and run run a phoenix app in production. I build on a staging server (with one configuration) and deploy to a production server (with a different configuration). I want to provide these different runtime configurations via ENV variables.

Right now, using the format:

config :my_app, MyApp.Endpoint,
  http: [port: {:system, "HTTP_PORT"}],
  url: [host: {:system, "HOST"}, port: {:system, "URL_PORT"}]

works for the phoenix configs, but not for the ecto/db configs.

At runtime, Postgrex fails to understand this configuration syntax. I tried using the format:

config :my_app, MyApp.Repo,
  adapter: Ecto.Adapters.Postgres,
  hostname: "${DB_HOSTNAME}",
  username: "${DB_USERNAME}",

for my DB configs but this does not work as the strings remain as seen and are not replaced with my ENV variables at runtime.

I’ve read this blog post: How to config environment variables with Elixir and Exrm « Plataformatec Blog

but it seems that the ${} format does not work with edeliver??

I’d prefer to not have to deal with creating separate sys.conf files and linking them. What is the proper way to handle all of this? Thanks.

Showing Posts 1 to 4

jwarlander

jwarlander

The difference is between ExRM and Distillery.. :smiling_face_with_sunglasses: Instead of RELX_REPLACE_OS_VARS=true, try REPLACE_OS_VARS=true.

It’s mentioned for vm.args in the Distillery docs, but definitely applies to sys.config as well.

AndrewDryga

AndrewDryga

For people that found this article by googling it - I’ve written an article on configuration and deployments topic, checking it out.

Also, try reading Distillery docs, they are pretty comprehensive.

idi527

idi527

I’ve seen you mention vault in an ecto thread once (and in the article), have you had any success with using it for configuration?

Thank you for the article btw.

AndrewDryga

AndrewDryga

I’ve rewritten Confex to support configuration adapters and started writing a Vault adapter for it. But then we postponed this task to the later development stages to concentrate on more important things for the project.

— 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
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
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
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
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

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