简体   繁体   中英

How to correctly deploy Elixir/Phoenix program to Windows?

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

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 (eg 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM