From 80ddf5ecfcbbe1dc56ba42d4656717a5ea0c72f7 Mon Sep 17 00:00:00 2001 From: Zoey de Souza Pessanha Date: Thu, 27 Jul 2023 01:32:04 -0300 Subject: [PATCH] feat: melhora o CI - adiciona Earthfile - publica imagens docker no ghcr - multistage build and test --- .earthlyignore | 28 +++++++ .github/workflows/docker.yml | 34 +++++++++ .github/workflows/lint.yml | 109 ++++++--------------------- .github/workflows/test.yml | 141 +++++++---------------------------- Dockerfile | 112 ---------------------------- Earthfile | 105 ++++++++++++++++++++++++++ config/config.exs | 15 ++++ docker-compose.ci.yml | 13 ++++ docker-compose.yml | 9 +-- mix.exs | 19 +++-- mix.lock | 3 + rel/env.sh.eex | 20 +++++ rel/overlays/bin/server | 4 - rel/remote.vm.args.eex | 8 ++ rel/vm.args.eex | 8 ++ 15 files changed, 295 insertions(+), 333 deletions(-) create mode 100644 .earthlyignore create mode 100644 .github/workflows/docker.yml delete mode 100644 Dockerfile create mode 100644 Earthfile create mode 100644 docker-compose.ci.yml create mode 100644 rel/env.sh.eex delete mode 100755 rel/overlays/bin/server create mode 100644 rel/remote.vm.args.eex create mode 100644 rel/vm.args.eex diff --git a/.earthlyignore b/.earthlyignore new file mode 100644 index 00000000..8351e134 --- /dev/null +++ b/.earthlyignore @@ -0,0 +1,28 @@ +# Ignore git, but keep git HEAD and refs to access current commit hash if needed +.git +!.git/HEAD +!.git/refs +.github + +.elixir_ls +.vscode + +# Mix artifacts +/_build/ +/deps/ +*.ez + +# Generated on crash by the VM +erl_crash.dump + +# Static artifacts - These should be fetched and built inside the Docker image +/apps/plataforma_digital/assets/node_modules/ +/apps/plataforma_digital/priv/static/assets/ +/apps/plataforma_digital/priv/static/cache_manifest.json + +# Nix artifacts +/.postgres/ +/.direnv/ +/.nix-*/ +result + diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..bc5f4d88 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,34 @@ +name: docker + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + env: + GHCR_USERNAME: ${{ github.actor }} + GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }} + FORCE_COLOR: 1 + steps: + - uses: actions/checkout@v3 + - name: Put back the git branch into git (Earthly uses it for tagging) + run: | + branch="" + if [ -n "$GITHUB_HEAD_REF" ]; then + branch="$GITHUB_HEAD_REF" + else + branch="${GITHUB_REF##*/}" + fi + git checkout -b "$branch" || true + - name: Docker Login + run: docker login https://ghcr.io --username "$GHCR_USERNAME" --password "$GHCR_TOKEN" + - name: Download latest earthly + run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'" + - name: Earthly version + run: earthly --version + - name: Run test and build + run: earthly -P --build-arg GITHUB_REPO=${{ github.repository }} --push +docker diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3ae981d2..e7c87cf4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,94 +2,33 @@ name: lint on: push: - branches: ["main"] + branches: [ main ] pull_request: + branches: [ main ] jobs: - format: + build: runs-on: ubuntu-latest env: - MIX_ENV: test - strategy: - matrix: - elixir: [1.14.2] - otp: [25.1.2.1] + GHCR_USERNAME: ${{ github.actor }} + GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }} + FORCE_COLOR: 1 steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.6.0 - with: - access_token: ${{ github.token }} - - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: ${{ github.event.client_payload.sha }} - - - name: Setup - uses: erlef/setup-beam@v1 - with: - elixir-version: ${{ matrix.elixir }} - otp-version: ${{ matrix.otp }} - - - name: Retrieve Cached Dependencies - uses: actions/cache@v3 - id: mix-cache - env: - cache-name: mix-cache - with: - path: | - deps - _build - key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }} - restore-keys: | - ${{ runner.os }}-mix-${{ env.cache-name }} - - - run: mix deps.get - - - name: Run Formater - run: mix format --check-formatted - - static_code_analysis: - runs-on: ubuntu-latest - env: - MIX_ENV: test - strategy: - matrix: - elixir: [1.14.2] - otp: [25.1.2.1] - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.6.0 - with: - access_token: ${{ github.token }} - - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: ${{ github.event.client_payload.sha }} - - - name: Setup - uses: erlef/setup-beam@v1 - with: - elixir-version: ${{ matrix.elixir }} - otp-version: ${{ matrix.otp }} - - - name: Retrieve Cached Dependencies - uses: actions/cache@v3 - id: mix-cache - env: - cache-name: mix-cache - with: - path: | - deps - _build - key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }} - restore-keys: | - ${{ runner.os }}-mix-${{ env.cache-name }} - - - run: mix deps.get - - - name: Run Credo - run: mix credo --strict + - uses: actions/checkout@v3 + - name: Put back the git branch into git (Earthly uses it for tagging) + run: | + branch="" + if [ -n "$GITHUB_HEAD_REF" ]; then + branch="$GITHUB_HEAD_REF" + else + branch="${GITHUB_REF##*/}" + fi + git checkout -b "$branch" || true + - name: Docker Login + run: docker login https://ghcr.io --username "$GHCR_USERNAME" --password "$GHCR_TOKEN" + - name: Download latest earthly + run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'" + - name: Earthly version + run: earthly --version + - name: Run lint + run: earthly -P --build-arg GITHUB_REPO=${{ github.repository }} +ci diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5c387ecc..5a1bf597 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,124 +2,35 @@ name: test on: push: - branches: ["main"] + branches: [ main ] pull_request: + branches: [ main ] jobs: - unit_tests: + build: runs-on: ubuntu-latest env: - MIX_ENV: test - DATABASE_USER: pescarte - DATABASE_PASSWORD: pescarte - strategy: - matrix: - elixir: [1.14.2] - otp: [25.1.2.1] - services: - db: - env: - POSTGRES_USER: pescarte - POSTGRES_PASSWORD: pescarte - POSTGRES_DB: pescarte_test - image: postgres:13.5 - ports: ['5432:5432'] - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 + GHCR_USERNAME: ${{ github.actor }} + GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }} + FORCE_COLOR: 1 steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.6.0 - with: - access_token: ${{ github.token }} - - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: ${{ github.event.client_payload.sha }} - - - name: Setup - uses: erlef/setup-beam@v1 - with: - elixir-version: ${{ matrix.elixir }} - otp-version: ${{ matrix.otp }} - - - name: Retrieve Cached Dependencies - uses: actions/cache@v3 - id: mix-cache - env: - cache-name: mix-cache - with: - path: | - deps - _build - key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }} - restore-keys: | - ${{ runner.os }}-mix-${{ env.cache-name }} - - - run: mix deps.get - - - name: Run Unit Tests - run: mix test --only unit - - integration_tests: - runs-on: ubuntu-latest - env: - MIX_ENV: test - DATABASE_USER: pescarte - DATABASE_PASSWORD: pescarte - strategy: - matrix: - elixir: [1.14.2] - otp: [25.1.2.1] - services: - db: - env: - POSTGRES_USER: pescarte - POSTGRES_PASSWORD: pescarte - POSTGRES_DB: pescarte_test - image: postgres:13.5 - ports: ['5432:5432'] - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.6.0 - with: - access_token: ${{ github.token }} - - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: ${{ github.event.client_payload.sha }} - - - name: Setup - uses: erlef/setup-beam@v1 - with: - elixir-version: ${{ matrix.elixir }} - otp-version: ${{ matrix.otp }} - - - name: Retrieve Cached Dependencies - uses: actions/cache@v3 - id: mix-cache - env: - cache-name: mix-cache - with: - path: | - deps - _build - key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }} - restore-keys: | - ${{ runner.os }}-mix-${{ env.cache-name }} - - - run: mix deps.get - - - name: Run Integration Tests - run: mix test --only integration + - uses: actions/checkout@v3 + - name: Put back the git branch into git (Earthly uses it for tagging) + run: | + branch="" + if [ -n "$GITHUB_HEAD_REF" ]; then + branch="$GITHUB_HEAD_REF" + else + branch="${GITHUB_REF##*/}" + fi + git checkout -b "$branch" || true + - name: Docker Login + run: docker login https://ghcr.io --username "$GHCR_USERNAME" --password "$GHCR_TOKEN" + - name: Download latest earthly + run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'" + - name: Earthly version + run: earthly --version + - name: Run unit tests + run: earthly -P --build-arg GITHUB_REPO=${{ github.repository }} +unit-test + - name: Run integration tests + run: earthly -P --build-arg GITHUB_REPO=${{ github.repository }} +integration-test diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index d32387a2..00000000 --- a/Dockerfile +++ /dev/null @@ -1,112 +0,0 @@ -FROM hexpm/elixir:1.14.5-erlang-25.3.2.4-debian-buster-20230612-slim as builder - -SHELL ["/bin/bash", "-o", "pipefail", "-c"] - -RUN apt-get update -y \ - && apt-get install -y --no-install-recommends build-essential curl \ - && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ - && apt-get install -y --no-install-recommends nodejs \ - && rm -rf /var/lib/apt/lists/* - -WORKDIR /pescarte - -RUN mix local.hex --force && \ - mix local.rebar --force - -ARG MIX_ENV=prod - -COPY mix.exs mix.lock ./ - -# copy all mix.exs from umbrella apps -# to corresponding folder -COPY apps/catalogo/mix.exs ./apps/catalogo/ -COPY apps/cotacoes/mix.exs ./apps/cotacoes/ -COPY apps/cotacoes_etl/mix.exs ./apps/cotacoes_etl/ -COPY apps/database/mix.exs ./apps/database/ -COPY apps/identidades/mix.exs ./apps/identidades/ -COPY apps/modulo_pesquisa/mix.exs ./apps/modulo_pesquisa/ -COPY apps/plataforma_digital/mix.exs ./apps/plataforma_digital/ -COPY apps/plataforma_digital_api/mix.exs ./apps/plataforma_digital_api/ -COPY apps/proxy_web/mix.exs ./apps/proxy_web/ -COPY apps/seeder/mix.exs ./apps/seeder/ - - -RUN mix deps.get --only $MIX_ENV -RUN mix deps.compile - -# to be re-compiled. -COPY config/config.exs config/${MIX_ENV}.exs config/ - -# compile static and dynamic assets -COPY apps/plataforma_digital/priv ./apps/plataforma_digital/priv -COPY apps/plataforma_digital/assets ./apps/plataforma_digital/assets -RUN ["npm", "ci", "--prefix", "./apps/plataforma_digital/assets/"] - -# copy source code and static files -COPY apps/catalogo/lib ./apps/catalogo/lib -COPY apps/cotacoes/lib ./apps/cotacoes/lib -COPY apps/cotacoes_etl/lib ./apps/cotacoes_etl/lib -COPY apps/database/lib ./apps/database/lib -COPY apps/seeder/lib ./apps/seeder/lib -COPY apps/proxy_web/lib ./apps/proxy_web/lib -COPY apps/identidades/lib ./apps/identidades/lib -COPY apps/modulo_pesquisa/lib ./apps/modulo_pesquisa/lib -COPY apps/plataforma_digital/lib ./apps/plataforma_digital/lib -COPY apps/plataforma_digital_api/lib ./apps/plataforma_digital_api/lib - -COPY apps/cotacoes/priv ./apps/cotacoes/priv -COPY apps/identidades/priv ./apps/identidades/priv -COPY apps/modulo_pesquisa/priv ./apps/modulo_pesquisa/priv - -# Compile the release -RUN mix compile - -# Changes to config/runtime.exs don't require recompiling the code -COPY config/runtime.exs config/ - -FROM builder as dev - -ARG MIX_ENV="dev" - -WORKDIR /pescarte - -RUN apt-get update -y && apt-get install -y --no-install-recommends inotify-tools glibc-source - -COPY config/test.exs ./config/ -COPY /apps/cotacoes/test ./apps/cotacoes/test -COPY /apps/identidades/test ./apps/identidades/test -COPY /apps/modulo_pesquisa/test ./apps/modulo_pesquisa/test -COPY /apps/plataforma_digital/test ./apps/plataforma_digital/test -COPY /apps/plataforma_digital_api/test ./apps/plataforma_digital_api/test - -RUN mix deps.get -RUN mix do deps.compile, compile - -CMD ["mix", "phx.server"] - -FROM builder as production - -WORKDIR /pescarte -RUN chown nobody /pescarte - -RUN apt-get update -y -RUN apt-get install -y iputils-ping libstdc++6 glibc-source \ - openssl libncurses5 locales postgresql-client \ - && rm -rf /var/lib/apt/lists/* \ - && sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen \ - && locale-gen - -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 - -# set runner ENV -ENV MIX_ENV="prod" - -COPY rel rel -RUN mix assets.deploy -RUN mix release - -USER nobody - -CMD ["/pescarte/_build/prod/rel/pescarte/bin/server"] diff --git a/Earthfile b/Earthfile new file mode 100644 index 00000000..778c0976 --- /dev/null +++ b/Earthfile @@ -0,0 +1,105 @@ +VERSION 0.7 + +deps: + ARG ELIXIR=1.15.4 + ARG OTP=26.0.2 + FROM hexpm/elixir:${ELIXIR}-erlang-${OTP}-debian-buster-20230612-slim + RUN apt update -y && apt install -y build-essential + WORKDIR /src + COPY mix.exs mix.lock ./ + COPY --dir apps . # check .earthlyignore + RUN mix local.rebar --force + RUN mix local.hex --force + RUN mix deps.get + SAVE ARTIFACT /src/deps AS LOCAL deps + +ci: + FROM +deps + COPY .credo.exs . + COPY .formatter.exs . + RUN mix clean + RUN mix compile --warning-as-errors + RUN mix format --check-formatted + RUN mix credo --strict + +test: + BUILD +unit-test + BUILD +integration-test + +unit-test: + FROM +deps + RUN apt install -y postgresql-client + RUN MIX_ENV=test mix deps.compile + COPY docker-compose.ci.yml ./docker-compose.yml + COPY mix.exs mix.lock ./ + COPY .env-sample ./ + COPY --dir config ./ + COPY --dir apps ./ + + WITH DOCKER --compose docker-compose.yml + RUN while ! pg_isready --host=localhost --port=5432 --quiet; do sleep 1; done; \ + DATABASE_USER="peapescarte" DATABASE_PASSWORD="peapescarte" mix test --only unit + END + +integration-test: + FROM +deps + RUN apt install -y postgresql-client + RUN MIX_ENV=test mix deps.compile + COPY docker-compose.ci.yml ./docker-compose.yml + COPY mix.exs mix.lock ./ + COPY .env-sample ./ + COPY --dir config ./ + COPY --dir apps ./ + + WITH DOCKER --compose docker-compose.yml + RUN while ! pg_isready --host=localhost --port=5432 --quiet; do sleep 1; done; \ + DATABASE_USER="peapescarte" DATABASE_PASSWORD="peapescarte" mix test --only integration + END + +frontend-deps: + FROM node:18.3.0-alpine3.14 + WORKDIR /frontend + COPY --dir +deps/deps . + COPY apps/plataforma_digital/assets ./apps/plataforma_digital/assets/ + RUN npm ci --prefix ./apps/plataforma_digital/assets + SAVE ARTIFACT /frontend/apps/plataforma_digital/assets AS LOCAL assets + +frontend-build: + FROM +unit-test + COPY --dir +frontend-deps/assets ./apps/plataforma_digital/ + RUN mix assets.deploy + SAVE ARTIFACT ./apps/plataforma_digital/priv AS LOCAL priv + +release: + FROM +unit-test + COPY --dir +frontend-build/priv ./apps/plataforma_digital/ + COPY rel rel + RUN MIX_ENV=prod mix do compile, release + SAVE ARTIFACT /src/_build/prod/rel/pescarte /app/_build/prod/rel/pescarte AS LOCAL release + +docker-prod: + FROM debian:buster-20230612-slim + RUN apt update -y && apt install -y openssl libncurses5 + WORKDIR /app + RUN chown nobody /app + USER nobody + COPY +release/app/_build/prod/rel/pescarte . + CMD ["./bin/pescarte", "eval", "Database.Release.migrate", "&&", "./bin/pescarte", "daemon"] + ARG GITHUB_REPO + SAVE IMAGE --push ghcr.io/$GITHUB_REPO:prod + +docker-dev: + FROM +deps + RUN apt update -y && apt install -y inotify-tools + ENV MIX_ENV=dev + RUN mix deps.compile + COPY --dir config ./ + COPY --dir apps ./ + RUN mix compile + CMD ["mix", "dev"] + ARG GITHUB_REPO + SAVE IMAGE --push ghcr.io/$GITHUB_REPO:dev + +docker: + BUILD +docker-dev + BUILD +docker-prod diff --git a/config/config.exs b/config/config.exs index eee9c656..753dd534 100644 --- a/config/config.exs +++ b/config/config.exs @@ -81,4 +81,19 @@ config :phoenix, :json_library, Jason config :seeder, env: config_env() +config :git_hooks, + verbose: true, + hooks: [ + pre_push: [ + tasks: [ + "mix clean", + "mix compile --warning-as-errors", + "mix format --check-formatted", + "mix credo --strict", + "mix test --only unit", + "mix test --only integration" + ] + ] + ] + import_config "#{config_env()}.exs" diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml new file mode 100644 index 00000000..1f43c860 --- /dev/null +++ b/docker-compose.ci.yml @@ -0,0 +1,13 @@ +version: "3.8" + +services: + database: + image: postgres:14.6 + container_name: plataforma_pescarte_database + environment: + - POSTGRES_USER=peapescarte + - POSTGRES_PASSWORD=peapescarte + ports: + - 5432:5432 + volumes: + - .postgres:/var/lib/postgresql/data diff --git a/docker-compose.yml b/docker-compose.yml index eb7f38c2..70993fe0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,12 +2,7 @@ version: "3.8" services: pescarte: - build: - context: . - target: dev - args: - - MIX_ENV=dev - image: pescarte + image: ghcr.io/peapescarte/plataforma-pescarte:dev command: ["iex", "-S", "mix", "dev"] container_name: plataforma_pescarte ports: @@ -17,7 +12,7 @@ services: env_file: - .env-sample volumes: - - .:/app + - .:/src environment: MIX_ENV: dev stdin_open: true diff --git a/mix.exs b/mix.exs index b28ad136..04a02b9c 100644 --- a/mix.exs +++ b/mix.exs @@ -10,15 +10,13 @@ defmodule Pescarte.MixProject do aliases: aliases(), releases: [ pescarte: [ - applications: [ - database: :permanent, - cotacoes: :permanent, - proxy_web: :permanent, - identidades: :permanent, - modulo_pesquisa: :permanent, - plataforma_digital: :permanent, - plataforma_digital_api: :permanent - ] + strip_beams: true, + cookie: Base.url_encode64(:crypto.strong_rand_bytes(40)), + validate_compile_env: true, + quiet: true, + include_erts: true, + include_executables_for: [:unix], + applications: [proxy_web: :permanent] ] ] ] @@ -27,7 +25,8 @@ defmodule Pescarte.MixProject do defp deps do [ {:dialyxir, "~> 1.3", only: [:dev], runtime: false}, - {:credo, "~> 1.5", only: [:dev, :test], runtime: false} + {:credo, "~> 1.5", only: [:dev, :test], runtime: false}, + {:git_hooks, "~> 0.4.0", only: [:test, :dev], runtime: false} ] end diff --git a/mix.lock b/mix.lock index 0162fb62..b8a604e3 100644 --- a/mix.lock +++ b/mix.lock @@ -4,6 +4,7 @@ "absinthe_plug": {:hex, :absinthe_plug, "1.5.8", "38d230641ba9dca8f72f1fed2dfc8abd53b3907d1996363da32434ab6ee5d6ab", [:mix], [{:absinthe, "~> 1.5", [hex: :absinthe, repo: "hexpm", optional: false]}, {:plug, "~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "bbb04176647b735828861e7b2705465e53e2cf54ccf5a73ddd1ebd855f996e5a"}, "bandit": {:hex, :bandit, "0.7.7", "48456d09022607a312cf723a91992236aeaffe4af50615e6e2d2e383fb6bef10", [:mix], [{:hpax, "~> 0.1.1", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:thousand_island, "~> 0.6.7", [hex: :thousand_island, repo: "hexpm", optional: false]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "772f0a32632c2ce41026d85e24b13a469151bb8cea1891e597fb38fde103640a"}, "bcrypt_elixir": {:hex, :bcrypt_elixir, "2.3.1", "5114d780459a04f2b4aeef52307de23de961b69e13a5cd98a911e39fda13f420", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "42182d5f46764def15bf9af83739e3bf4ad22661b1c34fc3e88558efced07279"}, + "blankable": {:hex, :blankable, "1.0.0", "89ab564a63c55af117e115144e3b3b57eb53ad43ba0f15553357eb283e0ed425", [:mix], [], "hexpm", "7cf11aac0e44f4eedbee0c15c1d37d94c090cb72a8d9fddf9f7aec30f9278899"}, "brcpfcnpj": {:hex, :brcpfcnpj, "1.0.0", "23319e5f7e4da533f36dc5b7793e7c505fd80e43b0fa720c7a459daffbaa5034", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm", "8e6f38910896ea4f39b75c37855a702cebd495c2a74d88cdfd5c3c715c871510"}, "bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"}, "castore": {:hex, :castore, "1.0.3", "7130ba6d24c8424014194676d608cb989f62ef8039efd50ff4b3f33286d06db8", [:mix], [], "hexpm", "680ab01ef5d15b161ed6a95449fac5c6b8f60055677a8e79acf01b27baa4390b"}, @@ -36,6 +37,7 @@ "floki": {:hex, :floki, "0.34.3", "5e2dcaec5d7c228ce5b1d3501502e308b2d79eb655e4191751a1fe491c37feac", [:mix], [], "hexpm", "9577440eea5b97924b4bf3c7ea55f7b8b6dce589f9b28b096cc294a8dc342341"}, "gen_stage": {:hex, :gen_stage, "1.2.1", "19d8b5e9a5996d813b8245338a28246307fd8b9c99d1237de199d21efc4c76a1", [:mix], [], "hexpm", "83e8be657fa05b992ffa6ac1e3af6d57aa50aace8f691fcf696ff02f8335b001"}, "gettext": {:hex, :gettext, "0.22.3", "c8273e78db4a0bb6fba7e9f0fd881112f349a3117f7f7c598fa18c66c888e524", [:mix], [{:expo, "~> 0.4.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "935f23447713954a6866f1bb28c3a878c4c011e802bcd68a726f5e558e4b64bd"}, + "git_hooks": {:hex, :git_hooks, "0.4.2", "93604c8f6dff28500aaecc1988de319308fb7aa2c27bc89460b1f48aedd8bf7a", [:mix], [{:blankable, "~> 1.0.0", [hex: :blankable, repo: "hexpm", optional: false]}, {:recase, "~> 0.6.0", [hex: :recase, repo: "hexpm", optional: false]}], "hexpm", "0e46c04847b86d88857149840a614e018d57f79ca3f3b921a93e007cbea546d4"}, "gollum": {:hex, :new_gollum, "0.4.0", "89e3e2fc5abd032455341c4a03bcef7042b8d08e02c51df24b99a1a0a1ad69b1", [:mix], [{:httpoison, "~> 1.7", [hex: :httpoison, repo: "hexpm", optional: false]}], "hexpm", "85c68465e8678637638656945677062a4e7086e91a04d5c4bca1027321c74582"}, "hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~> 2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"}, "hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"}, @@ -74,6 +76,7 @@ "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm", "fec8660eb7733ee4117b85f55799fd3833eb769a6df71ccf8903e8dc5447cfce"}, "postgrex": {:hex, :postgrex, "0.17.1", "01c29fd1205940ee55f7addb8f1dc25618ca63a8817e56fac4f6846fc2cddcbe", [:mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "14b057b488e73be2beee508fb1955d8db90d6485c6466428fe9ccf1d6692a555"}, "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}, + "recase": {:hex, :recase, "0.6.0", "1dd2dd2f4e06603b74977630e739f08b7fedbb9420cc14de353666c2fc8b99f4", [:mix], [], "hexpm", "8712e318420a228eb2e6366ada230148ed3a4316a798319edd5512f64d78c990"}, "req": {:hex, :req, "0.3.10", "71b6457cba0929deedb4ceb5747d46f6c0b4d6be1f94a91b2c6a90f3e4a892bd", [:mix], [{:brotli, "~> 0.3.1", [hex: :brotli, repo: "hexpm", optional: true]}, {:ezstd, "~> 1.0", [hex: :ezstd, repo: "hexpm", optional: true]}, {:finch, "~> 0.9", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:nimble_csv, "~> 1.0", [hex: :nimble_csv, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "43489aa0d5b899215088cd6fea4125569009304c24b15215e3d02883aa0e79d8"}, "rustler_precompiled": {:hex, :rustler_precompiled, "0.6.1", "160b545bce8bf9a3f1b436b2c10f53574036a0db628e40f393328cbbe593602f", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:rustler, "~> 0.23", [hex: :rustler, repo: "hexpm", optional: true]}], "hexpm", "0dd269fa261c4e3df290b12031c575fff07a542749f7b0e8b744d72d66c43600"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"}, diff --git a/rel/env.sh.eex b/rel/env.sh.eex new file mode 100644 index 00000000..4f278d24 --- /dev/null +++ b/rel/env.sh.eex @@ -0,0 +1,20 @@ +#!/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 load code on demand (interactive) instead of preloading (embedded). +# export RELEASE_MODE=interactive + +# # Set the release to work across nodes. +# # RELEASE_DISTRIBUTION must be "sname" (local), "name" (distributed) or "none". +# export RELEASE_DISTRIBUTION=name +# export RELEASE_NODE=<%= @release.name %> diff --git a/rel/overlays/bin/server b/rel/overlays/bin/server deleted file mode 100755 index 0ed864a6..00000000 --- a/rel/overlays/bin/server +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -cd -P -- "$(dirname -- "$0")" -./pescarte eval Database.Release.migrate -PHX_SERVER=true exec ./pescarte start diff --git a/rel/remote.vm.args.eex b/rel/remote.vm.args.eex new file mode 100644 index 00000000..983397a7 --- /dev/null +++ b/rel/remote.vm.args.eex @@ -0,0 +1,8 @@ +## Customize flags given to the VM: https://www.erlang.org/doc/man/erl.html +## -mode/-name/-sname/-setcookie are configured via env vars, do not set them here + +## 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.eex b/rel/vm.args.eex new file mode 100644 index 00000000..acfdc9ba --- /dev/null +++ b/rel/vm.args.eex @@ -0,0 +1,8 @@ +## Customize flags given to the VM: https://www.erlang.org/doc/man/erl.html +## -mode/-name/-sname/-setcookie are configured via env vars, do not set them here + +## Increase number of concurrent ports/sockets +##+Q 65536 + +## Tweak GC to run more often +-env ERL_FULLSWEEP_AFTER 10