kuon
Edeliver custom commands
I use edeliver for deployment and it works great.
I’d like to be able to extend edeliver to run custom commands, for example:
mix edeliver console
would do something like this:
$ ssh deploy-host
# /approot/bin/myapp remote_console
In ruby apps, I can juste write a capistrano script, I wonder how to approach this with my elixir apps.
First Post!
bharendt
Yes, this is possible. If you create a bash script at .deliver/strategies/erlang-console containing a run() function and an optional help() function you should be able to run edeliver console. If you want to pass custom parameters, you can add a .deliver/help script file implementing an accepts_custom_command_argument() function to which the command is passed as first and the argument as second parameter and which should return 0 for accepted arguments, otherwise 1. The output of the optional print_custom_commands_help() function will be appended to the edeliver help output.
Last Post!
kuon
I came up with the following:
#!/usr/bin/env bash
REQUIRED_CONFIGS+=("APP")
REQUIRED_CONFIGS+=("NODE_ENVIRONMENT")
REQUIRED_CONFIGS+=("NODE_ACTION")
NODE_ACTION="remote_console"
NODE_ENVIRONMENT=$DEPLOY_ENVIRONMENT || "staging"
: ${NODE_ENVIRONMENT:="staging"}
source ${BASE_PATH}/strategies/erlang-node-execute
run() {
# ssh setup
authorize_hosts
local _node_command=$NODE_ACTION
# take the first node only
local _nodes=(${NODES// / })
local _node=${_nodes[0]}
__execute_node_command "single_node" "$_node" "$_node_command"
}
Which works, except for one details, the erlang nodename is modified, and I end up in
iex(remsh3379d012-kura@127.0.0.1)1> instead of iex(kura@127.0.0.1)1>.
I was able to trace the problem to the absence of TTY. If my app is called without a TTY, erlang seems to randomize the node name.
I can just replace __execute_node_command with a direct ssh call now that I am more familiar with the edeliver internals. But I wonder if maybe this is a bug somehow, because I noticed that ssh was called with -t from __execute_node_command.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









