To automate elixir based application ,created a systemd
service
[Service]
Type=simple
User=gitlab-runner
Group=gitlab-runner
Environment=LANG=en_US.UTF-8
WorkingDirectory=/path/to/elixirModule
ExecStart=/path/to/elixirModule/bin/elixir_module start
ExecStop=/path/to/elixirModule/bin/elixir_module stop
In .gitlab-ci.yml
build-project:
stage: build_elixir_module
tags:
- elixer-shell
script:
- mix ecto.drop
- MIX_ENV=prod mix release
- ls -lh _build/prod
- cp _build/prod/elixir_module-0.1.0.tar.gz /path/to/elixirModule/
- tar -xvf /path/to/elixirModule/elixir_module-0.1.0.tar.gz
- sudo systemctl stop elixirModule
- cd /path/to/elixirModule
- bin/elixir_module start_iex
- EctoMnesia.Storage.storage_up(ElixirModuleRepo.config)
- ElixirModuleRepo.ReleaseTasks.migrate
- sudo systemctl stop elixirModule
These two commands should be executed within iex
terminal.
EctoMnesia.Storage.storage_up(ElixirModuleRepo.config)
ElixirModuleRepo.ReleaseTasks.migrate
With current configuration, I get following error
iex(elixir_module@node1)1> $ EctoMnesia.Storage.storage_up(ElixirModuleRepo.config) 1468 bash: eval: line 125: syntax error near unexpected token `ElixirModuleRepo.config'
How to run these two commands inside iex
. Also if my approach is buggy or any sort of wrong config, please let me know.