I want to be able to generate some files such as “nginx config”, “systemd service” and others. Some of the files will be used in the production environment. All that, I guess, should work similar to how Rake tasks work in Ruby.
I may want to run such tasks locally as well as remotely.
It should have its own config files. However, the standard, in /config
directory, Phoenix config files could be reused, because I don’t want to copy-paste data accross config and have to maintain its consistent.
For instance:
I want to generate nginx config for my application. I’d want to be able to load Phoenix IEX shell and say something like:
> MyApp123.UserTasks/generate_nginx_config(arg1, arg2, arg3)
and that’d produce a file in, say, rel/var/nginx_my_site123.conf
And the same way it’d work for other tasks:
- load a Phoenix (not simply Elixir shell) shell
- run a task I’ve written
- get a result – as a physical file, text output, something else…
How to approach this?
I won’t want to use any additional, external dependencies unless they’ll be absolutely necessary.