ostap
Trying to put my app out in the wild. Received a Dockerfile from running
mix phx.gen.release --docker
Then on Dokku’s host I mounted a persistent directory and set the DATABASE_PATH env:
dokku config:set --no-restart myapp DATABASE_PATH=/app/storage/db.sqlite3 PHX_HOST=myapp.com SECRET_KEY_BASE=#beforehand do mix phx.gen.secret
dokku storage:ensure-directory myapp
dokku storage:mount myapp /var/lib/dokku/data/storage/myapp:/app/storage
When deploying, I was getting a “database does not exist” error. Therefore made it manually:
sqlite3 /var/lib/dokku/data/storage/myapp/db.sqlite3 "
PRAGMA journal_mode = WAL;
PRAGMA auto_vacuum = INCREMENTAL;
PRAGMA page_size = 4096;
PRAGMA wal_autocheckpoint = 1000;
VACUUM;"
# P.S I executed this as root, for better or worse...
However, on another deployment attempt the app still couldn’t connect to this database or run migrations. This time, the error is different:
** (RuntimeError) connect raised MatchError exception. The exception details are hidden, as they may contain sensitive data such as database credentials. You may set :show_sensitive_data_on_connection_error to true when starting your connection if you wish to see all of the details
(exqlite 0.33.1) lib/exqlite/connection.ex:396: Exqlite.Connection.get_pragma/2
(exqlite 0.33.1) lib/exqlite/connection.ex:405: Exqlite.Connection.maybe_set_pragma/3
(exqlite 0.33.1) lib/exqlite/connection.ex:551: Exqlite.Connection.do_connect/2
(db_connection 2.8.1) lib/db_connection/connection.ex:79: DBConnection.Connection.handle_event/4
Any ideas on why this could be happening?
Trending in Questions
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
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
I’m working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication):
toke...
New
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
** (ArgumentError) expected :max_attempts to be a positive integer, got: {:@, [line: 10, column: 19], [{:max_attempts, [line: 10, column:...
New
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
Other Trending Topics
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
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
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
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
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
ostap
I have set
show_sensitive_data_on_connection_errortotrueinruntime.exs, just like it suggested in the error message, and can now see the actual error:I’ll post an update when I have an answer.
rhcarvalho
It’s because the user inside the container is not root (good practice). I imagine you have nothing important there yet, so my suggestion is that you delete the file (as root) and recreate from inside the container (as the correct user).
E.g. with
mix ecto.setup(Typing on mobile off the top of my head, there can be mistakes)
ostap
Thank you!
I deleted the SQLite file and added database creation to
release.ex:But, it still couldn’t access. So I added a touch command in
app.json(for Dokku)remote: touch: cannot touch '/app/storage/wetouched': Permission deniedThis makes me think the container is somehow completely immutable at build time. I’ll dive deeper into Dokku documentation, and potentially try using buildpacks instead of Dockerfile.
rhcarvalho
Oh, you don’t want to create a database during build. The database itself is not to be part of the Docker image.
It will be created/migrated at run time, when replacing the current deploy with the new (after you get the app out to the world…)
ostap
My bad for mentioning earlier: the
predeployscript actually runs as new container from the built image, not during the build.This command solved it for me:
Source and relevant GitHub issue
It was the “permissions” thing all along.
rhcarvalho
That does it, but makes the database file writable by all users.
rhcarvalho
A safer option is to use
(Assuming
USER nobodyfrom phoenix/priv/templates/phx.gen.release/Dockerfile.eex at v1.8.3 · phoenixframework/phoenix · GitHub)rhcarvalho
Correcting a small mistake in my previous post – there’s no
--chown uid:gid, but instead use--chown falseand then manuallychownthe directory as needed: