edeliver / edeliver

Deployment for Elixir and Erlang
1.97k stars 185 forks source link

Failed to run migrations on production with multiple ecto repositories #283

Open shamanime opened 6 years ago

shamanime commented 6 years ago

Environment

Verbose output

$ ECTO_REPOSITORY="Elixir.MyApp.Repo" mix edeliver show migrations on production --verbose

EDELIVER MYAPP WITH MIGRATIONS COMMAND

-----> migrationsing production servers

production node:

user : ubuntu host : ... path : /home/ubuntu/path/to/deploy response: ** (CaseClauseError) no case clause matching: "error" (distillery) lib/mix/lib/releases/runtime/control.ex:605: Mix.Releases.Runtime.Control.rpc/2 (distillery) lib/entry.ex:44: Mix.Releases.Runtime.Control.main/1 (stdlib) erl_eval.erl:677: :erl_eval.do_apply/6 (elixir) lib/code.ex:232: Code.eval_string/3 ==> Found several ecto repository modules ([MyApp.Repo, MyApp.SecondRepo, MyApp.ThirdRepo]). Please specify the repository to use in the edeliver config as ECTO_REPOSITORY env.

Current behavior

It cannot find the right Ecto Repo module.

I've also tried adding ECTO_REPOSITORY to .deliver/config.

I've tried both "MyApp.Repo" and "Elixir.MyApp.Repo" (this one used to work before upgrading edeliver and distillery).

Displaying the migration status and trying to run migrations fails.

Expected behavior

It should accept the env variable ECTO_REPOSITORY and display the migration status or run the migrations.

lessless commented 6 years ago

Hi @shamanime,

Does this also happen with the latest Edeliver?

On Sat, Aug 25, 2018, 01:35 Jefferson Queiroz Venerando, < notifications@github.com> wrote:

Environment

  • Edeliver version (mix edeliver --version): edeliver v1.4.5 | https://github.com/boldpoker/edeliver Hex v1.6.0
  • Elixir version (elixir -v): Erlang/OTP 21 [erts-10.0.5] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] Elixir 1.7.2 (compiled with Erlang/OTP 19)
  • Build tool and version (distillery): distillery Hex v2.0.5
  • Operating system (on build / deploy hosts): ubuntu server 16.04
  • Are you using an umbrella project (yes|no): no

Verbose output

$ ECTO_REPOSITORY="Elixir.MyApp.Repo" mix edeliver show migrations on production --verbose

EDELIVER MYAPP WITH MIGRATIONS COMMAND

-----> migrationsing production servers

production node:

user : ubuntu host : ... path : /home/ubuntu/path/to/deploy response: ** (CaseClauseError) no case clause matching: "error" (distillery) lib/mix/lib/releases/runtime/control.ex:605: Mix.Releases.Runtime.Control.rpc/2 (distillery) lib/entry.ex:44: Mix.Releases.Runtime.Control.main/1 (stdlib) erl_eval.erl:677: :erl_eval.do_apply/6 (elixir) lib/code.ex:232: Code.eval_string/3 ==> Found several ecto repository modules ([MyApp.Repo, MyApp.SecondRepo, MyApp.ThirdRepo]). Please specify the repository to use in the edeliver config as ECTO_REPOSITORY env. Current behavior

It cannot find the right Ecto Repo module.

I've also tried adding ECTO_REPOSITORY to .deliver/config.

I've tried both "MyApp.Repo" and "Elixir.MyApp.Repo" (this one used to work before upgrading edeliver and distillery). Expected behavior

It should accept the env variable ECTO_REPOSITORY and display the migration status.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/edeliver/edeliver/issues/283, or mute the thread https://github.com/notifications/unsubscribe-auth/ABd9zBYkv9XmkU7SK0Q3vI6xy1JaXF6Jks5uUEd1gaJpZM4WLzhx .

shamanime commented 6 years ago

Hey @lessless!

I should be running the latest version of edeliver.

mix.lock says it's on version 1.6.0.

Seems like the output of --version is set here to return 1.4.5.

lessless commented 6 years ago

Thanks for reporting. I'll check it out. Can you please run edeliver with --debug output and post relwvant part here meanwhile?

On Sat, Aug 25, 2018, 07:43 Jefferson Queiroz Venerando, < notifications@github.com> wrote:

Hey @lessless https://github.com/lessless!

I should be running the latest version of edeliver.

mix.lock says it's on version 1.6.0.

Seems like the output of --version is set here https://github.com/edeliver/edeliver/blob/master/libexec/defaults to return 1.4.5.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/edeliver/edeliver/issues/283#issuecomment-415916243, or mute the thread https://github.com/notifications/unsubscribe-auth/ABd9zFV9Dax-Q5ucU-4qy1jl7zikOtn_ks5uUJ2cgaJpZM4WLzhx .

shamanime commented 6 years ago

Here it is, @lessless:

bash-3.2$ ECTO_REPOSITORY=Elixir.MyApp.Repo mix edeliver show migrations on production --debug
++ VERBOSE=true
++ SILENCE=
++ case "${COMMAND}" in
++ STRATEGY=erlang-node-execute
++ NODE_ACTION=migrations
+ [[ '' = \t\r\u\e ]]
+ __capture_runtime_configs
++ __remote_friendly '  '
++ echo '  '
++ tr , ' '
++ sed 's/^ //'
++ sed 's/ $//'
+ RUNTIME_SERVERS=
+ RUNTIME_HOSTS=
+ RUNTIME_GIT_PUSH=
+ RUNTIME_REFSPEC=
+ RUNTIME_REVISION=
+ RUNTIME_LOG_FILE=
+ RUNTIME_APP=
+ RUNTIME_STRATEGY=erlang-node-execute
+ __find_all_strategies
+ strategies_path=()
+ local strategies_path
+ '[' -d /Users/shamanime/Projects/myapp/deps/edeliver/strategies ']'
+ strategies_path+=("$BASE_PATH/strategies")
+ '[' -d /Users/shamanime/Projects/myapp/.deliver/strategies ']'
++ find /Users/shamanime/Projects/myapp/deps/edeliver/strategies -regex '^[a-zA-Z0-9@_/.-]*$' -type f '!' -iname 'readme*'
+ STRATEGIES='/Users/shamanime/Projects/myapp/deps/edeliver/strategies/generated
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-unpack-pack
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/s3
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-increase-versions
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-build-upgrade
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-build-appup
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/publish-edeliver
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-upgrade
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-build-release
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-update
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/gh-pages
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-edit-relup
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-show-releases
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-deploy-upgrade
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-node-execute
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-release-store-copy
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-deploy-release
/Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-show-relup'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack s3'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack s3 erlang-increase-versions'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack s3 erlang-increase-versions erlang-build-upgrade'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack s3 erlang-increase-versions erlang-build-upgrade erlang-build-appup'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack s3 erlang-increase-versions erlang-build-upgrade erlang-build-appup publish-edeliver'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack s3 erlang-increase-versions erlang-build-upgrade erlang-build-appup publish-edeliver erlang-upgrade'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack s3 erlang-increase-versions erlang-build-upgrade erlang-build-appup publish-edeliver erlang-upgrade erlang-build-release'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack s3 erlang-increase-versions erlang-build-upgrade erlang-build-appup publish-edeliver erlang-upgrade erlang-build-release erlang-update'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack s3 erlang-increase-versions erlang-build-upgrade erlang-build-appup publish-edeliver erlang-upgrade erlang-build-release erlang-update erlang'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack s3 erlang-increase-versions erlang-build-upgrade erlang-build-appup publish-edeliver erlang-upgrade erlang-build-release erlang-update erlang gh-pages'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack s3 erlang-increase-versions erlang-build-upgrade erlang-build-appup publish-edeliver erlang-upgrade erlang-build-release erlang-update erlang gh-pages erlang-edit-relup'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack s3 erlang-increase-versions erlang-build-upgrade erlang-build-appup publish-edeliver erlang-upgrade erlang-build-release erlang-update erlang gh-pages erlang-edit-relup erlang-show-releases'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack s3 erlang-increase-versions erlang-build-upgrade erlang-build-appup publish-edeliver erlang-upgrade erlang-build-release erlang-update erlang gh-pages erlang-edit-relup erlang-show-releases erlang-deploy-upgrade'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack s3 erlang-increase-versions erlang-build-upgrade erlang-build-appup publish-edeliver erlang-upgrade erlang-build-release erlang-update erlang gh-pages erlang-edit-relup erlang-show-releases erlang-deploy-upgrade erlang-node-execute'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack s3 erlang-increase-versions erlang-build-upgrade erlang-build-appup publish-edeliver erlang-upgrade erlang-build-release erlang-update erlang gh-pages erlang-edit-relup erlang-show-releases erlang-deploy-upgrade erlang-node-execute erlang-release-store-copy'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack s3 erlang-increase-versions erlang-build-upgrade erlang-build-appup publish-edeliver erlang-upgrade erlang-build-release erlang-update erlang gh-pages erlang-edit-relup erlang-show-releases erlang-deploy-upgrade erlang-node-execute erlang-release-store-copy erlang-deploy-release'
+ for strategy in '$STRATEGIES'
+ STRATEGIES_NAME=' generated erlang-unpack-pack s3 erlang-increase-versions erlang-build-upgrade erlang-build-appup publish-edeliver erlang-upgrade erlang-build-release erlang-update erlang gh-pages erlang-edit-relup erlang-show-releases erlang-deploy-upgrade erlang-node-execute erlang-release-store-copy erlang-deploy-release erlang-show-relup'
+ __load_app_config
+ '[' -f /Users/shamanime/Projects/myapp/.deliver/config ']'
+ source /Users/shamanime/Projects/myapp/.deliver/config
++ APP=myapp
++ BUILD_HOST=build01
++ BUILD_USER=ubuntu
++ BUILD_AT=/home/ubuntu/builds/myapp
++ STAGING_HOSTS=10.200.255.255
++ STAGING_USER=ubuntu
++ TEST_AT=/home/ubuntu/releases/myapp
++ PRODUCTION_HOSTS=10.0.255.255
++ PRODUCTION_USER=ubuntu
++ DELIVER_TO=/home/ubuntu/releases/myapp
++ AUTO_VERSION=commit-count-all-branches+git-revision
++ ECTO_REPOSITORY=Elixir.MyApp.Repo
+ [[ -n '' ]]
+ __default_app_config
+ source /Users/shamanime/Projects/myapp/deps/edeliver/libexec/app_config
++ '[' -z myapp ']'
++ '[' -z '' ']'
++ APP_USER=myapp
++ '[' -z /home/ubuntu/releases/myapp ']'
++ '[' -z '' ']'
++ GIT_PUSH=-f
++ '[' -z '' ']'
++ REFSPEC=master
++ '[' -z '' ']'
+++ git rev-parse master
++ REVISION=6d8989e80120483a6075b94b1583027e20693a70
++ '[' -z erlang-node-execute ']'
+++ __remote_friendly '  '
+++ echo '  '
+++ tr , ' '
+++ sed 's/^ //'
+++ sed 's/ $//'
++ SERVERS=
++ HOSTS=
++ '[' -z '' ']'
++ LOG_FILE=/tmp/deliver
++ '[' -z '' ']'
++ GENERATED_DIR=generated
++ '[' -z '' ']'
++ GENERATED_BRANCH=generated
++ '[' -z '' ']'
++ [[ -f ./mix.exs ]]
++ BUILD_CMD=mix
++ '[' -z '' ']'
++ [[ -f ./relx.config ]]
++ [[ -f ./mix.exs ]]
++ RELEASE_CMD=mix
++ '[' mix = mix ']'
++ [[ -f ./rel/config.exs ]]
++ USING_DISTILLERY=true
+ __apply_runtime_configs
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' -n erlang-node-execute ']'
+ STRATEGY=erlang-node-execute
+ __load_strategy
+ for strategy in '$STRATEGIES'
+ [[ ! /Users/shamanime/Projects/myapp/deps/edeliver/strategies/generated =~ erlang-node-execute ]]
+ continue
+ for strategy in '$STRATEGIES'
+ [[ ! /Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-unpack-pack =~ erlang-node-execute ]]
+ continue
+ for strategy in '$STRATEGIES'
+ [[ ! /Users/shamanime/Projects/myapp/deps/edeliver/strategies/s3 =~ erlang-node-execute ]]
+ continue
+ for strategy in '$STRATEGIES'
+ [[ ! /Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-increase-versions =~ erlang-node-execute ]]
+ continue
+ for strategy in '$STRATEGIES'
+ [[ ! /Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-build-upgrade =~ erlang-node-execute ]]
+ continue
+ for strategy in '$STRATEGIES'
+ [[ ! /Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-build-appup =~ erlang-node-execute ]]
+ continue
+ for strategy in '$STRATEGIES'
+ [[ ! /Users/shamanime/Projects/myapp/deps/edeliver/strategies/publish-edeliver =~ erlang-node-execute ]]
+ continue
+ for strategy in '$STRATEGIES'
+ [[ ! /Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-upgrade =~ erlang-node-execute ]]
+ continue
+ for strategy in '$STRATEGIES'
+ [[ ! /Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-build-release =~ erlang-node-execute ]]
+ continue
+ for strategy in '$STRATEGIES'
+ [[ ! /Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-update =~ erlang-node-execute ]]
+ continue
+ for strategy in '$STRATEGIES'
+ [[ ! /Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang =~ erlang-node-execute ]]
+ continue
+ for strategy in '$STRATEGIES'
+ [[ ! /Users/shamanime/Projects/myapp/deps/edeliver/strategies/gh-pages =~ erlang-node-execute ]]
+ continue
+ for strategy in '$STRATEGIES'
+ [[ ! /Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-edit-relup =~ erlang-node-execute ]]
+ continue
+ for strategy in '$STRATEGIES'
+ [[ ! /Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-show-releases =~ erlang-node-execute ]]
+ continue
+ for strategy in '$STRATEGIES'
+ [[ ! /Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-deploy-upgrade =~ erlang-node-execute ]]
+ continue
+ for strategy in '$STRATEGIES'
+ [[ ! /Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-node-execute =~ erlang-node-execute ]]
+ source /Users/shamanime/Projects/myapp/deps/edeliver/strategies/erlang-node-execute
++ REQUIRED_CONFIGS+=("APP")
++ REQUIRED_CONFIGS+=("NODE_ACTION")
++ REQUIRED_CONFIGS+=("NODE_ENVIRONMENT")
++ require_node_config
+++ echo production
+++ tr '[:lower:]' '[:upper:]'
++ local _node_environment_uppercase=PRODUCTION
++ local _node_config_variable_name=PRODUCTION_NODES
++ eval 'NODES=$PRODUCTION_NODES'
+++ NODES=
++ REQUIRED_CONFIGS+=("$_node_config_variable_name")
++ '[' -z '' ']'
++ '[' production = production ']'
++ local _user=ubuntu
++ local _path=/home/ubuntu/releases/myapp
++ [[ -n ubuntu ]]
++ [[ -n /home/ubuntu/releases/myapp ]]
++ local _hosts_environment_variable_name=PRODUCTION_HOSTS
+++ eval echo '$PRODUCTION_HOSTS'
++++ echo 10.0.255.255
++ for i in '$(eval echo \$$_hosts_environment_variable_name)'
++ eval 'PRODUCTION_NODES="$PRODUCTION_NODES' 'ubuntu@10.0.255.255:/home/ubuntu/releases/myapp"'
+++ PRODUCTION_NODES=' ubuntu@10.0.255.255:/home/ubuntu/releases/myapp'
++ eval 'NODES=$PRODUCTION_NODES'
+++ NODES=' ubuntu@10.0.255.255:/home/ubuntu/releases/myapp'
+ strategy_loaded=true
+ break
+ '[' -z true ']'
+ __remote_hosts
++ __remote_friendly
++ echo
++ tr , ' '
++ sed 's/^ //'
++ sed 's/ $//'
+ HOSTS=
++ __remote_friendly
++ echo
++ tr , ' '
++ sed 's/^ //'
++ sed 's/ $//'
+ HOSTS_APP_USER=
+ __check_config
+ __display_deprecations
+ [[ 0 != 0 ]]
+ set -f
+ _missing_required_configs=()
+ local _missing_required_configs
+ [[ -n '' ]]
+ for _required_config in '${REQUIRED_CONFIGS[@]}'
+++ eval echo '${ORIGIN_DIR[@]}'
++++ echo /Users/shamanime/Projects/myapp
++ echo /Users/shamanime/Projects/myapp
+ local _required_config_value=/Users/shamanime/Projects/myapp
+ '[' -z /Users/shamanime/Projects/myapp ']'
+ local '_config_text='
+ [[ -n '' ]]
+ for _required_config in '${REQUIRED_CONFIGS[@]}'
+++ eval echo '${STRATEGY[@]}'
++++ echo erlang-node-execute
++ echo erlang-node-execute
+ local _required_config_value=erlang-node-execute
+ '[' -z erlang-node-execute ']'
+ local '_config_text='
+ [[ -n '' ]]
+ for _required_config in '${REQUIRED_CONFIGS[@]}'
+++ eval echo '${APP[@]}'
++++ echo myapp
++ echo myapp
+ local _required_config_value=myapp
+ '[' -z myapp ']'
+ local '_config_text='
+ [[ -n '' ]]
+ for _required_config in '${REQUIRED_CONFIGS[@]}'
+++ eval echo '${NODE_ACTION[@]}'
++++ echo migrations
++ echo migrations
+ local _required_config_value=migrations
+ '[' -z migrations ']'
+ local '_config_text='
+ [[ -n '' ]]
+ for _required_config in '${REQUIRED_CONFIGS[@]}'
+++ eval echo '${NODE_ENVIRONMENT[@]}'
++++ echo production
++ echo production
+ local _required_config_value=production
+ '[' -z production ']'
+ local '_config_text='
+ [[ -n '' ]]
+ for _required_config in '${REQUIRED_CONFIGS[@]}'
+++ eval echo '${PRODUCTION_NODES[@]}'
++++ echo ubuntu@10.0.255.255:/home/ubuntu/releases/myapp
++ echo ubuntu@10.0.255.255:/home/ubuntu/releases/myapp
+ local _required_config_value=ubuntu@10.0.255.255:/home/ubuntu/releases/myapp
+ '[' -z ubuntu@10.0.255.255:/home/ubuntu/releases/myapp ']'
+ local '_config_text='
+ [[ -n '' ]]
+ [[ -n '' ]]
+ for _optional_config in '${OPTIONAL_CONFIGS[@]}'
+++ eval echo '${APP[@]}'
++++ echo myapp
++ echo myapp
+ local _optional_config_value=myapp
+ '[' -n '' ']'
+ for _optional_config in '${OPTIONAL_CONFIGS[@]}'
+++ eval echo '${APP_USER[@]}'
++++ echo myapp
++ echo myapp
+ local _optional_config_value=myapp
+ '[' -n '' ']'
+ for _optional_config in '${OPTIONAL_CONFIGS[@]}'
+++ eval echo '${DELIVER_TO[@]}'
++++ echo /home/ubuntu/releases/myapp
++ echo /home/ubuntu/releases/myapp
+ local _optional_config_value=/home/ubuntu/releases/myapp
+ '[' -n '' ']'
+ for _optional_config in '${OPTIONAL_CONFIGS[@]}'
+++ eval echo '${REFSPEC[@]}'
++++ echo master
++ echo master
+ local _optional_config_value=master
+ '[' -n '' ']'
+ for _optional_config in '${OPTIONAL_CONFIGS[@]}'
+++ eval echo '${GIT_PUSH[@]}'
++++ echo -f
++ echo -f
+ local _optional_config_value=-f
+ '[' -n '' ']'
+ for _optional_config in '${OPTIONAL_CONFIGS[@]}'
+++ eval echo '${REVISION[@]}'
++++ echo 6d8989e80120483a6075b94b1583027e20693a70
++ echo 6d8989e80120483a6075b94b1583027e20693a70
+ local _optional_config_value=6d8989e80120483a6075b94b1583027e20693a70
+ '[' -n '' ']'
+ for _optional_config in '${OPTIONAL_CONFIGS[@]}'
+++ eval echo '${FOREMAN_EXTRAS[@]}'
++++ echo
++ echo
+ local _optional_config_value=
+ '[' -n '' ']'
+ for _optional_config in '${OPTIONAL_CONFIGS[@]}'
+++ eval echo '${PORT[@]}'
++++ echo
++ echo
+ local _optional_config_value=
+ '[' -n '' ']'
+ for _optional_config in '${OPTIONAL_CONFIGS[@]}'
+++ eval echo '${AUTHORIZED_REMOTE_HOSTS[@]}'
++++ echo
++ echo
+ local _optional_config_value=
+ '[' -n '' ']'
+ set +f
+ '[' -n '' ']'
+ '[' -n '' ']'
+ begin
+ case "$COMMAND" in
+ [[ true = \t\r\u\e ]]
+ __monitor_parent_pid
+ local _edeliver_script_pid=2338
++ upcase 'edeliver myapp with migrations command'
++ ps -o ppid= -p 2338
++ echo 'edeliver myapp with migrations command'
++ tr '[:lower:]' '[:upper:]'
+ local '_parent_pid= 2335'
+ local _child_pid
+ [[  2335 =~ ^[0-9]+$ ]]
+ return 0
+ local '_message=EDELIVER MYAPP WITH MIGRATIONS COMMAND'
+ echo -e '\nEDELIVER MYAPP WITH MIGRATIONS COMMAND\n'

EDELIVER MYAPP WITH MIGRATIONS COMMAND

+ __log 'EDELIVER MYAPP WITH MIGRATIONS COMMAND'
++ date
+ local '_line=Fri Aug 24 21:51:38 -03 2018 ::: EDELIVER MYAPP WITH MIGRATIONS COMMAND'
+ echo -e 'Fri Aug 24 21:51:38 -03 2018 ::: EDELIVER MYAPP WITH MIGRATIONS COMMAND'
+ run
+ [[ migrations = version ]]
+ status 'migrationsing production servers'
+ local '_message=-----> migrationsing production servers'
+ echo '-----> migrationsing production servers'
-----> migrationsing production servers
+ __log '-----> migrationsing production servers'
++ date
+ local '_line=Fri Aug 24 21:51:38 -03 2018 ::: -----> migrationsing production servers'
+ echo -e 'Fri Aug 24 21:51:38 -03 2018 ::: -----> migrationsing production servers'
+ authorize_hosts
+ '[' -n '' ']'
+ local _rpc_command=rpc
+ [[ true = \t\r\u\e ]]
+ local '_rpc_open_brackets=['
+ local '_rpc_close_brackets=]'
+ [[ migrations = version ]]
+ [[ migrations = ping ]]
+ [[ migrations = migrations ]]
+ [[ mix = \m\i\x ]]
+ NODE_ACTION='rpc '\''Elixir.Edeliver.run_command([:list_pending_migrations, "myapp", "Elixir.MyApp.Repo"])'\'''
+ __exec_if_defined execute_custom_node_command 'rpc '\''Elixir.Edeliver.run_command([:list_pending_migrations, "myapp", "Elixir.MyApp.Repo"])'\'''
+ local _function=execute_custom_node_command
+ shift
+ declare -F execute_custom_node_command
+ execute_node_command 'rpc '\''Elixir.Edeliver.run_command([:list_pending_migrations, "myapp", "Elixir.MyApp.Repo"])'\'''
+ local '_node_command=rpc '\''Elixir.Edeliver.run_command([:list_pending_migrations, "myapp", "Elixir.MyApp.Repo"])'\'''
++ echo ubuntu@10.0.255.255:/home/ubuntu/releases/myapp
++ wc -w
+ [[        1 -eq 1 ]]
+ __execute_node_command_synchronously 'rpc '\''Elixir.Edeliver.run_command([:list_pending_migrations, "myapp", "Elixir.MyApp.Repo"])'\'''
+ local '_node_command=rpc '\''Elixir.Edeliver.run_command([:list_pending_migrations, "myapp", "Elixir.MyApp.Repo"])'\'''
+ local _node=ubuntu@10.0.255.255:/home/ubuntu/releases/myapp
+ local _status_code
+ local _response
+ __print_node_command_result single_node 0 ubuntu@10.0.255.255:/home/ubuntu/releases/myapp ''
+ local _node_index=single_node
+ local _status_code=0
+ local _node_name=ubuntu@10.0.255.255:/home/ubuntu/releases/myapp
+ local _node_action_response=
+ local _config
+ local _config_arg
+ local _message=
+ _message='production node: single_node\n\n'
+ [[ single_node = \s\i\n\g\l\e\_\n\o\d\e ]]
+ _message='production node:\n\n'
+ echo

+ local _user=ubuntu
+ local _host=10.0.255.255:/home/ubuntu/releases/myapp
+ local _path=/home/ubuntu/releases/myapp
+ [[ /home/ubuntu/releases/myapp =~ .*\|.* ]]
+ _config=
+ _path=/home/ubuntu/releases/myapp
+ _host=10.0.255.255
+ _message='production node:\n\n  user    : ubuntu\n'
+ _message='production node:\n\n  user    : ubuntu\n  host    : 10.0.255.255\n'
+ _message='production node:\n\n  user    : ubuntu\n  host    : 10.0.255.255\n  path    : /home/ubuntu/releases/myapp\n'
+ [[ -n '' ]]
+ [[ '' =~ :  ]]
+ [[ single_node = \s\i\n\g\l\e\_\n\o\d\e ]]
+ echo -en 'production node:\n\n  user    : ubuntu\n  host    : 10.0.255.255\n  path    : /home/ubuntu/releases/myapp\n'
production node:

  user    : ubuntu
  host    : 10.0.255.255
  path    : /home/ubuntu/releases/myapp
+ return 0
+ [[ debug = \v\e\r\b\o\s\e ]]
+ echo -n '  response: '
  response: ++ __execute_node_command single_node ubuntu@10.0.255.255:/home/ubuntu/releases/myapp 'rpc '\''Elixir.Edeliver.run_command([:list_pending_migrations, "myapp", "Elixir.MyApp.Repo"])'\'''
++ local _node_index=single_node
++ local _node_name=ubuntu@10.0.255.255:/home/ubuntu/releases/myapp
++ local '_node_command=rpc '\''Elixir.Edeliver.run_command([:list_pending_migrations, "myapp", "Elixir.MyApp.Repo"])'\'''
++ local _config
++ local _config_arg
++ local _user=ubuntu
++ local _host=10.0.255.255:/home/ubuntu/releases/myapp
++ local _path=/home/ubuntu/releases/myapp
++ local _status_code
++ [[ /home/ubuntu/releases/myapp =~ .*\|.* ]]
++ _config=
++ _path=/home/ubuntu/releases/myapp
++ _host=10.0.255.255
++ [[ -n '' ]]
++ _config_arg=
++ '[' single_node '!=' single_node ']'
++ [[ -n Elixir.MyApp.Repo ]]
++ local '_node_env=ECTO_REPOSITORY='\''Elixir.MyApp.Repo'\'' '
+++ __get_node_command 'rpc '\''Elixir.Edeliver.run_command([:list_pending_migrations, "myapp", "Elixir.MyApp.Repo"])'\''' /home/ubuntu/releases/myapp ''
+++ local '_node_command=rpc '\''Elixir.Edeliver.run_command([:list_pending_migrations, "myapp", "Elixir.MyApp.Repo"])'\'''
+++ local _app_path=/home/ubuntu/releases/myapp
+++ local _config_arg=
+++ local _rpc_command=rpc
+++ [[ true = \t\r\u\e ]]
+++ local '_rpc_open_brackets=['
+++ local '_rpc_close_brackets=]'
+++ [[ rpc 'Elixir.Edeliver.run_command([:list_pending_migrations, "myapp", "Elixir.MyApp.Repo"])' = start* ]]
+++ :
+++ [[ rpc 'Elixir.Edeliver.run_command([:list_pending_migrations, "myapp", "Elixir.MyApp.Repo"])' = restart* ]]
+++ :
+++ echo '
    [ -f "$HOME/.profile" ] && . "$HOME/.profile"
    set -e
    cd /home/ubuntu/releases/myapp/myapp
    output_lines="$(bin/myapp ping | wc -l | tr -d '\'' '\'')"
    if [ "$output_lines" -gt 1 ]; then
      output_filter_command='\''tail'\''
      output_filter_command_options="-n+$output_lines"
    else
      output_filter_command='\''cat'\''
      output_filter_command_options='\'''\''
    fi
    __edeliver_node_running() {
      bin/myapp ping 2>/dev/null >/dev/null
    }
    __edeliver_synchronous_start() {
      bin/myapp start | $output_filter_command $output_filter_command_options
      sleep 1
      for i in 1 2 3 4 5 6 7 8 9 10; do
        __edeliver_node_running && break || :
        sleep 1
      done
      bin/myapp rpc '\''Elixir.Edeliver.run_command([:monitor_startup_progress, "myapp", :debug])'\'' | $output_filter_command $output_filter_command_options | grep -e '\''Started\|^ok'\'' || :
    }
    if [ "mix" = "mix" ] && [ "" = "true" ]; then
      ping_result="$(bin/myapp ping | $output_filter_command $output_filter_command_options || :)"
      if __edeliver_node_running; then
        echo "already running" && exit 1
      else
        __edeliver_synchronous_start
      fi
    elif [ "" = "true" ]; then
      # use stop / start instead of restart command to
      # not just restart the applications but also the erlang vm
      # with the most recent release
      if __edeliver_node_running; then
        STOP_OUTPUT="$(ECTO_REPOSITORY='\''Elixir.MyApp.Repo'\'' bin/myapp stop  | $output_filter_command $output_filter_command_options)"
        if [ "$?" -ne 0 ]; then
          cat "$STOP_OUTPUT"
          exit 1
        fi
      fi
      if [ "mix" = "mix" ]; then
        __edeliver_synchronous_start
      else
        ECTO_REPOSITORY='\''Elixir.MyApp.Repo'\'' bin/myapp start  > >($output_filter_command $output_filter_command_options)
      fi
    else # no restart command
      ECTO_REPOSITORY='\''Elixir.MyApp.Repo'\'' bin/myapp rpc '\''Elixir.Edeliver.run_command([:list_pending_migrations, "myapp", "Elixir.MyApp.Repo"])'\''  > >($output_filter_command $output_filter_command_options)
    fi
  '
++ _remote_job='
    [ -f "$HOME/.profile" ] && . "$HOME/.profile"
    set -e
    cd /home/ubuntu/releases/myapp/myapp
    output_lines="$(bin/myapp ping | wc -l | tr -d '\'' '\'')"
    if [ "$output_lines" -gt 1 ]; then
      output_filter_command='\''tail'\''
      output_filter_command_options="-n+$output_lines"
    else
      output_filter_command='\''cat'\''
      output_filter_command_options='\'''\''
    fi
    __edeliver_node_running() {
      bin/myapp ping 2>/dev/null >/dev/null
    }
    __edeliver_synchronous_start() {
      bin/myapp start | $output_filter_command $output_filter_command_options
      sleep 1
      for i in 1 2 3 4 5 6 7 8 9 10; do
        __edeliver_node_running && break || :
        sleep 1
      done
      bin/myapp rpc '\''Elixir.Edeliver.run_command([:monitor_startup_progress, "myapp", :debug])'\'' | $output_filter_command $output_filter_command_options | grep -e '\''Started\|^ok'\'' || :
    }
    if [ "mix" = "mix" ] && [ "" = "true" ]; then
      ping_result="$(bin/myapp ping | $output_filter_command $output_filter_command_options || :)"
      if __edeliver_node_running; then
        echo "already running" && exit 1
      else
        __edeliver_synchronous_start
      fi
    elif [ "" = "true" ]; then
      # use stop / start instead of restart command to
      # not just restart the applications but also the erlang vm
      # with the most recent release
      if __edeliver_node_running; then
        STOP_OUTPUT="$(ECTO_REPOSITORY='\''Elixir.MyApp.Repo'\'' bin/myapp stop  | $output_filter_command $output_filter_command_options)"
        if [ "$?" -ne 0 ]; then
          cat "$STOP_OUTPUT"
          exit 1
        fi
      fi
      if [ "mix" = "mix" ]; then
        __edeliver_synchronous_start
      else
        ECTO_REPOSITORY='\''Elixir.MyApp.Repo'\'' bin/myapp start  > >($output_filter_command $output_filter_command_options)
      fi
    else # no restart command
      ECTO_REPOSITORY='\''Elixir.MyApp.Repo'\'' bin/myapp rpc '\''Elixir.Edeliver.run_command([:list_pending_migrations, "myapp", "Elixir.MyApp.Repo"])'\''  > >($output_filter_command $output_filter_command_options)
    fi
  '
++ '[' single_node = single_node ']'
++ local '_terminal_option=-t -q'
++ ssh -t -q -o ConnectTimeout=3 ubuntu@10.0.255.255 '
    [ -f "$HOME/.profile" ] && . "$HOME/.profile"
    set -e
    cd /home/ubuntu/releases/myapp/myapp
    output_lines="$(bin/myapp ping | wc -l | tr -d '\'' '\'')"
    if [ "$output_lines" -gt 1 ]; then
      output_filter_command='\''tail'\''
      output_filter_command_options="-n+$output_lines"
    else
      output_filter_command='\''cat'\''
      output_filter_command_options='\'''\''
    fi
    __edeliver_node_running() {
      bin/myapp ping 2>/dev/null >/dev/null
    }
    __edeliver_synchronous_start() {
      bin/myapp start | $output_filter_command $output_filter_command_options
      sleep 1
      for i in 1 2 3 4 5 6 7 8 9 10; do
        __edeliver_node_running && break || :
        sleep 1
      done
      bin/myapp rpc '\''Elixir.Edeliver.run_command([:monitor_startup_progress, "myapp", :debug])'\'' | $output_filter_command $output_filter_command_options | grep -e '\''Started\|^ok'\'' || :
    }
    if [ "mix" = "mix" ] && [ "" = "true" ]; then
      ping_result="$(bin/myapp ping | $output_filter_command $output_filter_command_options || :)"
      if __edeliver_node_running; then
        echo "already running" && exit 1
      else
        __edeliver_synchronous_start
      fi
    elif [ "" = "true" ]; then
      # use stop / start instead of restart command to
      # not just restart the applications but also the erlang vm
      # with the most recent release
      if __edeliver_node_running; then
        STOP_OUTPUT="$(ECTO_REPOSITORY='\''Elixir.MyApp.Repo'\'' bin/myapp stop  | $output_filter_command $output_filter_command_options)"
        if [ "$?" -ne 0 ]; then
          cat "$STOP_OUTPUT"
          exit 1
        fi
      fi
      if [ "mix" = "mix" ]; then
        __edeliver_synchronous_start
      else
        ECTO_REPOSITORY='\''Elixir.MyApp.Repo'\'' bin/myapp start  > >($output_filter_command $output_filter_command_options)
      fi
    else # no restart command
      ECTO_REPOSITORY='\''Elixir.MyApp.Repo'\'' bin/myapp rpc '\''Elixir.Edeliver.run_command([:list_pending_migrations, "myapp", "Elixir.MyApp.Repo"])'\''  > >($output_filter_command $output_filter_command_options)
    fi
  '
** (CaseClauseError) no case clause matching: "error"
    (distillery) lib/mix/lib/releases/runtime/control.ex:605: Mix.Releases.Runtime.Control.rpc/2
    (distillery) lib/entry.ex:44: Mix.Releases.Runtime.Control.main/1
    (stdlib) erl_eval.erl:677: :erl_eval.do_apply/6
    (elixir) lib/code.ex:232: Code.eval_string/3
++ _status_code=1
++ '[' single_node '!=' single_node ']'
++ [[ 1 = \0 ]]
++ return 1
+ _response='==> Found several ecto repository modules ([MyApp.Repo, MyApp.SecondRepo, MyApp.ThirdRepo]).
    Please specify the repository to use in the edeliver config as ECTO_REPOSITORY env.'
+ _status_code=1
+ __format_response '==> Found several ecto repository modules ([MyApp.Repo, MyApp.SecondRepo, MyApp.ThirdRepo]).
    Please specify the repository to use in the edeliver config as ECTO_REPOSITORY env.'
+ local '_response===> Found several ecto repository modules ([MyApp.Repo, MyApp.SecondRepo, MyApp.ThirdRepo]).
    Please specify the repository to use in the edeliver config as ECTO_REPOSITORY env.'
+ [[ migrations = \v\e\r\s\i\o\n ]]
+ echo '==> Found several ecto repository modules ([MyApp.Repo, MyApp.SecondRepo, MyApp.ThirdRepo]).
    Please specify the repository to use in the edeliver config as ECTO_REPOSITORY env.'
==> Found several ecto repository modules ([MyApp.Repo, MyApp.SecondRepo, MyApp.ThirdRepo]).
    Please specify the repository to use in the edeliver config as ECTO_REPOSITORY env.
+ return 1
+ [[ 1 != 0 ]]
+ exit 1
lessless commented 6 years ago

Hi @shamanime,

Thanks for the input. I'm just coming back from vacation and will try to tackle this ASAP but still it won't happen until the coming weekend. It doesn't look hard - as you can see correct module name is being passed into the Edeliver.run_command, definitely a continuation of Distillery 2.x compatibility story :)

Sorry for inconvenience.

shamanime commented 6 years ago

Alright! No pressure!

I'll see if I am able to take a look at it as well. If I can somehow tackle this issue I'll open a PR.

Thank you!

lessless commented 6 years ago

Cool! The CauseClauseError in the debug output is pointing to https://github.com/bitwalker/distillery/blob/master/lib/mix/lib/releases/runtime/control.ex#L605, means that it's a syntax problem with a high probability rate. It doesn't make it to the Edeliver code https://github.com/edeliver/edeliver/blob/master/lib/edeliver.ex#L60

Try to run

 ECTO_REPOSITORY="Elixir.MyApp.Repo" bin/myapp rpc 'Elixir.Edeliver.run_command([:list_pending_migrations, "myapp", "Elixir.MyApp.Repo"])'

if it works fine, then it can be just quoting issue

thotmx commented 4 years ago

@lessless Same problem here. Is there away another way to test this? Or something I could do for helping to fix this?

I tried to run the command you mentioned, but I got this:

Screenshot_20200217_005745

Trying with a different appname in the command: Screenshot_20200217_010013

The error changed.