gomanager/README.md

108 lines
2.1 KiB
Markdown
Raw Normal View History

2023-12-01 23:02:33 +01:00
# 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.
2023-12-01 23:52:30 +01:00
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.
2023-12-01 23:02:33 +01:00
2023-12-01 23:52:30 +01:00
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.
2023-12-01 23:02:33 +01:00
## install
2023-12-01 23:52:30 +01:00
### 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
2023-12-01 23:02:33 +01:00
```bash
CGO_ENABLED=1 go install code.icod.de/dalu/gomanager@latest
2023-12-01 23:02:33 +01:00
mv ~/go/bin/gomanager /usr/local/bin/
gomanager setup
```
## usage
2023-12-01 23:58:11 +01:00
all commands can have `-h` added for a help screen.
2023-12-01 23:02:33 +01:00
### add project
```bash
gomanager add \
--root-path="" \
--binary-path="" \
--service-name="" \
```
### remove project
2023-12-01 23:52:30 +01:00
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`
2023-12-01 23:02:33 +01:00
```bash
2023-12-01 23:52:30 +01:00
gomanager logs --id 1
2023-12-01 23:02:33 +01:00
```
### start/run
2023-12-01 23:58:11 +01:00
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.
2023-12-01 23:02:33 +01:00
```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
```