Edeliver won't stop app in production

Hi! I use edeliver to deploy my umbrella app to production, and finally it works when I deploy releases and start them, but mix edeliver stop production command doesn’t work, so I need to stop my app manually by killing the process which is ugly of course.
Command ./bin/myapp stop on remote server doesn’t work too.
Had anybody had such an issue? Or what may be going on here?

My .deliver/config looks like:

APP="myapp"
BUILD_HOST="localhost"
BUILD_USER="builder"
BUILD_AT="/tmp/edeliver/myapp-ex/builds"

PRODUCTION_HOSTS="myip"
PRODUCTION_USER="myapp"

DELIVER_TO="/home/myapp/apps/myapp-ex"
RELEASE_DIR="$BUILD_AT/_build/$TARGET_MIX_ENV/rel/$APP"

GIT_CLEAN_PATHS=${GIT_CLEAN_PATHS:="rel"}

pre_erlang_get_and_update_deps() {
   status "Linking to prod.secret.exs replacement config"
   local _secret_path="/home/builder/config/prod.secret.exs"
   
   if [ "$TARGET_MIX_ENV" = "prod" ]; then
      status "Linking to prod.secret.exs replacement config: TARGET_MIX_ENV=prod"
      set output_dir: "rel/myapp_ex"
      __sync_remote "
         ln -sfn '$_secret_path' '$BUILD_AT/apps/myapp/config/prod.secret.exs'
      "
   fi
}

and disltillery config

Path.join(["rel", "plugins", "*.exs"])
|> Path.wildcard()
|> Enum.map(&Code.eval_file(&1))

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()

environment :dev do
  set dev_mode: true
  set include_erts: false
  set cookie: :"KMtZQ:n?.1$e^zIvWNrp2o8cLrOaXA:fOcazo|P>@3TZ5tID0b)Outxl]5PtG%e?"
end

environment :prod do
  set include_erts: true
  set include_src: false
  set cookie: :"klkjdfsldfsdflkjk"
end

release :myapp do
  set version: current_version(:myapp)
  set applications: [
    :myapp
  ]
end

What happens when you run ./bin/myapp stop on the server? Any output? Does it execute but never return? Definitely would expect some kind of error - only thing thing I can think of is that the server itself locks up when :init.stop/0 is called, and never actually shuts down completely.

could it be that you have systemd setup and it restarts the app?

Yes, there is a message:

/home/myapp/apps/myapp-ex/myapp/bin/nodetool: /lib/x86_64-linux-gnu/libtinfo.so.5: no version information available (required by /home/myapp/apps/myapp-ex/myapp/bin/nodetool)

But I haven’t managed to find, if it can be resolved somehow

I didn’t specifically setup it myself

1 Like

The problem appears to be that your release has include_erts: true and is being built on a server which does not match your production server (i.e. they are different versions of the OS, or have different versions of system dependencies). Your build server and production server have to match when you include ERTS. With just Distillery, you can set include_erts: false to circumvent this, but you still should make sure the build and target servers match because of any native dependencies your app may have. The error you are getting is complaining about one of the dynamically linked libraries referenced by ERTS.