114 lines
2.3 KiB
Markdown
114 lines
2.3 KiB
Markdown
# gomanager
|
|
|
|
## description
|
|
|
|
Go Manager is a program that watches your package binaries and if they're not the same version of your installed go version, it rebuilds the packages.
|
|
By default it is ran every 24 hours.
|
|
It does not use fnotify or similar.
|
|
It's a simple tool which checks the current Go version vs the version of the complied binaries.
|
|
|
|
You **MUST** be root to run all commands
|
|
|
|
## scenario
|
|
|
|
You have go projects which you `git clone` and `go build`.
|
|
You can't be arsed to keep the built binaries up to date, manually, every time a new Go version is released.
|
|
Gomanager does this job for you, periodically.
|
|
|
|
## install
|
|
|
|
### pre-requisites
|
|
a functioning build environment
|
|
|
|
#### CentOS/RHEL/Rocky/Alma etc
|
|
```bash
|
|
yum groupinstall 'Development Tools'
|
|
```
|
|
|
|
#### Debian/Ubuntu
|
|
```bash
|
|
apt install build-essentials
|
|
```
|
|
|
|
#### Archlinux
|
|
```bash
|
|
pacman -S base-devel
|
|
```
|
|
|
|
### Default installation procedure
|
|
```bash
|
|
CGO_ENABLED=1 go install code.icod.de/dalu/gomanager@latest
|
|
mv ~/go/bin/gomanager /usr/local/bin/
|
|
gomanager setup
|
|
```
|
|
|
|
### Default update procedure
|
|
```bash
|
|
CGO_ENABLED=1 go install code.icod.de/dalu/gomanager@latest
|
|
mv ~/go/bin/gomanager /usr/local/bin/
|
|
```
|
|
## usage
|
|
|
|
all commands can have `-h` added for a help screen.
|
|
|
|
### add project
|
|
```bash
|
|
gomanager add \
|
|
--root-path="" \
|
|
--binary-path="" \
|
|
--service-name="" \
|
|
```
|
|
|
|
### remove project
|
|
Find out the ID of a watched project with `gomanager list`
|
|
```bash
|
|
gomanager remove --id 1
|
|
```
|
|
|
|
### list projects
|
|
```bash
|
|
gomanager list
|
|
```
|
|
|
|
### show logs of a project
|
|
Find out the ID of a watched project with `gomanager list`
|
|
```bash
|
|
gomanager logs --id 1
|
|
```
|
|
|
|
### start/run
|
|
This starts the periodic watcher in the foreground, which runs every 24 hours.
|
|
It is advised to use a systemd or other init script to run this in the background, supervised.
|
|
```bash
|
|
gomanager start
|
|
```
|
|
|
|
### systemd service
|
|
read the contrib directory
|
|
The runner is ran every 24 hours.
|
|
|
|
### cron job
|
|
This runs the watcher every day a 2am
|
|
```bash
|
|
crontab -e
|
|
```
|
|
```cronexp
|
|
0 2 * * * /usr/local/bin/gomanager cron
|
|
```
|
|
|
|
### systemd timer
|
|
see the
|
|
- contrib/gomanager-cron.service
|
|
- contrib/gomanager-cron.timer
|
|
|
|
copy to `/etc/systemd/system/` and
|
|
```bash
|
|
systemctl enable --now gomanager-cron.timer
|
|
```
|
|
|
|
# uninstall
|
|
```bash
|
|
gomanager clean
|
|
rm /usr/local/bin/gomanager
|
|
```
|