asdf-vm/asdf-erlang

Support a command like `kerl deploy` to copy an OTP installation to other machines?

tatsuya6502 opened this issue · 1 comments

Hi. Thank you for working on asdf-erlang!

We have some dev/testing Linux PCs/VMs and Macs (Apple silicon and Intel chips). We want to avoid to build Erlang/OTP on every machine at every time a new Erlang/OTP version is released. #165 can be a solution for this, but I would propose a different solution because we are using CentOS 7 on some of our Linux machines, and I am not sure if it is covered by #165.

kerl has a deploy command to copy an OTP installation to other machine.

https://github.com/kerl/kerl#deploy

deploy

kerl deploy <[user@]host> [directory] [remote_directory]

Deploys the specified installation to the given host and location.

$ kerl deploy anotherhost /path/to/install/dir

If remote_directory is omitted the specified directory will be used.

If directory and remote_directory is omitted the current working directory will be used.

NOTE: kerl assumes the specified host is accessible via ssh and rsync.

So it would be nice if asdf-erlang provides a similar command to kerl deploy. I am not sure if we can add a sub-command to asdf from a plugin, but if it is possible, it could be the followings:

asdf deploy erlang version [user@]host

To use deploy command, we still need to build Erlang/OTP once per OS/architecture, so the entire workflow will be the followings:

## On a CentOS 7 PC (for example).
## Build an OTP installation.
$ asdf install erlang 25.0

## Copy the installation to other CentOS 7 PCs.
$ asdf deploy erlang 25.0 user1@centos7-host1
$ asdf deploy erlang 25.0 user2@centos7-host2
$ ...

## On an Apple silicon Mac.
## Build the OTP installation.
$ asdf install erlang 25.0

## Copy the installation to other Apple silicon Macs.
$ asdf deploy erlang 25.0 user1@mac1
$ asdf deploy erlang 25.0 user2@mac2
$ ...

Is this feasible?

I'm not opposed to support for this being added to asdf-erlang. But it's not a high priority feature for me right now, so I don't have any plans to work on it myself.

I'd suggest we use https://asdf-vm.com/plugins/create.html#extension-commands-for-asdf-cli and expose a deploy command for asdf-erlang. If we took this approach we have a command like this:

$ asdf erlang deploy <version>

One difficulty we might encounter with this is that kerl keeps track of it's own installs in a file it manages, and I think we delete that kerl file currently. It may be necessary for kerl to understand what version it is deploying in order to deploy it correctly.

Contributions welcome!