0

I'm looking for advice on how to deploy and run an elixir/phoenix program on Windows.

I've used Distillery, however, it worked with mix release, but there are no commands available for command prompt. Every suggested command such as

_build/dev.../<program> console

produces the error not a recognized internal or external command.

I've used exrm as well, however, even after modifying the .bat files to remove the unwanted // in the path, it produces a kernel PID terminated error in the erlang dump file.

VERSION:

  • Elixir: 1.4.2
  • Erlang: 19.2 [erts-8.2]
  • Exrm: 1.0.3

The .bat's edited were:

<app>/rel/<app>/releases/version/app.bat and 
<app>/rel/<app>/bin/app.bat 

This was because it was trying to execute:

<app>/rel/<app>/releases//app.bat 

instead of the above. (the fix was found on here)

This worked, program executed but throws error:

kernel PID Terminated (application controller) failed to start child 'elixir.helloworld.endpoint'

Thanks for the help so far, apologies as it's my first time doing any of this part.

note: Windows 10 with exrm program runs normally with mix phoenix.server

Has anyone got a step by step to getting an elixir program or service to start on Windows?


Edit: getting warning during mix release:

variable deps does not exist and is being expanded to deps()

And during trying to start:

failed to open file <app>/rel/<app>releases/version/conform

Edited <app>/rel/<app>/bin/app.bat:

added "" to %start_erl%

@set start_erl=%release_root_dir%\releases\start_erl.data
@for /f "delims=" %%i in ('type "%start_erl%"') do 
@(set start_erl_data=%%i)

Edited <app>/rel/<app>/releases/version/app.bat:

added "" to %start_erl%

:: Discover the release root directory from the directory of this script
@set script_dir=%~dp0
@for %%A in ("%script_dir%\..\..") do @(set release_root_dir=%%~fA)
@set start_erl=%release_root_dir%\releases\start_erl.data
@for /f "delims=" %%i in ('type "%start_erl%"') do 
@(set start_erl_data=%%i)

Added "" to %werl%

:: Start a console
:console
@call :generate_config
@start "%rel_name% console" "%werl%" -config "%sys_config%" ^
-boot "%boot_script%" -boot_var ERTS_LIB_DIR "%erts_dir%"/lib ^
-env ERL_LIBS "%release_root_dir%"/lib ^
-pa "%release_root_dir%"/lib "%release_root_dir%"/lib/consolidated ^
-args_file "%vm_args%" ^
-user Elixir.IEx.CLI -extra --no-halt +iex
MasterAM
  • 16,283
  • 6
  • 45
  • 66
microleb
  • 1
  • 3
  • Distillery is not supported for Windows right now. We're working on it. Which .bat file(s) did you edit in Exrm and exactly how did you edit them? I don't recall any "unwanted //" in those batch files at all so I'm at a loss to figure out what you mean. We need exact details to figure this out. Exrm should work provided you have Erlang and Elixir is paths that don't contain spaces. – Onorio Catenacci Feb 21 '17 at 12:55
  • The answer here: http://stackoverflow.com/questions/30687781/how-to-run-elixir-application covers how to start an Elixir application and it should work on Windows as well as any other supported OS. – Onorio Catenacci Feb 21 '17 at 19:21
  • Thanks for the response; – microleb Feb 21 '17 at 20:45
  • You may want to add those details to the question above. – Onorio Catenacci Feb 21 '17 at 21:18
  • Try running this command from a command prompt `iex --werl` If the werl shell doesn't appear that's your issue. That's just a guess of what may be going on. – Onorio Catenacci Feb 21 '17 at 21:23
  • So iex --werl worked and erlang opened with iex at the prompt – microleb Feb 22 '17 at 03:28
  • So we still need you to post your modified bat file(s) and we still need specific details about the version of Erlang, Elixir and Exrm before we can start to figure out what's going on here. – Onorio Catenacci Feb 22 '17 at 12:53
  • Updated the question above – microleb Feb 22 '17 at 22:23

1 Answers1

1

A few more suggestions:

  1. Try the latest version of EXRM (it's 1.08 and you've got 1.03). By the way, double check your version of EXRM because I'd be a bit surprised if it's not actually 1.08 and you misread it.
  2. Create a small/simple app and try the console with the unmodified batch files.
  3. Uninstall Erlang and install it into a path with no spaces (e. g. c:\usr\bin\erlang). Yes, I know that's not standard for Windows but directory names with spaces always seem to cause issues.
  4. Look for an erl_crash.dump file. If you find one, use observer by starting the iex shell and typing :observer.start() Within observer, select File->Examine Crashdump from the menu. This may help you to figure out what's wrong as well.
  5. If you can figure out the exact command line that's getting constructed by the batch file, try running the command line directly and see what happens. It's unlikely to behave any differently but if there are additional messages which are being hidden rather than echoed you can see them that way.
halfer
  • 19,824
  • 17
  • 99
  • 186
Onorio Catenacci
  • 14,928
  • 14
  • 81
  • 132
  • Thank you very much, will try the exrm version check and the erlang reinstall. I've tried running the bat files unmodified but it tries to locate the incorrect path due to the missing ' "" ' in the bat. – microleb Feb 23 '17 at 01:42