bitwalker / distillery

Simplify deployments in Elixir with OTP releases!
MIT License
2.96k stars 397 forks source link

Distillery 2.12 builds and deploy umbrella app even though it is not in the `application` list in the release #601

Closed froy001 closed 5 years ago

froy001 commented 5 years ago

Steps to reproduce

Just a brief list of the steps required to produce the issue.

Verbose Logs

Paste the output of the release command you ran with the --verbose flag below in the summary tags (this helps keep the issue easy to navigate):

``` ---> ebdf62025107 Step 12/26 : RUN mix release --name=iot_system --env=prod --verbose ---> Running in a699ba80dba6 ==> Loading configuration.. warning: found quoted keyword "setup_db" but the quotes are not required. Note that keywords are always atoms, even when quoted, and quotes should only be used to introduce keywords with foreign characters in them nofile:62 warning: found quoted keyword "seed" but the quotes are not required. Note that keywords are always atoms, even when quoted, and quotes should only be used to introduce keywords with foreign characters in them nofile:63 ==> Assembling release.. ==> Building release iot_system:0.61.4 using environment prod ==> Discovered applications: > plug_crypto-1.0.0 | | from: _build/prod/lib/plug_crypto | applications: | :kernel | :stdlib | :elixir | :crypto | includes: none |_____ > kernel-6.1.1 | | from: /usr/local/lib/erlang/lib/kernel-6.1.1 | applications: none | includes: none |_____ > mime-1.3.0 | | from: _build/prod/lib/mime | applications: | :kernel | :stdlib | :elixir | :logger | includes: none |_____ > plug-1.7.1 | | from: _build/prod/lib/plug | applications: | :kernel | :stdlib | :elixir | :logger | :mime | :plug_crypto | includes: none |_____ > plug_cowboy-1.0.0 | | from: _build/prod/lib/plug_cowboy | applications: | :kernel | :stdlib | :elixir | :logger | :cowboy | :plug | includes: none |_____ > canary-1.1.1 | | from: _build/prod/lib/canary | applications: | :kernel | :stdlib | :elixir | :logger | includes: none |_____ > cors_plug-1.5.2 | | from: _build/prod/lib/cors_plug | applications: | :kernel | :stdlib | :elixir | :logger | includes: none |_____ > guardian_db-1.1.0 | | from: _build/prod/lib/guardian_db | applications: | :kernel | :stdlib | :elixir | :logger | :ecto | :guardian | includes: none |_____ > phoenix_html-2.12.0 | | from: _build/prod/lib/phoenix_html | applications: | :kernel | :stdlib | :elixir | :logger | :plug | includes: none |_____ > inets-7.0.2 | | from: /usr/local/lib/erlang/lib/inets-7.0.2 | applications: | :kernel | :stdlib | includes: none |_____ > tesla-0.10.0 | | from: _build/prod/lib/tesla | applications: | :kernel | :stdlib | :elixir | :logger | :ssl | :inets | includes: none |_____ > google_api_storage-0.0.2 | | from: _build/prod/lib/google_api_storage | applications: | :kernel | :stdlib | :elixir | :logger | :poison | :tesla | includes: none |_____ > arc-0.10.0 | | from: _build/prod/lib/arc | applications: | :kernel | :stdlib | :elixir | :logger | :httpoison | includes: none |_____ > xmerl-1.3.18 | | from: /usr/local/lib/erlang/lib/xmerl-1.3.18 | applications: | :kernel | :stdlib | includes: none |_____ > sweet_xml-0.6.5 | | from: _build/prod/lib/sweet_xml | applications: | :kernel | :stdlib | :elixir | :xmerl | includes: none |_____ > arc_gcs-0.0.9 | | from: _build/prod/lib/arc_gcs | applications: | :kernel | :stdlib | :elixir | :sweet_xml | :goth | :arc | includes: none |_____ > json_web_token-0.2.10 | | from: _build/prod/lib/json_web_token | applications: | :kernel | :stdlib | :elixir | :crypto | :logger | :public_key | includes: none |_____ > goth-0.6.0 | | from: _build/prod/lib/goth | applications: | :kernel | :stdlib | :elixir | :json_web_token | :logger | :httpoison | includes: none |_____ > ota_manager-0.0.1 | | from: _build/prod/lib/ota_manager | applications: | :kernel | :stdlib | :elixir | :logger | :sentry | :poison | :httpoison | :goth | :arc_gcs | :cowboy | :google_api_storage | :plug | :dealor_data_layer | includes: none |_____ > device_cache-0.1.0 | | from: _build/prod/lib/device_cache | applications: | :kernel | :stdlib | :elixir | :logger | :sentry | :jason | :cowboy | :postgrex | :ecto | :plug | :plug_cowboy | :_utils | :mqtt_manager | includes: none |_____ > crontab-1.1.3 | | from: _build/prod/lib/crontab | applications: | :kernel | :stdlib | :elixir | :logger | includes: none |_____ > libring-1.4.0 | | from: _build/prod/lib/libring | applications: | :kernel | :stdlib | :elixir | :crypto | includes: none |_____ > swarm-3.3.1 | | from: _build/prod/lib/swarm | applications: | :kernel | :stdlib | :elixir | :logger | :crypto | :gen_state_machine | :libring | includes: none |_____ > gen_stage-0.14.0 | | from: _build/prod/lib/gen_stage | applications: | :kernel | :stdlib | :elixir | :logger | includes: none |_____ > quantum-2.3.2 | | from: _build/prod/lib/quantum | applications: | :kernel | :stdlib | :elixir | :logger | :gen_stage | :swarm | :crontab | includes: none |_____ > core-0.1.0 | | from: _build/prod/lib/core | applications: | :kernel | :stdlib | :elixir | :logger | :sentry | :httpoison | :quantum | :dealor_data_layer | :mqtt_manager | :device_cache | includes: none |_____ > eqc_ex-1.4.2 | | from: _build/prod/lib/eqc_ex | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > gen_state_machine-2.0.2 | | from: _build/prod/lib/gen_state_machine | applications: | :kernel | :stdlib | :elixir | :logger | includes: none |_____ > tortoise-0.6.0 | | from: _build/prod/lib/tortoise | applications: | :kernel | :stdlib | :elixir | :logger | :ssl | :gen_state_machine | :eqc_ex | includes: none |_____ > task_after-1.2.0 | | from: _build/prod/lib/task_after | applications: | :kernel | :stdlib | :elixir | :logger | includes: none |_____ > mqtt_manager-0.1.0 | | from: _build/prod/lib/mqtt_manager | applications: | :kernel | :stdlib | :elixir | :logger | :sentry | :jason | :task_after | :tortoise | :timex | :_utils | includes: none |_____ > _utils-0.1.0 | | from: _build/prod/lib/_utils | applications: | :kernel | :stdlib | :elixir | :logger | :sentry | :jason | :timex | includes: none |_____ > bamboo-1.1.0 | | from: _build/prod/lib/bamboo | applications: | :kernel | :stdlib | :elixir | :logger | :hackney | :poison | includes: none |_____ > bamboo_sendinblue-0.1.0 | | from: _build/prod/lib/bamboo_sendinblue | applications: | :kernel | :stdlib | :elixir | :logger | :bamboo | includes: none |_____ > mariaex-0.8.4 | | from: _build/prod/lib/mariaex | applications: | :kernel | :stdlib | :elixir | :logger | :crypto | :decimal | :db_connection | includes: none |_____ > combine-0.10.0 | | from: _build/prod/lib/combine | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > tzdata-0.5.17 | | from: _build/prod/lib/tzdata | applications: | :kernel | :stdlib | :elixir | :hackney | :logger | includes: none |_____ > timex-3.3.0 | | from: _build/prod/lib/timex | applications: | :kernel | :stdlib | :elixir | :logger | :tzdata | :gettext | :combine | includes: none |_____ > comeonin-4.1.1 | | from: _build/prod/lib/comeonin | applications: | :kernel | :stdlib | :elixir | :logger | includes: none |_____ > bcrypt_elixir-1.0.9 | | from: _build/prod/lib/bcrypt_elixir | applications: | :kernel | :stdlib | :elixir | :logger | :crypto | includes: none |_____ > argon2_elixir-1.3.1 | | from: _build/prod/lib/argon2_elixir | applications: | :kernel | :stdlib | :elixir | :logger | :crypto | includes: none |_____ > elixir_uuid-1.2.0 | | from: _build/prod/lib/elixir_uuid | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > faker-0.10.0 | | from: _build/prod/lib/faker | applications: | :kernel | :stdlib | :elixir | :crypto | includes: none |_____ > connection-1.0.4 | | from: _build/prod/lib/connection | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > db_connection-1.1.3 | | from: _build/prod/lib/db_connection | applications: | :kernel | :stdlib | :elixir | :logger | :connection | includes: none |_____ > postgrex-0.13.5 | | from: _build/prod/lib/postgrex | applications: | :kernel | :stdlib | :elixir | :logger | :db_connection | :decimal | :crypto | includes: none |_____ > dealor_data_layer-0.1.0 | | from: _build/prod/lib/dealor_data_layer | applications: | :kernel | :stdlib | :elixir | :logger | :ecto | :postgrex | :sentry | :faker | :elixir_uuid | :poison | :jason | :argon2_elixir | :bcrypt_elixir | :comeonin | :timex | :mariaex | :bamboo_sendinblue | :_utils | includes: none |_____ > eex-1.7.4 | | from: /usr/local/lib/elixir/bin/../lib/eex | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > phoenix-1.3.4 | | from: _build/prod/lib/phoenix | applications: | :kernel | :stdlib | :elixir | :plug | :poison | :logger | :eex | :phoenix_pubsub | :crypto | includes: none |_____ > poolboy-1.5.1 | | from: _build/prod/lib/poolboy | applications: | :kernel | :stdlib | includes: none |_____ > decimal-1.6.0 | | from: _build/prod/lib/decimal | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > ecto-2.2.11 | | from: _build/prod/lib/ecto | applications: | :kernel | :stdlib | :elixir | :logger | :decimal | :poolboy | :crypto | includes: none |_____ > fat_ecto-0.2.1 | | from: _build/prod/lib/fat_ecto | applications: | :kernel | :stdlib | :elixir | :logger | :ecto | includes: none |_____ > ex2ms-1.5.0 | | from: _build/prod/lib/ex2ms | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > ex_rated-1.3.2 | | from: _build/prod/lib/ex_rated | applications: | :kernel | :stdlib | :elixir | :logger | :ex2ms | includes: none |_____ > cowlib-1.0.2 | | from: _build/prod/lib/cowlib | applications: | :kernel | :stdlib | :crypto | includes: none |_____ > ranch-1.3.2 | | from: _build/prod/lib/ranch | applications: | :kernel | :stdlib | :ssl | includes: none |_____ > cowboy-1.1.2 | | from: _build/prod/lib/cowboy | applications: | :kernel | :stdlib | :ranch | :cowlib | :crypto | includes: none |_____ > phoenix_pubsub-1.1.0 | | from: _build/prod/lib/phoenix_pubsub | applications: | :kernel | :stdlib | :elixir | :logger | :crypto | includes: none |_____ > twilex-0.0.2 | | from: _build/prod/lib/twilex | applications: | :kernel | :stdlib | :elixir | :logger | :httpoison | includes: none |_____ > httpoison-1.4.0 | | from: _build/prod/lib/httpoison | applications: | :kernel | :stdlib | :elixir | :hackney | includes: none |_____ > jason-1.1.1 | | from: _build/prod/lib/jason | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > phx_crud-0.1.1 | | from: _build/prod/lib/phx_crud | applications: | :kernel | :stdlib | :elixir | :logger | includes: none |_____ > gettext-0.16.0 | | from: _build/prod/lib/gettext | applications: | :kernel | :stdlib | :elixir | :logger | includes: none |_____ > metrics-1.0.1 | | from: _build/prod/lib/metrics | applications: | :kernel | :stdlib | includes: none |_____ > ssl_verify_fun-1.1.4 | | from: _build/prod/lib/ssl_verify_fun | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > certifi-2.4.2 | | from: _build/prod/lib/certifi | applications: | :kernel | :stdlib | includes: none |_____ > mimerl-1.0.2 | | from: _build/prod/lib/mimerl | applications: | :kernel | :stdlib | includes: none |_____ > unicode_util_compat-0.4.1 | | from: _build/prod/lib/unicode_util_compat | applications: | :kernel | :stdlib | includes: none |_____ > idna-6.0.0 | | from: _build/prod/lib/idna | applications: | :kernel | :stdlib | :unicode_util_compat | includes: none |_____ > ssl-9.0.3 | | from: /usr/local/lib/erlang/lib/ssl-9.0.3 | applications: | :crypto | :public_key | :kernel | :stdlib | includes: none |_____ > hackney-1.14.3 | | from: _build/prod/lib/hackney | applications: | :kernel | :stdlib | :crypto | :asn1 | :public_key | :ssl | :idna | :mimerl | :certifi | :ssl_verify_fun | :metrics | includes: none |_____ > sentry-6.4.2 | | from: _build/prod/lib/sentry | applications: | :kernel | :stdlib | :elixir | :hackney | :poison | :logger | includes: none |_____ > poison-3.1.0 | | from: _build/prod/lib/poison | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > base64url-0.0.1 | | from: _build/prod/lib/base64url | applications: | :kernel | :stdlib | includes: none |_____ > public_key-1.6.3 | | from: /usr/local/lib/erlang/lib/public_key-1.6.3 | applications: | :asn1 | :crypto | :kernel | :stdlib | includes: none |_____ > asn1-5.0.7 | | from: /usr/local/lib/erlang/lib/asn1-5.0.7 | applications: | :kernel | :stdlib | includes: none |_____ > jose-1.8.4 | | from: _build/prod/lib/jose | applications: | :kernel | :stdlib | :elixir | :crypto | :asn1 | :public_key | :base64url | includes: none |_____ > crypto-4.3.3 | | from: /usr/local/lib/erlang/lib/crypto-4.3.3 | applications: | :kernel | :stdlib | includes: none |_____ > guardian-1.1.1 | | from: _build/prod/lib/guardian | applications: | :kernel | :stdlib | :elixir | :crypto | :logger | :jose | :poison | includes: none |_____ > logger-1.7.4 | | from: /usr/local/lib/elixir/bin/../lib/logger | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > dealor_api_gateway-0.0.1 | | from: _build/prod/lib/dealor_api_gateway | applications: | :kernel | :stdlib | :elixir | :logger | :runtime_tools | :guardian | :sentry | :gettext | :phx_crud | :poison | :jason | :httpoison | :twilex | :phoenix_pubsub | :cowboy | :ex_rated | :fat_ecto | :plug_cowboy | :phoenix | :dealor_data_layer | :mqtt_manager | :core | :ota_manager | :phoenix_html | :guardian_db | :cors_plug | :canary | includes: none |_____ > artificery-0.2.6 | | from: _build/prod/lib/artificery | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > distillery-2.0.12 | | from: _build/prod/lib/distillery | applications: | :kernel | :stdlib | :elixir | :runtime_tools | :artificery | includes: none |_____ > runtime_tools-1.13.1 | | from: /usr/local/lib/erlang/lib/runtime_tools-1.13.1 | applications: | :kernel | :stdlib | includes: none |_____ > stdlib-3.6 | | from: /usr/local/lib/erlang/lib/stdlib-3.6 | applications: | :kernel | includes: none |_____ > compiler-7.2.7 | | from: /usr/local/lib/erlang/lib/compiler-7.2.7 | applications: | :kernel | :stdlib | includes: none |_____ > canada-1.0.2 | | from: _build/prod/lib/canada | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > sasl-3.2.1 | | from: /usr/local/lib/erlang/lib/sasl-3.2.1 | applications: | :kernel | :stdlib | includes: none |_____ > iex-1.7.4 | | from: /usr/local/lib/elixir/bin/../lib/iex | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > mix-1.7.4 | | from: /usr/local/lib/elixir/bin/../lib/mix | applications: | :kernel | :stdlib | :elixir | includes: none |_____ > elixir-1.7.4 | | from: /usr/local/lib/elixir/bin/../lib/elixir | applications: | :kernel | :stdlib | :compiler | includes: none |_____ ==> Running validation checks.. > Mix.Releases.Checks.Erts * WARN > Mix.Releases.Checks.Cookie * PASS > Mix.Releases.Checks.LoadedOrphanedApps * PASS IMPORTANT: You have opted to *not* include the Erlang runtime system (ERTS). You must ensure that the version of Erlang this release is built with matches the version the release will be run with once deployed. It will fail to run otherwise. ==> Generated overlay vars: release_name=:iot_system release_version="0.61.4" is_upgrade=false upgrade_from=:latest dev_mode=false include_erts=false include_src=false include_system_libs=false erl_opts="" run_erl_env="" erts_vsn="10.1.3" output_dir="_build/prod/rel/iot_system" ==> Copying applications to _build/prod/rel/iot_system ==> Generating start_erl.data ==> Generating vm.args from rel/vm.args ==> Generating sys.config from config/config.exs ==> Generating boot scripts ==> Generating RELEASES ==> Applying overlays ==> Applying mkdir overlay dst: releases/0.61.4/hooks ==> Applying mkdir overlay dst: releases/0.61.4/hooks/pre_configure.d ==> Applying mkdir overlay dst: releases/0.61.4/hooks/post_configure.d ==> Applying mkdir overlay dst: releases/0.61.4/hooks/pre_start.d ==> Applying mkdir overlay dst: releases/0.61.4/hooks/post_start.d ==> Applying mkdir overlay dst: releases/0.61.4/hooks/pre_stop.d ==> Applying mkdir overlay dst: releases/0.61.4/hooks/post_stop.d ==> Applying mkdir overlay dst: releases/0.61.4/hooks/pre_upgrade.d ==> Applying mkdir overlay dst: releases/0.61.4/hooks/post_upgrade.d ==> Applying copy overlay src: rel/hooks/pre_start dst: releases/0.61.4/hooks/pre_start.d ==> Applying copy overlay src: _build/prod/lib/distillery/priv/libexec dst: releases/0.61.4/libexec ==> Applying mkdir overlay dst: releases/0.61.4/commands ==> Applying copy overlay src: apps/dealor_data_layer/rel/commands/setup_db.sh dst: releases/0.61.4/commands/setup_db.sh ==> Applying copy overlay src: apps/dealor_data_layer/rel/commands/seed.sh dst: releases/0.61.4/commands/seed.sh ==> Packaging release.. ==> Archiving iot_system-0.61.4 ==> Writing archive to /iot_system/_build/prod/rel/iot_system/releases/0.61.4/iot_system.tar.gz ==> Updating archive.. ==> Stripping system libs from release archive since ERTS is not included ==> Saving archive.. ==> Archive saved! Release successfully built! To start the release you have built, you can use one of the following tasks: # start a shell, like 'iex -S mix' > _build/prod/rel/iot_system/bin/iot_system console # start in the foreground, like 'mix run --no-halt' > _build/prod/rel/iot_system/bin/iot_system foreground # start in the background, must be stopped with the 'stop' command > _build/prod/rel/iot_system/bin/iot_system start If you started a release elsewhere, and wish to connect to it: # connects a local shell to the running node > _build/prod/rel/iot_system/bin/iot_system remote_console # connects directly to the running node's console > _build/prod/rel/iot_system/bin/iot_system attach For a complete listing of commands and their use: > _build/prod/rel/iot_system/bin/iot_system help Removing intermediate container a699ba80dba6 ---> e085ddf64a83 Step 13/26 : FROM elixir:1.7-alpine ---> 9aa3a5919f50 Step 14/26 : RUN apk upgrade --no-cache && apk add --no-cache bash openssl ---> Running in e457e65f6f10 fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz (1/2) Upgrading busybox (1.28.4-r1 -> 1.28.4-r2) Executing busybox-1.28.4-r2.post-upgrade (2/2) Upgrading ssl_client (1.28.4-r1 -> 1.28.4-r2) Executing busybox-1.28.4-r2.trigger OK: 15 MiB in 21 packages fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz (1/3) Installing bash (4.4.19-r1) Executing bash-4.4.19-r1.post-install (2/3) Installing libssl1.0 (1.0.2q-r0) (3/3) Installing openssl (1.0.2q-r0) Executing busybox-1.28.4-r2.trigger OK: 17 MiB in 24 packages Removing intermediate container e457e65f6f10 ---> bb412cacd291 Step 15/26 : WORKDIR /iot_system ---> Running in 23aba67d1baa Removing intermediate container 23aba67d1baa ---> 2d9fb11d2945 Step 16/26 : ARG build_ver ---> Running in f9e5f7f9e218 Removing intermediate container f9e5f7f9e218 ---> 15621b991864 Step 17/26 : ARG app_name=iot_system ---> Running in 4cfd250a8469 Removing intermediate container 4cfd250a8469 ---> 003eb1f4de42 Step 18/26 : ARG google_creds=ota-manager-google-creds.json ---> Running in 22282750ccfd Removing intermediate container 22282750ccfd ---> 80555400e197 Step 19/26 : ENV MIX_ENV=prod REPLACE_OS_VARS=true SHELL=/bin/bash GOOGLE_APPLICATION_CREDENTIALS=${google_creds} ---> Running in b1965c378362 Removing intermediate container b1965c378362 ---> 7ee404b92a03 Step 20/26 : RUN find . -type d ---> Running in a8a72b85eb74 . Removing intermediate container a8a72b85eb74 ---> 24d329ddcb1f Step 21/26 : COPY --from=builder /${app_name}/_build/prod/rel/${app_name}/releases/*/${app_name}.tar.gz . ---> f88c316f0fb8 Step 22/26 : COPY --from=builder /${app_name}/${google_creds} . ---> 5d4f1b5575ec Step 23/26 : RUN tar zxf ${app_name}.tar.gz && rm ${app_name}.tar.gz ---> Running in cbc895cccb47 Removing intermediate container cbc895cccb47 ---> 4ff4527f1be4 Step 24/26 : RUN chown -R root ./releases ---> Running in 75219d52af0a Removing intermediate container 75219d52af0a ---> 7b28af71f598 Step 25/26 : USER root ---> Running in 865eee93137e Removing intermediate container 865eee93137e ---> 513a8f1f8e1e Step 26/26 : CMD ["bash", "-c", "NODE_COOKIE=$NODE_COOKIE /iot_system/bin/iot_system foreground"] ---> Running in b964ec1d5bc1 Removing intermediate container b964ec1d5bc1 ---> 2b593697bd48 Successfully built 2b593697bd48 Successfully tagged registry.gitlab.com/dealor/dealor-iot-system/client_api/iot_system:31e7b870 ```

Description of issue

I am releasing an Umbrella app with the following structure: apps/ ├── core ├── dealor_api_gateway ├── dealor_data_layer ├── device_cache ├── mqtt_manager ├── ota_manager └── _utils As you can see in the rel/config.exs I have 2 releases. When releasing iot_system distillery includes and deploys device_cache which is not included in the application list. The same rel/config works as expected with distillery 1.5.

use Mix.Releases.Config,

This sets the default release built by mix release

default_release: :default,
# This sets the default environment used by `mix release`
default_environment: Mix.env()

For a full list of config options for both releases

and environments, visit https://hexdocs.pm/distillery/configuration.html

You may define one or more environments in this file,

an environment's settings will override those of a release

when building in that environment, this combination of release

and environment configuration is called a profile

environment :dev do

If you are running Phoenix, you should make sure that

server: true is set and the code reloader is disabled,

even in dev mode.

It is recommended that you build with MIX_ENV=prod and pass

the --env flag to Distillery explicitly if you want to use

dev mode.

set dev_mode: true set include_erts: false set cookie: :"foo" end

environment :prod do set include_erts: false set include_src: false set cookie: :"bar" end

You may define one or more releases in this file.

If you have not set a default release, or selected one

when running mix release, the first release in the file

will be used by default

release :iot_system do set version: "0.61.4" set applications: [ :runtime_tools, dealor_api_gateway: :permanent, dealor_data_layer: :permanent, mqtt_manager: :permanent, ota_manager: :permanent, core: :permanent, _utils: :permanent, canada: :load ] set vm_args: "rel/vm.args" set pre_start_hooks: "rel/hooks/pre_start" set commands: [ "setup_db": "apps/dealor_data_layer/rel/commands/setup_db.sh", "seed": "apps/dealor_data_layer/rel/commands/seed.sh" ] end

release :device_cache do set version: "0.1.0"

set applications: [ :runtime_tools, device_cache: :permanent, mqtt_manager: :permanent ]

set vm_args: "rel/vm.args" end

froy001 commented 5 years ago

I want to add the core app mix.exs since it might be relevant, as the core application is dependent on all the umbrella applications. One issue could be that distillery 2.0 is somehow ignoring the only: flag.:

defmodule Core.MixProject do
  use Mix.Project

  def project do
    [
      app: :core,
      version: "0.1.0",
      build_path: "../../_build",
      config_path: "../../config/config.exs",
      deps_path: "../../deps",
      lockfile: "../../mix.lock",
      elixir: "~> 1.6",
      start_permanent: Mix.env() == :prod,
      elixirc_paths: elixirc_paths(Mix.env()),
      deps: deps()
    ]
  end

  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(_env), do: ["lib"]

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
      extra_applications: [:logger, :sentry],
      mod: {Core.Application, []}
    ]
  end

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      {:quantum, "~> 2.3"},
      {:sentry, "~> 6.4"},
      {:dealor_data_layer, in_umbrella: true},
      {:mqtt_manager, in_umbrella: true},
      {:httpoison, "~> 1.4"},
      {:device_cache, in_umbrella: true, only: [:test, :dev]}
    ]
  end
end
ghost commented 5 years ago

https://github.com/syfgkjasdkn/distillery_601 seems to be able to reproduce it.

Two releases that shouldn't depend on each other

release :service1 do
  set(version: "0.1.0")

  set(
    applications: [
      :runtime_tools,
      core: :permanent
    ]
  )
end

release :service2 do
  set(version: "0.1.0")

  set(
    applications: [
      :runtime_tools,
      non_prod_dep: :permanent
    ]
  )
end

other than in [:dev, :test]:

  # in core's mix
  defp deps do
    [
      {:non_prod_dep, in_umbrella: true, only: [:test, :dev]}
    ]
  end

when running MIX_ENV=prod mix release --verbose --env=prod --name=service1 produce

  ...
  > non_prod_dep-0.1.0
  |
  |  from: _build/prod/lib/non_prod_dep
  |  applications:
  |      :kernel
  |      :stdlib
  |      :elixir
  |      :logger
  |  includes: none
  |_____
  ...
bitwalker commented 5 years ago

@josevalim I think this may be an issue with Mix; using the sample project from @syfgkjasdkn, if you pop open a shell, you'll see that in Application.spec(:core) the application list contains the :non_prod_dep application, even though it shouldn't be available in the prod environment. Thoughts?

josevalim commented 5 years ago

I believe it is caused by this issue: https://github.com/elixir-lang/elixir/issues/8225

You can try Elixir master or wait for Elixir v1.8-rc which should be out this week and you will be able to try it out to see if it solves your problem.

bitwalker commented 5 years ago

@josevalim Thanks!

@froy001 @syfgkjasdkn I'm going to close this issue since it appears that a resolution is pending release; there is not much I can do in the near term. As a possible workaround, you could use conditional compilation to define two different dependency lists, one without the umbrella deps you are trying to exclude, and a normal one; this should prevent that dependency from showing up in the applications list, though there may be some exceptions to the rule.

ghost commented 5 years ago

@bitwalker just tried https://github.com/syfgkjasdkn/distillery_601 again with elixir 1.8, and it seems the issue has indeed been resolved.

As for those on elixir < 1.8, the workaround https://github.com/syfgkjasdkn/distillery_601/commit/9c09f80c18e6202dea01d661b7212f5118b62508 worked as well, but it sometimes caused problems on CI such that running mix deps.get didn't get deps for test env (obviously, since those were excluded completely from the deps list) and I had to run MIX_ENV=test mix deps.get additionally.