From e4c6f26c8e3bce9222ae2cd8441dc637424b81f2 Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:28:59 +0100 Subject: [PATCH 01/19] init test elixir 1.13.4 upgrade --- .github/workflows/publish.yaml | 8 ++++---- .github/workflows/test.yaml | 8 ++++---- .tool-versions | 4 ++-- Dockerfile | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index a9288af6c..2cf1e8ac4 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -28,14 +28,14 @@ jobs: uses: actions/cache@v3 with: path: deps - key: ${{ runner.os }}-mix-6-${{ hashFiles('**/mix.lock') }} - restore-keys: ${{ runner.os }}-mix-6 + key: ${{ runner.os }}-mix-7-${{ hashFiles('**/mix.lock') }} + restore-keys: ${{ runner.os }}-mix-7 - name: Restore _build uses: actions/cache@v3 with: path: _build - key: ${{ runner.os }}-mix-6-${{ hashFiles('**/mix.lock') }} - restore-keys: ${{ runner.os }}-mix-6 + key: ${{ runner.os }}-mix-7-${{ hashFiles('**/mix.lock') }} + restore-keys: ${{ runner.os }}-mix-7 - run: mix deps.get - run: mix test - uses: 8398a7/action-slack@v3 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ebb9acf62..59e6608fb 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -146,14 +146,14 @@ jobs: uses: actions/cache@v3 with: path: deps - key: ${{ runner.os }}-mix-6-${{ hashFiles('**/mix.lock') }} - restore-keys: ${{ runner.os }}-mix-6 + key: ${{ runner.os }}-mix-7-${{ hashFiles('**/mix.lock') }} + restore-keys: ${{ runner.os }}-mix-7 - name: Restore _build uses: actions/cache@v3 with: path: _build - key: ${{ runner.os }}-mix-6-${{ hashFiles('**/mix.lock') }} - restore-keys: ${{ runner.os }}-mix-6 + key: ${{ runner.os }}-mix-7-${{ hashFiles('**/mix.lock') }} + restore-keys: ${{ runner.os }}-mix-7 - run: mix deps.get - run: mix test - run: mix coveralls.html diff --git a/.tool-versions b/.tool-versions index 969f79b0f..8b8054aec 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -erlang 24.3.4.8 -elixir 1.12.3 +erlang 24.3.4.6 +elixir 1.13.4 diff --git a/Dockerfile b/Dockerfile index 0719927cc..26024a60e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM bitwalker/alpine-elixir:1.12.3 AS builder +FROM bitwalker/alpine-elixir:1.13.4 AS builder # The following are build arguments used to change variable parts of the image. # The name of your application/release (required) From a27af2f8eba3e2105286b7377bedf72294e1659c Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:28:59 +0100 Subject: [PATCH 02/19] bump erlang to 25 --- .tool-versions | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.tool-versions b/.tool-versions index 8b8054aec..4b884d833 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -erlang 24.3.4.6 +erlang 25.1.2.0 elixir 1.13.4 diff --git a/Dockerfile b/Dockerfile index 26024a60e..fef04d449 100644 --- a/Dockerfile +++ b/Dockerfile @@ -89,7 +89,7 @@ RUN apk add --update --no-cache curl ca-certificates unzip wget openssl && \ chmod +x /usr/local/bin/terrascan && \ chmod +x /usr/local/bin/trivy -FROM erlang:24.3.4.6-alpine +FROM erlang:25.1.2.0-alpine # The name of your application/release (required) ARG APP_NAME From 2275e3f86cb51570df6b99170bd49a6ebd944dd1 Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:28:59 +0100 Subject: [PATCH 03/19] bump ubuntu version for erlang update --- .github/workflows/publish.yaml | 2 +- .github/workflows/test.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 2cf1e8ac4..e3bec72ff 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -7,7 +7,7 @@ on: jobs: test: name: Test - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - uses: erlef/setup-beam@v1 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 59e6608fb..9afea66b2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -125,7 +125,7 @@ jobs: sarif_file: 'trivy-results.sarif' test: name: Test - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - uses: erlef/setup-beam@v1 From 3eceea88c31c985784c418a9eb5d22ef63f0b899 Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:28:59 +0100 Subject: [PATCH 04/19] try less strict erlang version --- .tool-versions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tool-versions b/.tool-versions index 4b884d833..6ea75de46 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -erlang 25.1.2.0 +erlang 25.1.2 elixir 1.13.4 From e3ae018dd2802d3bb43b3b8690c19d8deeb136da Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:41:35 +0100 Subject: [PATCH 05/19] tmp Signed-off-by: David van der Spek --- apps/api/mix.exs | 24 +++++++ config/releases.exs | 163 ++++++++++++++++++++++++++++++++++++++++++++ mix.exs | 1 - mix.lock | 1 - 4 files changed, 187 insertions(+), 2 deletions(-) create mode 100644 config/releases.exs diff --git a/apps/api/mix.exs b/apps/api/mix.exs index f03d014e0..4a10263e9 100644 --- a/apps/api/mix.exs +++ b/apps/api/mix.exs @@ -46,6 +46,30 @@ defmodule Api.MixProject do aliases: aliases(), deps: deps(), test_coverage: [tool: ExCoveralls] + releases: releases() + ] + end + + defp releases() do + [ + dev: [ + include_executables_for: [:unix], + include_erts: true, + strip_beams: false, + quiet: false + ], + subsys: [ + include_executables_for: [:unix], + include_erts: true, + strip_beams: true, + quiet: false + ], + prd: [ + include_executables_for: [:unix], + include_erts: true, + strip_beams: true, + quiet: false + ] ] end diff --git a/config/releases.exs b/config/releases.exs new file mode 100644 index 000000000..17f5c6ea6 --- /dev/null +++ b/config/releases.exs @@ -0,0 +1,163 @@ +import Config + +config :core, + ecto_repos: [Core.Repo], + broker: Core.Conduit.Broker, + env: config_env() + +config :piazza_core, + repos: [Core.Repo] + +config :piazza_core, + shutdown_delay: 60 * 1000 + +config :api, ApiWeb.Endpoint, + url: [host: "localhost"], + secret_key_base: "1rkd5+lxJbdTadyxW7qF/n1fNzKPV010PKf8SEGmUrXwMw0iAZyoyZgWEwr6nmCJ", + render_errors: [view: ApiWeb.ErrorView, accepts: ~w(html json)], + server: true + + +# Configures the endpoint +config :rtc, RtcWeb.Endpoint, + url: [host: "localhost"], + secret_key_base: "xFC5PDvhCrg1iTQ3FM6uMfDGVIIIHE5wdyIwn9FXCwJXOQsTQ/kPFRtP5z6Z/1/a", + render_errors: [view: RtcWeb.ErrorView, accepts: ~w(html json), layout: false], + pubsub_server: Rtc.PubSub, + live_view: [signing_salt: "lFfrgo20"], + server: true + +config :email, EmailWeb.Endpoint, + url: [host: "localhost"], + secret_key_base: "bzUBoQlghS+mt8b6EDUZkJ5LuZaJ1I8lJnnJX2PHpDrunEF7pk6iXIEhB4v2QZbe", + render_errors: [view: EmailWeb.ErrorView, accepts: ~w(html json), layout: false] + +config :email, + host: "example.com", + consumers: [] + +config :core, + host: "https://app.plural.sh" + +config :logger, :console, + format: "$time $metadata[$level] $message\n", + metadata: [:request_id] + +config :phoenix, :json_library, Jason + +config :reverse_proxy_plug, :http_client, ReverseProxyPlug.HTTPClient.Adapters.HTTPoison + +config :core, Core.Guardian, + issuer: "forge", + secret_key: "forge_secret" + +config :core, :chartmuseum, "http://localhost:8080" + +config :core, Core.Services.Payments, + application_fee: 5 + +config :botanist, + ecto_repo: Core.Repo + +config :core, :connection_draining, + shutdown_delay_ms: 1 + +config :waffle, + storage: Waffle.Storage.Google.CloudStorage, + bucket: "forge-assets" + +config :stripity_stripe, + hackney_opts: [connect_timeout: 5000, recv_timeout: 60_000] + +config :core, Core.Email.Mailer, + adapter: Bamboo.LocalAdapter + +config :core, Core.PartitionedCache, + primary: [ + gc_interval: :timer.seconds(3600), + backend: :shards, + partitions: 2, + allocated_memory: 1000 * 1000 * 500 + ] + +config :core, Core.Cache, + local: Core.Cache.Local, + node_selector: Nebulex.Adapters.Dist + +config :core, Core.Conduit.Broker, + adapter: ConduitAMQP, + url: "amqp://rabbitmq:rabbitmq@localhost" + +config :rtc, Rtc.Conduit.Broker, + adapter: ConduitAMQP, + url: "amqp://rabbitmq:rabbitmq@localhost" + +config :worker, Worker.Conduit.Broker, + adapter: ConduitAMQP, + url: "amqp://rabbitmq:rabbitmq@localhost" + +config :libcluster, :topologies, [] + +config :core, start_broker: false +config :rtc, start_broker: false +config :worker, start_broker: false + +# config :lager, :error_logger_redirect, false +# config :lager, :error_logger_whitelist, [Logger.ErrorHandler] + +config :core, Core.Clients.Zoom, + client_id: "dummy-id", + stripe_connect_id: "dummy-secret", + stripe_publishable_key: "pk-stripe" + +config :worker, + registry: "dkr.plural.sh", + docker_env: [] + +config :core, Core.Influx, + database: "plural" + +config :cron, run: false + +config :core, + registry: "dkr.plural.sh", + plural_cmd: "plural", + stripe_connect_id: "ca_dummy", + onplural_domain: "onplural.sh", + gcp_organization: "1323", + gcp_identity: "someone@example.com", + vault: "https://vault.plural.sh:443", + docker_env: [], + openai_token: "openai" + +config :briefly, + directory: [{:system, "TMPDIR"}, {:system, "TMP"}, {:system, "TEMP"}, "/tmp"], + default_prefix: "briefly", + default_extname: "" + +config :worker, rollout_pipeline: [ + Worker.Rollouts.Producer, + {Worker.Rollouts.Pipeline, Worker.Rollouts.Producer} +] + +config :worker, upgrade_pipeline: [] +config :worker, demo_projects_pipeline: [] +config :worker, docker_pipeline: [] + +config :core, Core.Clients.Hydra, + hydra_admin: "http://plural-hydra-admin:4445", + hydra_public: "http://plural-hydra-public:4444" + +config :rtc, :flushable, false + +config :hammer, + backend: {Hammer.Backend.ETS, [expiry_ms: 60_000 * 60, + cleanup_interval_ms: 60_000 * 10]} + +config :worker, + upgrade_interval: 10, + demo_interval: 10, + rollout_interval: 10, + docker_interval: 60 + +import_config "#{config_env()}.exs" diff --git a/mix.exs b/mix.exs index 0f46abf6d..7670976af 100644 --- a/mix.exs +++ b/mix.exs @@ -49,7 +49,6 @@ defmodule Plural.MixProject do defp deps do [ - {:distillery, "~> 2.1"}, {:x509, "~> 0.8.5"}, {:shards, "~> 1.0"}, {:ecto, "~> 3.9.0", override: true}, diff --git a/mix.lock b/mix.lock index b3bb9b95e..918a5d8dd 100644 --- a/mix.lock +++ b/mix.lock @@ -42,7 +42,6 @@ "decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"}, "decorator": {:hex, :decorator, "1.4.0", "a57ac32c823ea7e4e67f5af56412d12b33274661bb7640ec7fc882f8d23ac419", [:mix], [], "hexpm", "0a07cedd9083da875c7418dea95b78361197cf2bf3211d743f6f7ce39656597f"}, "dictionary": {:hex, :dictionary, "0.1.1", "fb333a3ee04c514231f0a5e166dd1c27429620b0dabb12fd42e5d28b11657a0a", [:mix], [], "hexpm", "17bae452ab5ecf7bdd75315c6adb44622242de9cf700ab107865ab5557443c2b"}, - "distillery": {:hex, :distillery, "2.1.1", "f9332afc2eec8a1a2b86f22429e068ef35f84a93ea1718265e740d90dd367814", [:mix], [{:artificery, "~> 0.2", [hex: :artificery, repo: "hexpm", optional: false]}], "hexpm", "bbc7008b0161a6f130d8d903b5b3232351fccc9c31a991f8fcbf2a12ace22995"}, "dns": {:hex, :dns, "2.4.0", "44790a0375b28bdc7b59fc894460bfcb03ffeec4c5984e2c3e8b0797b1518327", [:mix], [], "hexpm", "e178e353c469820d02ba889d6a80d01c8c27b47dfcda4016a9cbc6218e3eed64"}, "earmark": {:hex, :earmark, "1.4.2", "3aa0bd23bc4c61cf2f1e5d752d1bb470560a6f8539974f767a38923bb20e1d7f", [:mix], [], "hexpm", "5e8806285d8a3a8999bd38e4a73c58d28534c856bc38c44818e5ba85bbda16fb"}, "ecto": {:hex, :ecto, "3.9.1", "67173b1687afeb68ce805ee7420b4261649d5e2deed8fe5550df23bab0bc4396", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c80bb3d736648df790f7f92f81b36c922d9dd3203ca65be4ff01d067f54eb304"}, From 0c894ef1196f52e4de135ad9c1fd1aefd4d7948e Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:41:35 +0100 Subject: [PATCH 06/19] tmp 2 Signed-off-by: David van der Spek --- apps/api/mix.exs | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/apps/api/mix.exs b/apps/api/mix.exs index 4a10263e9..5cb0476ab 100644 --- a/apps/api/mix.exs +++ b/apps/api/mix.exs @@ -52,24 +52,54 @@ defmodule Api.MixProject do defp releases() do [ - dev: [ + plural: [ include_executables_for: [:unix], include_erts: true, - strip_beams: false, - quiet: false + strip_beams: true, + quiet: false, + applications: [ + :runtime_tools, + api: :permanent, + core: :permanent, + email: :permanent, + graphql: :load + ] + ], + rtc: [ + include_executables_for: [:unix], + include_erts: true, + strip_beams: true, + quiet: false, + applications: [ + :runtime_tools, + rtc: :permanent, + core: :permanent, + graphql: :load + ] ], - subsys: [ + worker: [ include_executables_for: [:unix], include_erts: true, strip_beams: true, - quiet: false + quiet: false, + applications: [ + :runtime_tools, + worker: :permanent, + core: :permanent + ] ], - prd: [ + cron: [ include_executables_for: [:unix], include_erts: true, strip_beams: true, - quiet: false - ] + quiet: false, + applications: [ + :runtime_tools, + cron: :permanent, + core: :permanent, + email: :permanent + ] + ], ] end From e2493797c0a62cb617344b1a3f02e540abf37659 Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:41:35 +0100 Subject: [PATCH 07/19] maybe this works Signed-off-by: David van der Spek --- mix.exs | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 7670976af..de7090e76 100644 --- a/mix.exs +++ b/mix.exs @@ -43,7 +43,61 @@ defmodule Plural.MixProject do "coveralls.detail": :test, "coveralls.post": :test, "coveralls.html": :test - ] + ], + releases: releases() + ] + end + + defp releases() do + [ + plural: [ + include_executables_for: [:unix], + include_erts: true, + strip_beams: true, + quiet: false, + applications: [ + :runtime_tools, + api: :permanent, + core: :permanent, + email: :permanent, + graphql: :load + ] + ], + rtc: [ + include_executables_for: [:unix], + include_erts: true, + strip_beams: true, + quiet: false, + applications: [ + :runtime_tools, + rtc: :permanent, + core: :permanent, + graphql: :load + ] + ], + worker: [ + include_executables_for: [:unix], + include_erts: true, + strip_beams: true, + quiet: false, + applications: [ + :runtime_tools, + worker: :permanent, + core: :permanent + ] + ], + cron: [ + include_executables_for: [:unix], + include_erts: true, + strip_beams: true, + quiet: false, + applications: [ + :runtime_tools, + cron: :permanent, + core: :permanent, + email: :permanent + ] + ], ] end From b0f04c35a67e05d09292fcf486b3e97a9a3c2b5b Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:41:35 +0100 Subject: [PATCH 08/19] this works - I think Signed-off-by: David van der Spek --- mix.exs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mix.exs b/mix.exs index de7090e76..850edcdb7 100644 --- a/mix.exs +++ b/mix.exs @@ -56,7 +56,6 @@ defmodule Plural.MixProject do strip_beams: true, quiet: false, applications: [ - :runtime_tools, api: :permanent, core: :permanent, email: :permanent, @@ -69,7 +68,6 @@ defmodule Plural.MixProject do strip_beams: true, quiet: false, applications: [ - :runtime_tools, rtc: :permanent, core: :permanent, graphql: :load @@ -81,7 +79,6 @@ defmodule Plural.MixProject do strip_beams: true, quiet: false, applications: [ - :runtime_tools, worker: :permanent, core: :permanent ] @@ -92,7 +89,6 @@ defmodule Plural.MixProject do strip_beams: true, quiet: false, applications: [ - :runtime_tools, cron: :permanent, core: :permanent, email: :permanent From 3e650922c1f0ec8575ae670713546f703c1140ff Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:41:35 +0100 Subject: [PATCH 09/19] fix plural release build Signed-off-by: David van der Spek --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 850edcdb7..c3c02d43d 100644 --- a/mix.exs +++ b/mix.exs @@ -59,7 +59,7 @@ defmodule Plural.MixProject do api: :permanent, core: :permanent, email: :permanent, - graphql: :load + graphql: :permanent ] ], rtc: [ From 154ae6b519190bf2faf0091555da8fcff9e576f8 Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:41:35 +0100 Subject: [PATCH 10/19] fix build for rtc, mode is likely incorrect though Signed-off-by: David van der Spek --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index c3c02d43d..a9e3ca168 100644 --- a/mix.exs +++ b/mix.exs @@ -68,7 +68,7 @@ defmodule Plural.MixProject do strip_beams: true, quiet: false, applications: [ - rtc: :permanent, + rtc: :load, core: :permanent, graphql: :load ] From 6497a670a0a5c3b4cde2412e71ac8e35ca2e0faa Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:41:35 +0100 Subject: [PATCH 11/19] cleanup Signed-off-by: David van der Spek --- apps/api/mix.exs | 54 ------------------------------------------------ 1 file changed, 54 deletions(-) diff --git a/apps/api/mix.exs b/apps/api/mix.exs index 5cb0476ab..f03d014e0 100644 --- a/apps/api/mix.exs +++ b/apps/api/mix.exs @@ -46,60 +46,6 @@ defmodule Api.MixProject do aliases: aliases(), deps: deps(), test_coverage: [tool: ExCoveralls] - releases: releases() - ] - end - - defp releases() do - [ - plural: [ - include_executables_for: [:unix], - include_erts: true, - strip_beams: true, - quiet: false, - applications: [ - :runtime_tools, - api: :permanent, - core: :permanent, - email: :permanent, - graphql: :load - ] - ], - rtc: [ - include_executables_for: [:unix], - include_erts: true, - strip_beams: true, - quiet: false, - applications: [ - :runtime_tools, - rtc: :permanent, - core: :permanent, - graphql: :load - ] - ], - worker: [ - include_executables_for: [:unix], - include_erts: true, - strip_beams: true, - quiet: false, - applications: [ - :runtime_tools, - worker: :permanent, - core: :permanent - ] - ], - cron: [ - include_executables_for: [:unix], - include_erts: true, - strip_beams: true, - quiet: false, - applications: [ - :runtime_tools, - cron: :permanent, - core: :permanent, - email: :permanent - ] - ], ] end From eddd2f87ef33769ceac7aeed5d9255ffdadcfde1 Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:41:35 +0100 Subject: [PATCH 12/19] update dockerfile to use new release command Signed-off-by: David van der Spek --- Dockerfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0719927cc..5d5a6172c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,11 +31,8 @@ RUN mix do deps.get, compile RUN \ mkdir -p /opt/built && \ - mix distillery.release --name ${APP_NAME} && \ - cp _build/${MIX_ENV}/rel/${APP_NAME}/releases/*/${APP_NAME}.tar.gz /opt/built && \ - cd /opt/built && \ - tar -xzf ${APP_NAME}.tar.gz && \ - rm ${APP_NAME}.tar.gz + mix release ${APP_NAME} && \ + mv _build/${MIX_ENV}/rel/${APP_NAME}/releases/*/* /opt/built FROM alpine:3.17.0 as tools From 40b9cb21251d6857578b74babfcc3005e28686c1 Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:41:36 +0100 Subject: [PATCH 13/19] fix copying release into final container Signed-off-by: David van der Spek --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5d5a6172c..5fe0a819a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,7 +32,7 @@ RUN mix do deps.get, compile RUN \ mkdir -p /opt/built && \ mix release ${APP_NAME} && \ - mv _build/${MIX_ENV}/rel/${APP_NAME}/releases/*/* /opt/built + mv _build/${MIX_ENV}/rel/${APP_NAME}/* /opt/built FROM alpine:3.17.0 as tools From 72bf7bc624920a0ae82474613cab14efb583f12e Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:41:36 +0100 Subject: [PATCH 14/19] cleanup and set runtime configs Signed-off-by: David van der Spek --- Dockerfile | 2 +- .../core/config/runtime.exs | 0 .../cron.exs => apps/cron/config/runtime.exs | 0 .../rtc.exs => apps/rtc/config/runtime.exs | 0 .../worker/config/runtime.exs | 0 config/releases.exs | 163 ------------------ rel/config/config.exs => config/runtime.exs | 28 +-- mix.exs | 31 ++++ rel/plugins/.gitignore | 3 - 9 files changed, 46 insertions(+), 181 deletions(-) rename rel/config/plural.exs => apps/core/config/runtime.exs (100%) rename rel/config/cron.exs => apps/cron/config/runtime.exs (100%) rename rel/config/rtc.exs => apps/rtc/config/runtime.exs (100%) rename rel/config/worker.exs => apps/worker/config/runtime.exs (100%) delete mode 100644 config/releases.exs rename rel/config/config.exs => config/runtime.exs (77%) delete mode 100644 rel/plugins/.gitignore diff --git a/Dockerfile b/Dockerfile index 5fe0a819a..c1e0c4b19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -114,4 +114,4 @@ COPY --from=tools /usr/local/bin/terrascan /usr/local/bin/terrascan COPY --from=tools /usr/local/bin/trivy /usr/local/bin/trivy COPY --from=builder /opt/built . -CMD trap 'exit' INT; /opt/app/bin/${APP_NAME} foreground +CMD trap 'exit' INT; /opt/app/bin/${APP_NAME} start diff --git a/rel/config/plural.exs b/apps/core/config/runtime.exs similarity index 100% rename from rel/config/plural.exs rename to apps/core/config/runtime.exs diff --git a/rel/config/cron.exs b/apps/cron/config/runtime.exs similarity index 100% rename from rel/config/cron.exs rename to apps/cron/config/runtime.exs diff --git a/rel/config/rtc.exs b/apps/rtc/config/runtime.exs similarity index 100% rename from rel/config/rtc.exs rename to apps/rtc/config/runtime.exs diff --git a/rel/config/worker.exs b/apps/worker/config/runtime.exs similarity index 100% rename from rel/config/worker.exs rename to apps/worker/config/runtime.exs diff --git a/config/releases.exs b/config/releases.exs deleted file mode 100644 index 17f5c6ea6..000000000 --- a/config/releases.exs +++ /dev/null @@ -1,163 +0,0 @@ -import Config - -config :core, - ecto_repos: [Core.Repo], - broker: Core.Conduit.Broker, - env: config_env() - -config :piazza_core, - repos: [Core.Repo] - -config :piazza_core, - shutdown_delay: 60 * 1000 - -config :api, ApiWeb.Endpoint, - url: [host: "localhost"], - secret_key_base: "1rkd5+lxJbdTadyxW7qF/n1fNzKPV010PKf8SEGmUrXwMw0iAZyoyZgWEwr6nmCJ", - render_errors: [view: ApiWeb.ErrorView, accepts: ~w(html json)], - server: true - - -# Configures the endpoint -config :rtc, RtcWeb.Endpoint, - url: [host: "localhost"], - secret_key_base: "xFC5PDvhCrg1iTQ3FM6uMfDGVIIIHE5wdyIwn9FXCwJXOQsTQ/kPFRtP5z6Z/1/a", - render_errors: [view: RtcWeb.ErrorView, accepts: ~w(html json), layout: false], - pubsub_server: Rtc.PubSub, - live_view: [signing_salt: "lFfrgo20"], - server: true - -config :email, EmailWeb.Endpoint, - url: [host: "localhost"], - secret_key_base: "bzUBoQlghS+mt8b6EDUZkJ5LuZaJ1I8lJnnJX2PHpDrunEF7pk6iXIEhB4v2QZbe", - render_errors: [view: EmailWeb.ErrorView, accepts: ~w(html json), layout: false] - -config :email, - host: "example.com", - consumers: [] - -config :core, - host: "https://app.plural.sh" - -config :logger, :console, - format: "$time $metadata[$level] $message\n", - metadata: [:request_id] - -config :phoenix, :json_library, Jason - -config :reverse_proxy_plug, :http_client, ReverseProxyPlug.HTTPClient.Adapters.HTTPoison - -config :core, Core.Guardian, - issuer: "forge", - secret_key: "forge_secret" - -config :core, :chartmuseum, "http://localhost:8080" - -config :core, Core.Services.Payments, - application_fee: 5 - -config :botanist, - ecto_repo: Core.Repo - -config :core, :connection_draining, - shutdown_delay_ms: 1 - -config :waffle, - storage: Waffle.Storage.Google.CloudStorage, - bucket: "forge-assets" - -config :stripity_stripe, - hackney_opts: [connect_timeout: 5000, recv_timeout: 60_000] - -config :core, Core.Email.Mailer, - adapter: Bamboo.LocalAdapter - -config :core, Core.PartitionedCache, - primary: [ - gc_interval: :timer.seconds(3600), - backend: :shards, - partitions: 2, - allocated_memory: 1000 * 1000 * 500 - ] - -config :core, Core.Cache, - local: Core.Cache.Local, - node_selector: Nebulex.Adapters.Dist - -config :core, Core.Conduit.Broker, - adapter: ConduitAMQP, - url: "amqp://rabbitmq:rabbitmq@localhost" - -config :rtc, Rtc.Conduit.Broker, - adapter: ConduitAMQP, - url: "amqp://rabbitmq:rabbitmq@localhost" - -config :worker, Worker.Conduit.Broker, - adapter: ConduitAMQP, - url: "amqp://rabbitmq:rabbitmq@localhost" - -config :libcluster, :topologies, [] - -config :core, start_broker: false -config :rtc, start_broker: false -config :worker, start_broker: false - -# config :lager, :error_logger_redirect, false -# config :lager, :error_logger_whitelist, [Logger.ErrorHandler] - -config :core, Core.Clients.Zoom, - client_id: "dummy-id", - stripe_connect_id: "dummy-secret", - stripe_publishable_key: "pk-stripe" - -config :worker, - registry: "dkr.plural.sh", - docker_env: [] - -config :core, Core.Influx, - database: "plural" - -config :cron, run: false - -config :core, - registry: "dkr.plural.sh", - plural_cmd: "plural", - stripe_connect_id: "ca_dummy", - onplural_domain: "onplural.sh", - gcp_organization: "1323", - gcp_identity: "someone@example.com", - vault: "https://vault.plural.sh:443", - docker_env: [], - openai_token: "openai" - -config :briefly, - directory: [{:system, "TMPDIR"}, {:system, "TMP"}, {:system, "TEMP"}, "/tmp"], - default_prefix: "briefly", - default_extname: "" - -config :worker, rollout_pipeline: [ - Worker.Rollouts.Producer, - {Worker.Rollouts.Pipeline, Worker.Rollouts.Producer} -] - -config :worker, upgrade_pipeline: [] -config :worker, demo_projects_pipeline: [] -config :worker, docker_pipeline: [] - -config :core, Core.Clients.Hydra, - hydra_admin: "http://plural-hydra-admin:4445", - hydra_public: "http://plural-hydra-public:4444" - -config :rtc, :flushable, false - -config :hammer, - backend: {Hammer.Backend.ETS, [expiry_ms: 60_000 * 60, - cleanup_interval_ms: 60_000 * 10]} - -config :worker, - upgrade_interval: 10, - demo_interval: 10, - rollout_interval: 10, - docker_interval: 60 - -import_config "#{config_env()}.exs" diff --git a/rel/config/config.exs b/config/runtime.exs similarity index 77% rename from rel/config/config.exs rename to config/runtime.exs index f65e6c3ad..59e12b15d 100644 --- a/rel/config/config.exs +++ b/config/runtime.exs @@ -1,7 +1,7 @@ import Config -import System, only: [get_env: 1] +import System, only: [get_env: 1, fetch_env: 1] -host = get_env("HOST") +host = fetch_env!("HOST") config :api, ApiWeb.Endpoint, url: [host: host, port: 80], @@ -17,7 +17,7 @@ config :core, host: "https://#{host}" config :arc, storage: Arc.Storage.GCS, - bucket: get_env("BUCKET") + bucket: fetch_env!("BUCKET") config :core, Core.Guardian, issuer: "plural", @@ -26,7 +26,7 @@ config :core, Core.Guardian, config :core, Core.Repo, database: "plural", username: "plural", - password: get_env("POSTGRES_PASSWORD"), + password: fetch_env!("POSTGRES_PASSWORD"), hostname: get_env("DBHOST") || "plural-postgresql", ssl: String.to_existing_atom(get_env("DBSSL") || "false"), pool_size: 5 @@ -37,28 +37,28 @@ config :cloudflare, config :core, Core.Influx, database: "plural", host: "influxdb.influx", - auth: [method: :basic, username: "admin", password: get_env("INFLUX_PAASSWORD")], + auth: [method: :basic, username: "admin", password: fetch_env!("INFLUX_PAASSWORD")], port: 8086 config :core, :jwt, - pk: get_env("JWT_PRIVATE_KEY"), - cert: get_env("JWT_CERT"), - iss: get_env("JWT_ISS"), - aud: get_env("JWT_AUD") + pk: fetch_env!("JWT_PRIVATE_KEY"), + cert: fetch_env!("JWT_CERT"), + iss: fetch_env!("JWT_ISS"), + aud: fetch_env!("JWT_AUD") config :core, Core.Conduit.Broker, adapter: ConduitAMQP, - url: "amqp://#{get_env("RABBIT_USERNAME")}:#{get_env("RABBIT_PASSWORD")}@rabbitmq.#{get_env("RABBIT_NAMESPACE")}" + url: "amqp://#{fetch_env!("RABBIT_USERNAME")}:#{fetch_env!("RABBIT_PASSWORD")}@rabbitmq.#{fetch_env!("RABBIT_NAMESPACE")}" config :rtc, Rtc.Conduit.Broker, adapter: ConduitAMQP, - url: "amqp://#{get_env("RABBIT_USERNAME")}:#{get_env("RABBIT_PASSWORD")}@rabbitmq.#{get_env("RABBIT_NAMESPACE")}" + url: "amqp://#{fetch_env!("RABBIT_USERNAME")}:#{fetch_env!("RABBIT_PASSWORD")}@rabbitmq.#{fetch_env!("RABBIT_NAMESPACE")}" config :worker, Worker.Conduit.Broker, adapter: ConduitAMQP, - url: "amqp://#{get_env("RABBIT_USERNAME")}:#{get_env("RABBIT_PASSWORD")}@rabbitmq.#{get_env("RABBIT_NAMESPACE")}" + url: "amqp://#{fetch_env!("RABBIT_USERNAME")}:#{fetch_env!("RABBIT_PASSWORD")}@rabbitmq.#{fetch_env!("RABBIT_NAMESPACE")}" -config :piazza_core, aes_key: get_env("AES_KEY") +config :piazza_core, aes_key: fetch_env!("AES_KEY") config :core, Core.Clients.Zoom, client_id: get_env("ZOOM_CLIENT_ID"), @@ -121,7 +121,7 @@ if get_env("GCP_CREDENTIALS") do end config :core, - registry: get_env("DKR_DNS") + registry: fetch_env!("DKR_DNS") config :openai, token: get_env("OPENAI_BEARER_TOKEN") diff --git a/mix.exs b/mix.exs index a9e3ca168..acf1bebbb 100644 --- a/mix.exs +++ b/mix.exs @@ -55,6 +55,10 @@ defmodule Plural.MixProject do include_erts: true, strip_beams: true, quiet: false, + config_providers: [ + {Config.Reader, {:system, "RELEASE_ROOT", "apps/core/config/runtime.exs"}}, + ], + steps: [:assemble, ©_configs/1], applications: [ api: :permanent, core: :permanent, @@ -67,6 +71,10 @@ defmodule Plural.MixProject do include_erts: true, strip_beams: true, quiet: false, + config_providers: [ + {Config.Reader, {:system, "RELEASE_ROOT", "apps/rtc/config/runtime.exs"}}, + ], + steps: [:assemble, ©_configs/1], applications: [ rtc: :load, core: :permanent, @@ -78,6 +86,10 @@ defmodule Plural.MixProject do include_erts: true, strip_beams: true, quiet: false, + config_providers: [ + {Config.Reader, {:system, "RELEASE_ROOT", "apps/worker/config/runtime.exs"}}, + ], + steps: [:assemble, ©_configs/1], applications: [ worker: :permanent, core: :permanent @@ -88,6 +100,10 @@ defmodule Plural.MixProject do include_erts: true, strip_beams: true, quiet: false, + config_providers: [ + {Config.Reader, {:system, "RELEASE_ROOT", "apps/cron/config/runtime.exs"}}, + ], + steps: [:assemble, ©_configs/1], applications: [ cron: :permanent, core: :permanent, @@ -97,6 +113,21 @@ defmodule Plural.MixProject do ] end + defp copy_configs(%{path: path, config_providers: config_providers} = release) do + for {_module, {_context, _root, file_path}} <- config_providers do + # Creating new path + new_path = path <> "/" <> Path.dirname(file_path) + # Removing possible leftover files from previous builds + File.rm_rf!(new_path) + # Creating directory if it doesn't exist + File.mkdir_p!(new_path) + # Copying files to the directory with the same name + File.cp!(Path.expand(file_path), new_path <> "/" <> Path.basename(file_path)) + end + + release + end + defp deps do [ {:x509, "~> 0.8.5"}, diff --git a/rel/plugins/.gitignore b/rel/plugins/.gitignore deleted file mode 100644 index 4fa3b5c29..000000000 --- a/rel/plugins/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.* -!*.exs -!.gitignore \ No newline at end of file From 60b9ed1170ff118121a10f4ceae49263c9358f82 Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:41:36 +0100 Subject: [PATCH 15/19] migrate vm args template Signed-off-by: David van der Spek --- rel/env.bat.eex | 6 ++++++ rel/env.sh.eex | 18 ++++++++++++++++++ rel/remote.vm.args.eex | 11 +++++++++++ rel/vm.args | 30 ------------------------------ rel/vm.args.eex | 11 +++++++++++ 5 files changed, 46 insertions(+), 30 deletions(-) create mode 100644 rel/env.bat.eex create mode 100644 rel/env.sh.eex create mode 100644 rel/remote.vm.args.eex delete mode 100644 rel/vm.args create mode 100644 rel/vm.args.eex diff --git a/rel/env.bat.eex b/rel/env.bat.eex new file mode 100644 index 000000000..6e4098c2b --- /dev/null +++ b/rel/env.bat.eex @@ -0,0 +1,6 @@ +@echo off +rem Set the release to work across nodes. If using the long name format like +rem the one below (my_app@127.0.0.1), you need to also uncomment the +rem RELEASE_DISTRIBUTION variable below. Must be "sname", "name" or "none". +rem set RELEASE_DISTRIBUTION=name +set RELEASE_NODE=<%= @release.name %>@${POD_IP} diff --git a/rel/env.sh.eex b/rel/env.sh.eex new file mode 100644 index 000000000..2c48b5f66 --- /dev/null +++ b/rel/env.sh.eex @@ -0,0 +1,18 @@ +#!/bin/sh + +# Sets and enables heart (recommended only in daemon mode) +# case $RELEASE_COMMAND in +# daemon*) +# HEART_COMMAND="$RELEASE_ROOT/bin/$RELEASE_NAME $RELEASE_COMMAND" +# export HEART_COMMAND +# export ELIXIR_ERL_OPTIONS="-heart" +# ;; +# *) +# ;; +# esac + +# Set the release to work across nodes. If using the long name format like +# the one below (my_app@127.0.0.1), you need to also uncomment the +# RELEASE_DISTRIBUTION variable below. Must be "sname", "name" or "none". +# export RELEASE_DISTRIBUTION=name +export RELEASE_NODE=<%= @release.name %>@${POD_IP} diff --git a/rel/remote.vm.args.eex b/rel/remote.vm.args.eex new file mode 100644 index 000000000..5886aa87e --- /dev/null +++ b/rel/remote.vm.args.eex @@ -0,0 +1,11 @@ +## Customize flags given to the VM: https://erlang.org/doc/man/erl.html +## -mode/-name/-sname/-setcookie are configured via env vars, do not set them here + +## Number of dirty schedulers doing IO work (file, sockets, and others) +##+SDio 5 + +## Increase number of concurrent ports/sockets +##+Q 65536 + +## Tweak GC to run more often +##-env ERL_FULLSWEEP_AFTER 10 diff --git a/rel/vm.args b/rel/vm.args deleted file mode 100644 index d2108a099..000000000 --- a/rel/vm.args +++ /dev/null @@ -1,30 +0,0 @@ -## This file provide the arguments provided to the VM at startup -## You can find a full list of flags and their behaviours at -## http://erlang.org/doc/man/erl.html - -## Name of the node --name <%= release_name %>@${POD_IP} - -## Cookie for distributed erlang --setcookie ${ERLANG_COOKIE} - -## Heartbeat management; auto-restarts VM if it dies or becomes unresponsive -## (Disabled by default..use with caution!) -##-heart - -## Enable kernel poll and a few async threads -##+K true -##+A 5 -## For OTP21+, the +A flag is not used anymore, -## +SDio replace it to use dirty schedulers -##+SDio 5 - -## Increase number of concurrent ports/sockets -##-env ERL_MAX_PORTS 4096 - -## Tweak GC to run more often -##-env ERL_FULLSWEEP_AFTER 10 - -# Enable SMP automatically based on availability -# On OTP21+, this is not needed anymore. --smp auto diff --git a/rel/vm.args.eex b/rel/vm.args.eex new file mode 100644 index 000000000..5886aa87e --- /dev/null +++ b/rel/vm.args.eex @@ -0,0 +1,11 @@ +## Customize flags given to the VM: https://erlang.org/doc/man/erl.html +## -mode/-name/-sname/-setcookie are configured via env vars, do not set them here + +## Number of dirty schedulers doing IO work (file, sockets, and others) +##+SDio 5 + +## Increase number of concurrent ports/sockets +##+Q 65536 + +## Tweak GC to run more often +##-env ERL_FULLSWEEP_AFTER 10 From bdfb0cbfc601687ae754bd2f08468dab489ea2fe Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:41:36 +0100 Subject: [PATCH 16/19] don't use fetch_env Signed-off-by: David van der Spek --- config/runtime.exs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/config/runtime.exs b/config/runtime.exs index 59e12b15d..f65e6c3ad 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -1,7 +1,7 @@ import Config -import System, only: [get_env: 1, fetch_env: 1] +import System, only: [get_env: 1] -host = fetch_env!("HOST") +host = get_env("HOST") config :api, ApiWeb.Endpoint, url: [host: host, port: 80], @@ -17,7 +17,7 @@ config :core, host: "https://#{host}" config :arc, storage: Arc.Storage.GCS, - bucket: fetch_env!("BUCKET") + bucket: get_env("BUCKET") config :core, Core.Guardian, issuer: "plural", @@ -26,7 +26,7 @@ config :core, Core.Guardian, config :core, Core.Repo, database: "plural", username: "plural", - password: fetch_env!("POSTGRES_PASSWORD"), + password: get_env("POSTGRES_PASSWORD"), hostname: get_env("DBHOST") || "plural-postgresql", ssl: String.to_existing_atom(get_env("DBSSL") || "false"), pool_size: 5 @@ -37,28 +37,28 @@ config :cloudflare, config :core, Core.Influx, database: "plural", host: "influxdb.influx", - auth: [method: :basic, username: "admin", password: fetch_env!("INFLUX_PAASSWORD")], + auth: [method: :basic, username: "admin", password: get_env("INFLUX_PAASSWORD")], port: 8086 config :core, :jwt, - pk: fetch_env!("JWT_PRIVATE_KEY"), - cert: fetch_env!("JWT_CERT"), - iss: fetch_env!("JWT_ISS"), - aud: fetch_env!("JWT_AUD") + pk: get_env("JWT_PRIVATE_KEY"), + cert: get_env("JWT_CERT"), + iss: get_env("JWT_ISS"), + aud: get_env("JWT_AUD") config :core, Core.Conduit.Broker, adapter: ConduitAMQP, - url: "amqp://#{fetch_env!("RABBIT_USERNAME")}:#{fetch_env!("RABBIT_PASSWORD")}@rabbitmq.#{fetch_env!("RABBIT_NAMESPACE")}" + url: "amqp://#{get_env("RABBIT_USERNAME")}:#{get_env("RABBIT_PASSWORD")}@rabbitmq.#{get_env("RABBIT_NAMESPACE")}" config :rtc, Rtc.Conduit.Broker, adapter: ConduitAMQP, - url: "amqp://#{fetch_env!("RABBIT_USERNAME")}:#{fetch_env!("RABBIT_PASSWORD")}@rabbitmq.#{fetch_env!("RABBIT_NAMESPACE")}" + url: "amqp://#{get_env("RABBIT_USERNAME")}:#{get_env("RABBIT_PASSWORD")}@rabbitmq.#{get_env("RABBIT_NAMESPACE")}" config :worker, Worker.Conduit.Broker, adapter: ConduitAMQP, - url: "amqp://#{fetch_env!("RABBIT_USERNAME")}:#{fetch_env!("RABBIT_PASSWORD")}@rabbitmq.#{fetch_env!("RABBIT_NAMESPACE")}" + url: "amqp://#{get_env("RABBIT_USERNAME")}:#{get_env("RABBIT_PASSWORD")}@rabbitmq.#{get_env("RABBIT_NAMESPACE")}" -config :piazza_core, aes_key: fetch_env!("AES_KEY") +config :piazza_core, aes_key: get_env("AES_KEY") config :core, Core.Clients.Zoom, client_id: get_env("ZOOM_CLIENT_ID"), @@ -121,7 +121,7 @@ if get_env("GCP_CREDENTIALS") do end config :core, - registry: fetch_env!("DKR_DNS") + registry: get_env("DKR_DNS") config :openai, token: get_env("OPENAI_BEARER_TOKEN") From 0e9ce606546bcee9d515d9c3f408b41421952ee0 Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:41:36 +0100 Subject: [PATCH 17/19] rename runtime.exs to releases.exs Signed-off-by: David van der Spek --- apps/core/config/{runtime.exs => releases.exs} | 0 apps/cron/config/{runtime.exs => releases.exs} | 0 apps/rtc/config/{runtime.exs => releases.exs} | 0 apps/worker/config/{runtime.exs => releases.exs} | 0 config/{runtime.exs => releases.exs} | 0 mix.exs | 8 ++++---- 6 files changed, 4 insertions(+), 4 deletions(-) rename apps/core/config/{runtime.exs => releases.exs} (100%) rename apps/cron/config/{runtime.exs => releases.exs} (100%) rename apps/rtc/config/{runtime.exs => releases.exs} (100%) rename apps/worker/config/{runtime.exs => releases.exs} (100%) rename config/{runtime.exs => releases.exs} (100%) diff --git a/apps/core/config/runtime.exs b/apps/core/config/releases.exs similarity index 100% rename from apps/core/config/runtime.exs rename to apps/core/config/releases.exs diff --git a/apps/cron/config/runtime.exs b/apps/cron/config/releases.exs similarity index 100% rename from apps/cron/config/runtime.exs rename to apps/cron/config/releases.exs diff --git a/apps/rtc/config/runtime.exs b/apps/rtc/config/releases.exs similarity index 100% rename from apps/rtc/config/runtime.exs rename to apps/rtc/config/releases.exs diff --git a/apps/worker/config/runtime.exs b/apps/worker/config/releases.exs similarity index 100% rename from apps/worker/config/runtime.exs rename to apps/worker/config/releases.exs diff --git a/config/runtime.exs b/config/releases.exs similarity index 100% rename from config/runtime.exs rename to config/releases.exs diff --git a/mix.exs b/mix.exs index acf1bebbb..1e143aab5 100644 --- a/mix.exs +++ b/mix.exs @@ -56,7 +56,7 @@ defmodule Plural.MixProject do strip_beams: true, quiet: false, config_providers: [ - {Config.Reader, {:system, "RELEASE_ROOT", "apps/core/config/runtime.exs"}}, + {Config.Reader, {:system, "RELEASE_ROOT", "apps/core/config/releases.exs"}}, ], steps: [:assemble, ©_configs/1], applications: [ @@ -72,7 +72,7 @@ defmodule Plural.MixProject do strip_beams: true, quiet: false, config_providers: [ - {Config.Reader, {:system, "RELEASE_ROOT", "apps/rtc/config/runtime.exs"}}, + {Config.Reader, {:system, "RELEASE_ROOT", "apps/rtc/config/releases.exs"}}, ], steps: [:assemble, ©_configs/1], applications: [ @@ -87,7 +87,7 @@ defmodule Plural.MixProject do strip_beams: true, quiet: false, config_providers: [ - {Config.Reader, {:system, "RELEASE_ROOT", "apps/worker/config/runtime.exs"}}, + {Config.Reader, {:system, "RELEASE_ROOT", "apps/worker/config/releases.exs"}}, ], steps: [:assemble, ©_configs/1], applications: [ @@ -101,7 +101,7 @@ defmodule Plural.MixProject do strip_beams: true, quiet: false, config_providers: [ - {Config.Reader, {:system, "RELEASE_ROOT", "apps/cron/config/runtime.exs"}}, + {Config.Reader, {:system, "RELEASE_ROOT", "apps/cron/config/releases.exs"}}, ], steps: [:assemble, ©_configs/1], applications: [ From ac5f70e8ba085eb38860655260f3d212192dd471 Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:41:36 +0100 Subject: [PATCH 18/19] set rtc to permanent Signed-off-by: David van der Spek --- mix.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mix.exs b/mix.exs index 1e143aab5..661bcd627 100644 --- a/mix.exs +++ b/mix.exs @@ -76,9 +76,9 @@ defmodule Plural.MixProject do ], steps: [:assemble, ©_configs/1], applications: [ - rtc: :load, + rtc: :permanent, core: :permanent, - graphql: :load + graphql: :permanent ] ], worker: [ From 219b6b813a4dabe557fc6aa112780c69496fd870 Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Fri, 10 Feb 2023 17:41:36 +0100 Subject: [PATCH 19/19] cleanup old distillery config Signed-off-by: David van der Spek --- rel/config.exs | 76 -------------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 rel/config.exs diff --git a/rel/config.exs b/rel/config.exs deleted file mode 100644 index e930300f3..000000000 --- a/rel/config.exs +++ /dev/null @@ -1,76 +0,0 @@ -~w(rel plugins *.exs) -|> Path.join() -|> Path.wildcard() -|> Enum.map(&Code.eval_file(&1)) - -use Distillery.Releases.Config, - # This sets the default release built by `mix distillery.release` - default_release: :default, - # This sets the default environment used by `mix distillery.release` - default_environment: Mix.env() - -environment :dev do - set dev_mode: true - set include_erts: false - set cookie: :"[0u(BUb%Eh955Mg5V>:Mgxqa8NY`de)3ikLXo:iM]pU6HUy9NC}C4T(5A=|Xau8/" -end - -environment :prod do - set include_erts: true - set include_src: false - set cookie: :"apMPW^f~jR;8CVeiv`d4(6y]Rv`v_Z;ghL:~3&j!1QM)YRG5_TTpz2q2nGu)9>}l" - set vm_args: "rel/vm.args" - set config_providers: [ - {Distillery.Releases.Config.Providers.Elixir, ["${RELEASE_ROOT_DIR}/etc/config.exs"]}, - {Distillery.Releases.Config.Providers.Elixir, ["${RELEASE_ROOT_DIR}/etc/app.exs"]} - ] - set overlays: [ - {:copy, "rel/config/config.exs", "etc/config.exs"}, - {:copy, "rel/config/<%= release_name %>.exs", "etc/app.exs"} - ] -end - -release :plural do - set version: current_version(:api) - set applications: [ - :runtime_tools, - api: :permanent, - core: :permanent, - email: :permanent, - graphql: :load - ] - - set commands: [ - migrate: "rel/commands/migrate.sh", - drop: "rel/commands/drop.sh" - ] -end - -release :rtc do - set version: current_version(:rtc) - set applications: [ - :runtime_tools, - rtc: :permanent, - core: :permanent, - graphql: :load - ] -end - -release :worker do - set version: current_version(:worker) - set applications: [ - :runtime_tools, - worker: :permanent, - core: :permanent - ] -end - -release :cron do - set version: current_version(:cron) - set applications: [ - :runtime_tools, - cron: :permanent, - core: :permanent, - email: :permanent - ] -end