Skip to content

Conversation

@shravanshetty1
Copy link
Contributor

@shravanshetty1 shravanshetty1 commented Mar 26, 2021

closes #49
This PR introduces changes which integrates grpc into the current project. The changes include, basic grpc related setup code and 1 migrated endpoint GetAllocation.

@shravanshetty1 shravanshetty1 changed the title [WIP]Migrating some endpoints to GRPC Migrating some endpoints to GRPC Mar 27, 2021
@shravanshetty1 shravanshetty1 changed the title Migrating some endpoints to GRPC [WIP]Migrating some endpoints to GRPC Mar 27, 2021
@shravanshetty1 shravanshetty1 changed the title [WIP]Migrating some endpoints to GRPC [WIP]Adding boilerplate code to easily migrate grpc endpoints Mar 30, 2021
@shravanshetty1 shravanshetty1 changed the title [WIP]Adding boilerplate code to easily migrate grpc endpoints Adding boilerplate code to easily migrate grpc endpoints Mar 30, 2021
@shravanshetty1
Copy link
Contributor Author

closes #49

Copy link
Contributor

@Sriep Sriep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request unit test

@@ -0,0 +1,101 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.

Copy link
Contributor

@Sriep Sriep Apr 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is often considered bad to keep generated files under version control. So do you need these generated files under source control?

  • Maybe you could add a script to generate them, and a section in the readme.md to explain how to generate them?

Points specific to our project.

  • Users are encouraged to use docker scripts to run blobbers so it would be easy to add as an extra stage step in a dockerfile.
  • 0chain modules are difficult to compile for the first time on a blank OS. So there is no expectation of running the blobber module without preparation; which is one of the main factors in favour of keeping generated files in Github.

Anyway, I could go either way, just interested in hearing the reasons for keeping the generated code under source control?.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly for developer-experience, just like alot of other golang projects i have seen.

Generating at compile time will prevent any of the generated files from being out of date. I suggest we add github CI check to check if generated files are out of date and also regenerate the files while the service is being created in docker. This way any cons of keeping generated files in the codebase are eliminated, if there are other cons - please let me know.

Generated files could also fail in languages like c++ since the generated code will be OS specific. But since we are using golang this shouldnt be a problem since it has a runtime.

If you disagree with this i can remove the generated files as requested.

Copy link
Contributor

@Sriep Sriep Apr 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it fine if, as you suggested, we can ensure that the generated files are kept up to date.

Maybe add a .github/workfolw so that before merging the generated files are updated and confirmed to work.

I think generated files merged into master should not be trusted to developers, but auto-generated by CI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest changes should fix - #64

@shravanshetty1
Copy link
Contributor Author

lets handle further changes in different issues since these PR's are getting too large

@Sriep Sriep merged commit c02870d into master Apr 8, 2021
- "505${BLOBBER}:505${BLOBBER}"
command: ./bin/blobber --port 505${BLOBBER} --hostname localhost --deployment_mode 0 --keys_file keysconfig/b0bnode${BLOBBER}_keys.txt --files_dir /blobber/files --log_dir /blobber/log --db_dir /blobber/data --minio_file keysconfig/minio_config.txt
- "703${BLOBBER}:703${BLOBBER}"
command: ./bin/blobber --port 505${BLOBBER} --grpc_port 703${BLOBBER} --hostname localhost --deployment_mode 0 --keys_file keysconfig/b0bnode${BLOBBER}_keys.txt --files_dir /blobber/files --log_dir /blobber/log --db_dir /blobber/data --minio_file keysconfig/minio_config.txt
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anish-squareops A new arguement grpc_port has been added. Please confirm that this wont cause any issue. All changes are in docker.local. I am not sure if docker.local is being used in production.

@platsko platsko deleted the grpc-migration branch May 9, 2021 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add setup code to migrate endpoints to grpc

3 participants