fix: Fix prod configuration for Docker
This commit is contained in:
parent
3bd2f1a42c
commit
5ff4a948ed
7 changed files with 86 additions and 13 deletions
|
@ -27,6 +27,8 @@ deploy_to_tags:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
needs: ['test']
|
needs: ['test']
|
||||||
image: "node:15.0"
|
image: "node:15.0"
|
||||||
|
only:
|
||||||
|
- master
|
||||||
except:
|
except:
|
||||||
- tags
|
- tags
|
||||||
script:
|
script:
|
||||||
|
|
|
@ -33,4 +33,4 @@ ADD ./apps /root/app/apps
|
||||||
RUN MAKE=cmake mix compile
|
RUN MAKE=cmake mix compile
|
||||||
RUN mix phx.digest
|
RUN mix phx.digest
|
||||||
|
|
||||||
CMD ["script/server"]
|
CMD ["mix", "phx.server"]
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
defmodule Admin.Endpoint do
|
defmodule Admin.Endpoint do
|
||||||
use Phoenix.Endpoint, otp_app: :admin
|
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,
|
# The session will be stored in the cookie and signed,
|
||||||
# this means its contents can be read but not tampered with.
|
# this means its contents can be read but not tampered with.
|
||||||
# Set :encryption_salt if you would also like to encrypt it.
|
# Set :encryption_salt if you would also like to encrypt it.
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
defmodule AppWeb.Endpoint do
|
defmodule AppWeb.Endpoint do
|
||||||
use Phoenix.Endpoint, otp_app: :app
|
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,
|
# The session will be stored in the cookie and signed,
|
||||||
# this means its contents can be read but not tampered with.
|
# this means its contents can be read but not tampered with.
|
||||||
# Set :encryption_salt if you would also like to encrypt it.
|
# Set :encryption_salt if you would also like to encrypt it.
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
defmodule Content.Endpoint do
|
defmodule Content.Endpoint do
|
||||||
use Phoenix.Endpoint, otp_app: :content
|
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,
|
# The session will be stored in the cookie and signed,
|
||||||
# this means its contents can be read but not tampered with.
|
# this means its contents can be read but not tampered with.
|
||||||
# Set :encryption_salt if you would also like to encrypt it.
|
# Set :encryption_salt if you would also like to encrypt it.
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
defmodule CoreWeb.Endpoint do
|
defmodule CoreWeb.Endpoint do
|
||||||
use Phoenix.Endpoint, otp_app: :core
|
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,
|
# The session will be stored in the cookie and signed,
|
||||||
# this means its contents can be read but not tampered with.
|
# this means its contents can be read but not tampered with.
|
||||||
# Set :encryption_salt if you would also like to encrypt it.
|
# Set :encryption_salt if you would also like to encrypt it.
|
||||||
|
|
|
@ -9,21 +9,64 @@ use Mix.Config
|
||||||
# manifest is generated by the `mix phx.digest` task,
|
# manifest is generated by the `mix phx.digest` task,
|
||||||
# which you should run after static files are built and
|
# which you should run after static files are built and
|
||||||
# before starting your production server.
|
# 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,
|
secret_key_base = System.get_env("SECRET_KEY_BASE")
|
||||||
url: [host: "example.com", port: 80],
|
|
||||||
cache_static_manifest: "priv/static/cache_manifest.json"
|
|
||||||
|
|
||||||
config :content, Content.Endpoint,
|
[
|
||||||
url: [host: "example.com", port: 80],
|
{:admin, Admin, false},
|
||||||
cache_static_manifest: "priv/static/cache_manifest.json"
|
{: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,
|
config otp_app, endpoint,
|
||||||
url: [host: "example.com", port: 80],
|
url: [host: "example.com", port: 80],
|
||||||
cache_static_manifest: "priv/static/cache_manifest.json"
|
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
|
# ## SSL Support
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue