As you can see in the below screenshot, the env is set to production.
But, still, I’m seeing detailed logs in the console. Is this intended behaviour?
This is my config/prod.exs file
import Config
# Configures Swoosh API Client
config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: Socket.Finch
# Disable Swoosh Local Memory Storage
config :swoosh, local: false
# Do not print debug messages in production
config :logger, level: :info
# Runtime production configuration, including reading
# of environment variables, is done on config/runtime.exs.
This also includes info log… and above
but not the debug log level
https://hexdocs.pm/logger/1.15/Logger.html#module-levels
If You want to hide info log in production, You could set the log level to :notice
2 Likes
Yeah, setting it to notice helps in my case.
1 Like
By the way, running mix phx.server in production isn’t the best approach. Take a look at mix release.
2 Likes
Hi @hauleth Thanks for your input. But running with the release just keeps the shell idle.
Nothing else is happening.
export MIX_ENV=prod && PORT=4000 _build/prod/rel/socket/bin/socket start
Well, then you should start with that. Phoenix has good docs on how to Dockerize an app, plus it even has a generator. Have you compared your Dockerfile with it?
1 Like
I’m not using docker. I’m using Ubuntu VPS and systems to manage the process
Ah oops, sorry.
And yes you should use mix release .
2 Likes
This is after running mix release
Hi @hauleth Thanks for your input. But running with the release just keeps the shell idle.
Nothing else is happening.
export MIX_ENV=prod && PORT=4000 _build/prod/rel/socket/bin/socket start
Yes, I saw that. My point was: did you check journalctl? You said that you used systemd?
1 Like
It’s just blank. Nothing is happening.
Just to be crystal clear: are you running mix release on the production server?
1 Like
Do You set the required environment variables?
It is mandatory when running in release mode
Yes i did, I set PORT and MIX_ENV=prod
I was expecting more variables…
PHX_SERVER
DATABASE_URL
SECRET_KEY_BASE
but if it works with mix in prod, it should be ok too
2 Likes
Yeah, it works. There is not much actually. One API Route which broadcasts using channels.