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
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…