fix: Fix prod configuration for Docker

This commit is contained in:
Robert Prehn 2021-01-07 15:53:17 -06:00
parent 3bd2f1a42c
commit 5ff4a948ed
7 changed files with 86 additions and 13 deletions

View file

@ -27,6 +27,8 @@ deploy_to_tags:
stage: deploy
needs: ['test']
image: "node:15.0"
only:
- master
except:
- tags
script:

View file

@ -33,4 +33,4 @@ ADD ./apps /root/app/apps
RUN MAKE=cmake mix compile
RUN mix phx.digest
CMD ["script/server"]
CMD ["mix", "phx.server"]

View file

@ -1,6 +1,13 @@
defmodule Admin.Endpoint do
use Phoenix.Endpoint, otp_app: :admin
def init(_, config) do
if Application.get_env(:phoenix, :serve_endpoints) && !Keyword.get(config, :secret_key_base) do
raise "secret_key_base setting of Endpoint is not set"
end
{:ok, config}
end
# The session will be stored in the cookie and signed,
# this means its contents can be read but not tampered with.
# Set :encryption_salt if you would also like to encrypt it.

View file

@ -1,6 +1,13 @@
defmodule AppWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :app
def init(_, config) do
if Application.get_env(:phoenix, :serve_endpoints) && !Keyword.get(config, :secret_key_base) do
raise "secret_key_base setting of Endpoint is not set"
end
{:ok, config}
end
# The session will be stored in the cookie and signed,
# this means its contents can be read but not tampered with.
# Set :encryption_salt if you would also like to encrypt it.

View file

@ -1,6 +1,13 @@
defmodule Content.Endpoint do
use Phoenix.Endpoint, otp_app: :content
def init(_, config) do
if Application.get_env(:phoenix, :serve_endpoints) && !Keyword.get(config, :secret_key_base) do
raise "secret_key_base setting of Endpoint is not set"
end
{:ok, config}
end
# The session will be stored in the cookie and signed,
# this means its contents can be read but not tampered with.
# Set :encryption_salt if you would also like to encrypt it.

View file

@ -1,6 +1,13 @@
defmodule CoreWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :core
def init(_, config) do
if Application.get_env(:phoenix, :serve_endpoints) && !Keyword.get(config, :secret_key_base) do
raise "secret_key_base setting of Endpoint is not set"
end
{:ok, config}
end
# The session will be stored in the cookie and signed,
# this means its contents can be read but not tampered with.
# Set :encryption_salt if you would also like to encrypt it.

View file

@ -9,21 +9,64 @@ use Mix.Config
# manifest is generated by the `mix phx.digest` task,
# which you should run after static files are built and
# before starting your production server.
config :app, App.Endpoint,
url: [host: "example.com", port: 80],
cache_static_manifest: "priv/static/cache_manifest.json"
config :admin, Admin.Endpoint,
url: [host: "example.com", port: 80],
cache_static_manifest: "priv/static/cache_manifest.json"
secret_key_base = System.get_env("SECRET_KEY_BASE")
config :content, Content.Endpoint,
url: [host: "example.com", port: 80],
cache_static_manifest: "priv/static/cache_manifest.json"
[
{:admin, Admin, false},
{:app, AppWeb, true},
{:content, Content, false},
{:core, CoreWeb, false},
]
|> Enum.map(fn {otp_app, module, start_server} ->
endpoint = Module.concat(module, "Endpoint")
config :core, AppWeb.Endpoint,
url: [host: "example.com", port: 80],
cache_static_manifest: "priv/static/cache_manifest.json"
config otp_app, endpoint,
url: [host: "example.com", port: 80],
cache_static_manifest: "priv/static/cache_manifest.json",
http: [
port: String.to_integer(System.get_env("PORT") || "4000"),
transport_options: [socket_opts: [:inet6]]
],
secret_key_base: secret_key_base,
pubsub_server: App.PubSub,
live_view: [signing_salt: "g5ltUbnQ"],
server: start_server
end)
# ## Using releases (Elixir v1.9+)
#
# If you are doing OTP releases, you need to instruct Phoenix
# to start each relevant endpoint:
#
# config :admin, Admin.Endpoint, server: true
#
# Then you can assemble a release by calling `mix release`.
# See `mix help release` for more information.
database_url = System.get_env("DATABASE_URL")
[
{:admin, Admin.Repo},
{:app, App.Repo},
{:content, Content.Repo},
{:core, Core.Repo}
]
|> Enum.map(fn {otp_app, repo} ->
config otp_app, repo,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
end)
# ## Using releases (Elixir v1.9+)
#
# If you are doing OTP releases, you need to instruct Phoenix
# to start each relevant endpoint:
#
# config :auth_web, AuthWeb.Endpoint, server: true
#
# Then you can assemble a release by calling `mix release`.
# See `mix help release` for more information.
# ## SSL Support
#