diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3349a101..5c590103 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,6 +27,8 @@ deploy_to_tags: stage: deploy needs: ['test'] image: "node:15.0" + only: + - master except: - tags script: diff --git a/Dockerfile b/Dockerfile index 249667e5..2428e17d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/apps/admin/lib/admin/endpoint.ex b/apps/admin/lib/admin/endpoint.ex index 2d541076..96378b61 100644 --- a/apps/admin/lib/admin/endpoint.ex +++ b/apps/admin/lib/admin/endpoint.ex @@ -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. diff --git a/apps/app/lib/app_web/endpoint.ex b/apps/app/lib/app_web/endpoint.ex index 3af6dd5e..cf76eed1 100644 --- a/apps/app/lib/app_web/endpoint.ex +++ b/apps/app/lib/app_web/endpoint.ex @@ -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. diff --git a/apps/content/lib/content_web/endpoint.ex b/apps/content/lib/content_web/endpoint.ex index 25b1cb78..c65baf6b 100644 --- a/apps/content/lib/content_web/endpoint.ex +++ b/apps/content/lib/content_web/endpoint.ex @@ -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. diff --git a/apps/core/lib/core_web/endpoint.ex b/apps/core/lib/core_web/endpoint.ex index f92d6a16..58cfcfc0 100644 --- a/apps/core/lib/core_web/endpoint.ex +++ b/apps/core/lib/core_web/endpoint.ex @@ -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. diff --git a/config/prod.exs b/config/prod.exs index 4bf46947..b221b0a5 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -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 #