Closed loganmarchione closed 1 year ago
@loganmarchione thanks for the PR! You can run mix phx.gen.secret and use that value for the env var. It should be static and not regenerated every time you run the app.
I'm not a developer and I don't want to install Elixir/Mix/Phoenix/Hex on my machine (and I'm sure most users won't want to either). What are the requirements of the SECRET_KEY_BASE
string? Length? Character sets?
I had to use this really long, ugly command to run mix phx.gen.secret
in Docker.
docker run -it --rm elixir /bin/bash -c "mix local.hex --force && \
mix archive.install --force hex phx_new && \
mix phx.new --no-install test && \
cd test && \
mix local.rebar --force && \
mix deps.get && \
mix phx.gen.secret"
If we can use a different program that most users have installed, like openssl
or md5sum
, to generate random strings, that would be easier (some examples here).
For sure, the only requirement is a 32 to 64 length string. Good idea!
Thanks again @loganmarchione merging this and making some small tweaks to it.
This is a basic
docker-compose.yml
file. A couple things:build
element to build the image each time (this takes about a minute on a modern-ish laptop). Ideally, you would pre-build and publish the images for users to consume.What is
SECRET_KEY_BASE
? The app wouldn't start unless I set an environment variable forSECRET_KEY_BASE
.SECRET_KEY_BASE
set toasdf
, it complained that it was too short. I had to runopenssl rand -hex 32
to generate a key. Does this need to stay static for the life of the database? What kind of characters should make up this key? Is 64 characters enough, or should it be longer?We can't find the internet
...