Skip to content

About

A practice project to refresh myself with Go

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

job-server

This repo implements the job server specified in design.md as development practice. It is "hand-written" because, at the time of implementation I had hardly written Go for a year.

Run

Requirements: quite roughly, go 1.26 on a Linux machine. It's difficult to guarantee support even for that as "Linux" isn't a very well-defined target and the software has only been run with go 1.26 on a single machine.

Server

cd server/
go build -o server
./server
With Podman/Docker

You can alternatively run the server as follows (if you have docker instead of podman, that should work equally well):

podman build -t int-backend-matt-1-server .
# --cap-add NET_RAW is required for ping; which is a nice demonstration of the program functionality
podman run --cap-add NET_RAW -p 8080:8080 int-backend-matt-1-server

Client

cd client/
go build -o job
./job start my-ping -- ping 127.0.0.1
./job status my-ping
./job stream my-ping
./job stop my-ping

Development

Test

go test -v ./...

If command tests are failing, it's possibly (hopefully) because the hard-coded allowlist in jobserver.go has binaries at a different location to the binaries in your system. Try to update the allowlist to match your system binary locations (you can use which to determine that, with e.g. which ping) and re-run the tests.

Regenerate gRPC

go generate ./...

Secret Generation

pushd server
../gen-ca-and-self-signed-cert.bash "server" "DNS:localhost,IP:127.0.0.1"
mv server-ca.crt ../client/
popd
pushd client
../gen-ca-and-self-signed-cert.bash "client" "email:int-backend-matt-1-client@domain.local"
mv client-ca.crt ../server/
popd

TODO

  • share allowlists with clients (statically, as in a file, or dynamically, as in a request)- as implemented, it's trial-and-error

About

A practice project to refresh myself with Go

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages