Colony service: Ensuring colony is ready when any colony service command is run

#1

Hi, @ryanchristo. I am very much liking the new structure of the colony service, but I am noticing possibly some strange side effects that you can perhaps help me with.

Would it be possible when any colony service command is run to automatically ensure that colony network is completely deployed and set up before continuing? As a related issue, it is not clear to me when the colony-setup command needs to be rerun.

It seems that when I run yarn, even when I have not changed the colony service version number, that it is sometimes causing the colony network setup to be disrupted/deleted and need to be repeated before I continue. I am getting some strange errors in my dapp (e.g. missing contract addresses, etc.) that seem to come from this.

Thanks for any advice or solutions to this issue.

1 Like
#2

Would it be possible when any colony service command is run to automatically ensure that colony network is completely deployed and set up before continuing?

Yea, I think we can make this happen.

As a related issue, it is not clear to me when the colony-setup command needs to be rerun.

The colony-setup script within the colony-cli package was added as a means to quickly deploy a test colony in order to test extension contracts created in the colony-starter-contract package. This script could definitely be improved upon potentially as a prompt that would accept configuration options.

In other colonyJS packages, there is a colony-setup script included in the projects scripts directory, which is intended to be customizable so that developers collaborating on a project can run a script to deploy the colony that is required for their application or service.

This script can easily be ignored if you want to write your own script or you are creating an application or service that will support the creation of colonies within it, such as colony-example-react.

It seems that when I run yarn, even when I have not changed the colony service version number, that it is sometimes causing the colony network setup to be disrupted/deleted and need to be repeated before I continue. I am getting some strange errors in my dapp (e.g. missing contract addresses, etc.) that seem to come from this.

This can happen when you run yarn because the colony-cli package will be updated, which means the pulled down colonyNetwork repository that was installed in the colony-cli package as a dependency will be updated. There might be a way around this that would involve preventing updates to this dependency but I do not know of anything of the top of my head.

One solution to this issue would be to run the colony-cli package globally so that whenever you run yarn in your project, the necessary steps to run colonyNetwork do not have to be repeated.

#3

Thanks, Ryan. I was reflecting more on the issue and I think it might be even better if the colony network setup (e.g. pulling down the network and compiling contracts) happens not when the colony service is first run, but instead as a post install script that is triggered by yarn itself. That way whenever yarn was run, the post install script would ensure that whatever necessary final steps were also complete by the time yarn completed.

The problem with letting colony service decide if any setup is required is that if I have ganache running and colony already deployed and I re-run yarn to add a new package, etc. then yarn might remove the ganache storage as well as the built colony contracts causing breakage. That is why I suggested yarn. But if yarn does it, it would need to be a in “smart” way, to allow a running dapp to not lose its state.

Do you think that is a viable strategy? If that was not viable, then your alternative of installing colony cli globally might be a solution.

But if that were done, I think it would be important for the cli to check the package.json of the project being run to check for version compatibility of colonyJS packages to avoid unexpected errors.

Actually, I think this would be a good feature of the colony service regardless: perhaps a new service action could be called “audit” or “check” and it would verify that the colony packages (including ethers, etc) in a project are up to date and compatible with the colony network being used, or warn if anything is out of date (including the colony network itself, like npm and yarn themselves do).

Thanks.

1 Like
#4

Haha. Yes and no. This is actually how I originally had it but because the cli is also used to build colonyStarter packages, I moved the installation of colonyNetwork to be handled only with the service action.

I like the idea of a “check” or “audit” within the service action though. Would you mind opening an issue in colonyStarter?

#5

Will do! Thanks, Ryan.

1 Like