0

あなたの助けが必要です!アプリケーションが自動的に起動する前に、蒸留所リリース(Elixir-Application)で移行を実行しようとしています(ブートフック - https://hexdocs.pm/distillery/boot-hooks.html#contentを介して)。開発および運用プラットフォームは Windows である必要があります。

問題: 問題を参照している Windows (.bat) スクリプトに関する情報が見つかりません。「pre_start.bat」ファイルのスクリプトを検索します。これは、ERTS ノードを呼び出し、最後にその中の Elixir コードを呼び出します。

私の蒸留所構成: rel\config.exs

environment :prod do
  ...
  set pre_start_hook: "rel/hooks/pre_start"
  ...
end

必要なスクリプトは、"Elixir.MyApp.ReleaseTask.migrate" 関数の私のコードを呼び出す必要があります。

次のコードは、これまでに取得したものです..しかし、機能しません..

@echo off
echo Running migrations
echo.
echo.
echo.
cd %RELEASE_ROOT_DIR%

@set system_erl="<erl_directory>\erts-9.1\bin\erl.exe"
@set erl=%system_erl%
@set system_root_dir_cmd=%system_erl% -noshell -eval "io:format(\"~s\", [filename:nativename(code:root_dir())])." -s init stop
@set rootdir=%system_root%
@set system_erts_vsn_cmd=%system_erl% -noshell -eval "Ver=erlang:system_info(version),io:format(\"~s\", [Ver])" -s init stop
@set erts_vsn=%system_erts_vsn%
@set erts_dir=%rootdir%\erts-%erts_vsn%

@set rel_name="my_api"
@set rel_vsn="1.0"
@set consolidated_dir=%rootdir%\lib\%rel_name%-%rel_vsn%\consolidated

@%erl% -boot_var ERTS_LIB_DIR "%erts_dir%\..\lib" ^
       -hidden -noshell -boot start_clean ^
       -pa "%consolidated_dir%" ^
       -s "Elixir.MyApp.ReleaseTasks" "seed" -s init stop

echo Migrations run successfully

これで完全に間違っている場合は、私を修正してください。どんな助けでも大歓迎です!ところで、フェニックスアプリケーションです。

4

1 に答える 1