GoHotDeploy is a lightweight tool that enables hot deployment of Go applications using GitLab Webhooks.
English | 简体中文
-
Install GoHotDeploy:
go get github.com/treeforest/gohotdeploy
-
Create a configuration file
config.yml
with the following content:port: 8080 repositories: my-repo: build_relative_dir: . build_args_bin: ""
Replace
.
with the relative path to the build directory within your Git repository. Ifbuild_relative_dir
is left empty, it defaults to the current directory of the repository.Modify the
build_args_bin
value to include the desired arguments to be passed when executing the built binary. Ifbuild_args_bin
is left empty, no additional arguments will be passed during program execution. -
Start GoHotDeploy:
gohotdeploy --config=config.yml
GoHotDeploy will start an HTTP server listening on the specified port (default: 8080) for GitLab webhook events.
-
Configure GitLab webhook:
- Go to your GitLab project settings.
- Navigate to "Webhooks" in the left sidebar.
- Add a new webhook with the following settings:
- URL:
http://your-server-ip:8080/
- Trigger: "Push events"
- SSL verification: Enable or disable based on your server configuration
- Save the webhook.
- URL:
Whenever a push event occurs in your GitLab repository, GoHotDeploy will automatically build and deploy your application.