I have a phoenix application I deploy using mix release.
This is my mix release file:
import Config
database_url = System.fetch_env!("DATABASE_URL")
pool_size = System.fetch_env!("POOL_SIZE")
application_port = System.fetch_env!("APP_PORT")
secret_key_base = System.get_env("SECRET_KEY_BASE")
live_view_sigining_salt = System.fetch_env!("SIGNING_SALT")
initial_user_password = System.fetch_env!("INITIAL_PASSWORD")
s3_component_bucket = System.fetch_env!("S3_COMPONENT_BUCKET")
dynamo_db_component_upload_table = System.fetch_env!("DYNAMODB_COMPONENT_UPLOAD_TABLE")
s3_models_bucket = System.fetch_env!("S3_MODELS_BUCKET")
aws_access_key_id = System.fetch_env!("AWS_ACCESS_KEY_ID")
aws_secret_access_key = System.fetch_env!("AWS_SECRET_ACCESS_KEY")
config :cybord, Cybord.Repo,
# ssl: true,
url: database_url,
pool_size: String.to_integer(pool_size)
config :cybord, CybordWeb.Endpoint,
http: [
:inet6,
port: String.to_integer(application_port),
transport_options: [socket_opts: [:inet6]],
protocol_options: [idle_timeout: :infinity]
],
# This is critical for ensuring web-sockets properly authorize.
url: [host: "localhost"],
render_errors: [view: CybordWeb.ErrorView, accepts: ~w(json), layout: false],
pubsub_server: Cybord.PubSub,
live_view: [signing_salt: live_view_sigining_salt],
secret_key_base: secret_key_base
config :cybord,
cool_text: System.fetch_env!("COOL_TEXT"),
initial_password: initial_user_password,
component_images_storage_bucket: s3_component_bucket,
dynamo_db_component_table: dynamo_db_component_upload_table,
models_storage_bucket: s3_models_bucket
As you can see idle_timeout: :infinity. But I get a timeout on my production server (deployed on AWS ECS)
The timeout happens after 60 sec which is the cowboy default idle timeout.
This makes me think that for some reason the EndPoint is read from my prod.exs where there is no mentioning of timeout.
prod.exs
config :cybord, CybordWeb.Endpoint, server: true
config :cybord, open_api_path: "priv/static/swagger.json"
config :ex_aws,
json_codec: Jason,
access_key_id: {:system, "AWS_ACCESS_KEY_ID"},
secret_access_key: {:system, "AWS_SECRET_ACCESS_KEY"},
region: "us-east-2"
What is the precedence order of config files in release?
Anybody has a better idea on why this is happening?