Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use it with modules that have replace directives #1

Open
oderwat opened this issue May 28, 2022 · 5 comments
Open

How to use it with modules that have replace directives #1

oderwat opened this issue May 28, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@oderwat
Copy link

oderwat commented May 28, 2022

This looks interesting, but I wonder how to use it with our modules as we do not only have private repositories but also a fair amount of replacements for packages that are not (yet) updated upstream. Those can not use go install but need to be copied from other sources like a (release) URL or being built normally on the server. As we are using mage most of the time, I would like to have something like 'cloning/updating' the module and then running some command (which could be mage install or go build -o ...

@pioz pioz added the enhancement New feature or request label May 28, 2022
@pioz
Copy link
Owner

pioz commented May 28, 2022

Actually, this is not possible but seems reasonable. I'll try to add this possibility in the next updates of God.

What do you think about adding two new options in the conf file like the following?

clone_repo: github.com/pioz/go_hello_world_server # mandatory
clone_repo_destination_directory: /home/pioz # default home
build_cmd: go build -o hello # default go build -o service_name

If the option clone_repo is present, God tries to install the service without using go install but by following these steps:

  1. clone the repo clone_repo in clone_repo_destination_directory
  2. run build_cmd in the clone_repo_destination_directory
  3. copy the just compiled binary in go_bin_directory

@oderwat
Copy link
Author

oderwat commented May 28, 2022

This sounds good to me. The cloning process may have to check if updating works and falling back to force an overwrite. It would also be good to have the possibility to give a branch or tag that should be used.

@oderwat
Copy link
Author

oderwat commented May 28, 2022

By the way, cloning and having a build command also makes this whole system much more usable as this will work with much more than Go modules. Also, running docker images comes to mind.

@pioz
Copy link
Owner

pioz commented May 29, 2022

@oderwat and what do you think instead to clone and compile the program on the remote server, just compiling the binary in the local machine and copying only the compiled executable on the server?

@oderwat
Copy link
Author

oderwat commented May 29, 2022

For our use cases, I guess the compile from a cloned repository would be most useful. If you have a compiled binary it would be nice to be able to use that too. You could even use one (staging) machine to compile it and the build script also does some CI checks and after this works the other machines could get the binary from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants