Save the output of cron shell scripts to a sqlite db
- Go 80.4%
- templ 17.4%
- Just 1.3%
- CSS 0.5%
- Shell 0.4%
| .claude | ||
| .images | ||
| .vscode | ||
| certs | ||
| cmd | ||
| config | ||
| litestream | ||
| logging | ||
| proto | ||
| server | ||
| store | ||
| text | ||
| .air.toml | ||
| .editorconfig | ||
| .gitattributes | ||
| .gitignore | ||
| CLAUDE.md | ||
| development.yaml | ||
| doc.go | ||
| environments.go | ||
| go.mod | ||
| go.sum | ||
| justfile | ||
| LICENSE | ||
| README.md | ||
| runner.yaml | ||
| TODO.md | ||
Cronlogger
Development
In order to compile the protobuf files and generate the necessary GRPC code the following tools need to be installed.
1. Protoc
The protobuf compiler needs to be installed: https://protobuf.dev/installation/. It is as simple as downloading the binaries and put them into the path.
2. GRPC generator
We also need the GRPC generator extension for golang
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
3. Justfile
Instead of a Makefile a justfile is used (https://github.com/casey/just).
sudo apt install just
Deployment
A simple git-deployment was established for the target-system following ths gist: https://gist.github.com/noelboss/3fe13927025b89757f8fb12e9066f2fa
# steps performed on the target-system
# the target folder to clone artifacts to
mkdir ~/cronlogger.deployment
# create a deployment git-repo
git init --bare ~/cronlogger.git
# create a post-receive hook script
touch cronlogger.git/hooks/post-receive
chmod +x post-receive
# -----------------------------------------------------------------------------------
# local/development system
# add remote on local/development system
git remote add production user@system:cronlogger.git
The post-receive hook takes care of the deployment
post-receive:
#!/bin/bash
TARGET_FOLDER="/path/to/cronlogger.deployment"
DEPLOYMENT_FOLDER="/usr/local/bin"
CONFIG_FOLDER="/etc/cronlogger"
GIT_DIR="/path/to/cronlogger.git"
BRANCH="main"
while read oldrev newrev ref
do
# only checking out the master (or whatever branch you would like to deploy)
if [ "$ref" = "refs/heads/$BRANCH" ];
then
echo "Ref $ref received. Deploying ${BRANCH} branch to production..."
git --work-tree=$TARGET_FOLDER --git-dir=$GIT_DIR checkout -f $BRANCH
sudo cp -f ${TARGET_FOLDER}/cronlogger_server ${DEPLOYMENT_FOLDER}/cronlogger_server
sudo systemctl restart cronlogger_server
sudo systemctl status cronlogger_server
echo "Deployment done; server restarted; have fun!"
else
echo "Ref $ref received. Doing nothing: only the ${BRANCH} branch may be deployed on this server."
fi
done
