This is the backend of NYCU SDC Clustron Project.
We aim to create a service to visuallize the LDAP access managing, Slurm operation, and resource usage on remote computer cluster.
Follow the official installation guide. Choose version 1.24 if you would like to specify the Go version.
Open your terminal and navigate to the directory that you wish to put this project.
And then execute the following command:
git clone https://github.com/NYCU-SDC/clustron-backend.git
cd clustron-backend
git fetch
make prepare
Be sure you have make
installed. You can check by:
make -v
If the result is something like make command not found
, install make
before running the above command.
We use sqlc for database queries generation and mockery for mocking.
brew install sqlc
brew install mockery
brew upgrade mockery
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
go install github.com/vektra/mockery/[email protected] # not recommanded by the documentation
You can also find more OS-spacific installing methods from the documentation.
You can simply start the backend service via command:
make run
To build the backend code into binary, run:
make build
The binary file will be ./bin/backend
.
We recommand you enable the pre-push hook if wish to commit to this repository. This will run checks before the code is pushed to the remote.
The pre-push hook is run via lefthook.
brew install lefthook
go install github.com/evilmartians/lefthook@latest
You can also find more OS-spacific installing methods from the documentation.
After installed lefthook, update git hook to use lefthook:
# run at project root
left hook install
Then you are good to go!
The pre-push checks will be envoked when you do git push
.
If the checks didn't pass, the push will be blocked.
To temporary by pass the pre-push check and push:
git push origin --no-verify
To disable pre-push action until re-open it:
left hook uninstall