Sanjibukai

Sanjibukai

Hello everybody,
Hope everyone is good!

TL;DR: I’m running a Phoenix app as a release where I didn’t defined anything about node configuration etc. (just ran ./prod/rel/my_app/bin/my_app start)
And I want to be able to run an IEx session in it, how can I do?

Edit: I changed the title. It was previously the following:
Best way to quickly read some ecto tables on a running application (within a release)


I am in a situation I thought it will be easy to solve but I’m finding it difficult..

I have an application running in production (deployed as a release).
It was planned to have some kind of a dashboard to see DB persisted data (and allowing to download them as CSV) but it’s not yet implemented (planned for later).
But now my customer realized it would be great if he had some data right now (before the end of the year for analysis purpose).. Something that doesn’t need to be implemented.. Just one shot of the raw data (as a CSV) will be good, even if it’s grabbed manually.
So I said, sure..
Since what he really now is only in one schema (for which I already have a context function like MySchema.list_all) that don’t even had that many entries (estimated around 20 based on payments data) I thought that I’ll simply connect to an iex session and run that expression embedded in some kind of pipeline with some Enum.map in order to format the output (it has some embedded schema).

Well, to begin with I’m unable to run iex because it’s a release and the container it’s running on doesn’t have iex installed..

When I run the following ps aux | grep elixir within the container, I’m getting the a result (the command) that have a --sname my_app_name and --setcookie RAnDomStriNg options.. So I was thinking to connect into the node, but I’m always getting a false after a couple of seconds.. I tried from my dev machine using the domain host but also from spinning up a docker container for that sole purpose on the server and connecting it to the same docker network. But I guess that won’t work anyway, because I don’t open any other port that 4000 on Phoenix. When I’m trying to do Node.connect :my_app_name I got an the error ** Cannot get connection id for node my_app_name. And when I try some kind of host combination I’m getting the error ** System NOT running to use fully qualified hostnames **

So I guess that I’m stuck not being able to run an IEx session on that running app, right?
But does anyone can confirm that or if there’s a way to still run IEx inside that release?
Also what could be done in order to make configure the release so that the next time I’ll be able to connect into it?

Now I’ll try to connect to the Postgres DB… Should be able to grab something I can make use of..

Anyway, thank you very much for any comment..

Showing Posts 1 to 4

derek-zhou

derek-zhou

just ran ./prod/rel/my_app/bin/my_app start_iex?

rodrigues

rodrigues

And I want to be able to run an IEx session in it, how can I do?

Hi @Sanjibukai something you can do is ssh into the machine and run rel/my_app/bin/my_app remote to connect to the running node. Does that work for you?

If you want to run iex locally in your local machine terminal to connect to the remote node, then that might be a bit more complicated, as it needs some SSH port forwarding, and passing iex options, but it’s also a possibility discussed here. This module could help you automate the port detection.

Sanjibukai

Sanjibukai OP

Thanks @derek-zhou for the documentation link, I don’t know why I didn’t think about that..
Thanks @rodrigues for the details.

Indeed the remote option did the trick!

Do you know that if I’m writing some code in that IEx session, like some inlined defmodule etc.. Does that code be part of the running application (in memory) or does the code disappear when I’ll exit the IEx shell?

I don’t want to mess with the production environment…
I guess I’ll grab the output of the list_all and do some data mapping in my dev to be sure..

rodrigues

rodrigues

Yes it does change them, it’s safer to not redefine modules in production environment for sure.

If you really need, you can just ensure it’s a new module name to not mess with others.

— 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
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
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
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
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
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
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
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
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
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

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews