Js-ipfs: Add a restart method to allow config updates to be applied via api

Created on 17 Sep 2018  路  8Comments  路  Source: ipfs/js-ipfs

The api allows for the node config to be changed via config.set and config.replace and for stopping of the daemon process via stop but there is no way to start or reload the service. To get config changes applied you must have some mechanism to restart the node.

A restart method would allow the user to make config changes via webui and have them by applied by stopping and restarting the service.

For bonus points nginx provides a reload command that allows the user to apply the config without stopping the service.

dihard help wanted kinfeature

All 8 comments

As a workaround, we could suggest that users always deploy ipfs with a process manager like init or systemd so that ipfs is automatically restated after it is shutdown, but it feels like something we should support directly as it's required to apply config changes.

@diasdavid @Stebalien how about it? Right now the user experience of editing the node config via web UI is bad. You can edit it and save it, but you can't get it applied without going to the command line, killing an starting the process.

We want Web UI to be able to "save & apply". A really nice thing this would unlock is to offer up the experimental features as toggle switches on the settings page so we can promote them and get more people using them.

For the hyperlinkers this is in the same api quadrant as https://github.com/ipfs/js-ipfs/issues/1547 - API to reset config to defaults, as people may break their config and need a way back to the happy path.

Seems like a very easy win to me :) 馃憤馃徑

A restart command sounds reasonable. To make systemd users happy, we could also add a --restart-exit-code daemon flag. When set, restart would actually just exit with that exit code. The systemd unit would be configured to restart the daemon when it exits with the specified error code.

@Stebalien good idea!

I think the daemon flag should be named --exit-code. Also, the stop command/http endpoint should also accept it. I also suggest that the default value is zero.

I think the daemon flag should be named --exit-code

I think you may have misunderstood the issue we're discussing. --restart-exit-code would set the exit code used when the daemon wants to be restarted.

I was thinking of two commands ipfs restart and ipfs stop that could also be used by HTTP-API.

I guess allowing an arbitrary exit code for shutdown could be useful. But that really is a different issue. (note: we already have ipfs shutdown)

Was this page helpful?
0 / 5 - 0 ratings