Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid Edeliver deployment error: "vm.args: No such file or directory"?

Context

We are trying to use edeliver to deploy a "Hot Upgrade" of a Phoenix Web Application to a remote Virtual Machine instance.

Our aim is to build an "upgrade" version of the app each time so that the app can be "hot" upgraded in production without any down-time.

We have succeeded in doing this "hot upgrade" on a "Hello World" phoenix app: https://github.com/nelsonic/hello_world_edeliver which is automatically deployed from Travis-CI when the build passes. see: https://travis-ci.org/nelsonic/hello_world_edeliver/builds/259965752#L1752

So, in theory this technique should work for our "real" app.

Attempting to Deploy a "Real" Phoenix App using Edeliver

Ran the following command (to build the upgrade):

mix edeliver build upgrade --auto-version=git-revision --from=$(git rev-parse HEAD~) --to=$(git rev-parse HEAD) --verbose

i.e. "build the upgrade from the previous git revision to the current one"

So far, so good. "Release successfully built!"

edeliver-upgrade-build-successful

Error: vm.args: No such file or directory

When we attempt to deploy the upgrade:

mix edeliver deploy upgrade to production --version=1.0.3+86d55eb --verbose

vm.args-no-such-file-or-directory

cat: /home/hladmin/healthlocker/releases/1.0.3+86d55eb/vm.args: No such file or directory

Note: we have a little bash script that reads the latest upgrade version available in .deliver/releases and deploys that see: version.sh

Question:

Is there a way to ignore the absence of the vm.args file and continue the deployment?

Or if the file is required to complete the deployment, is there some documentation on how to create the file?

Note: we have read the distillery "Runtime Configuration" docs: https://github.com/bitwalker/distillery/blob/master/docs/Runtime%20Configuration.md and are sadly none-the-wiser ...

Additional Info

Environment

  • Localhost: Mac running Elixir 1.4.2
  • Build Host: Ubuntu 16.04.2 LTS running Elixir 1.4.5
  • mix.exs file: https://github.com/healthlocker/healthlocker/blob/continuous-delivery/mix.exs
  • edeliver version: 1.4.4
  • Build tool: distillery version: 1.4.0
  • Umbrella project: yes.

This question was also asked on: https://github.com/edeliver/edeliver/issues/234

like image 395
nelsonic Avatar asked Aug 03 '17 08:08

nelsonic


1 Answers

As mentioned by others, the vm.args file is necessary for BEAM to run the release. A default file is created by distillery during the release build process and should be located in releases/<version>/vm.args. From your log output it looks like expected directory is being checked.

  • Can you show us the contents of /home/hladmin/healthlocker/releases/?
  • Can you confirm that the default vm.args file is being created when building the release and extracting it (outside of the upgrade process)?

You also asked:

Or if the file is required to complete the deployment, is there some documentation on how to create the file?

If diagnosing the problem with the default vm.args file doesn't get you anywhere, you can also write your own file and configure distillery to use that file instead of the default. The details for this are in the distillery configuration docs. In short, add the vm_args setting to your distillery config, which should be at rel/config.exs(relative to your project root), for example:

environment :prod do
  set vm_args: "<path>/vm.args"
  [...]
end
like image 60
Keyan P Avatar answered Nov 02 '22 12:11

Keyan P