From f4dd263f1bfa0e9d8d5ca486d8fd44becafabf2f Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Sun, 29 Mar 2026 21:09:06 +0200 Subject: [PATCH] Add contributing in hobbyfarm --- .../companies/suse/archive/hobbyfarm.md | 198 +++++++++++++++++- 1 file changed, 188 insertions(+), 10 deletions(-) diff --git a/docs/organizations/companies/suse/archive/hobbyfarm.md b/docs/organizations/companies/suse/archive/hobbyfarm.md index f6fa6ad..c9b5ef6 100644 --- a/docs/organizations/companies/suse/archive/hobbyfarm.md +++ b/docs/organizations/companies/suse/archive/hobbyfarm.md @@ -1,4 +1,4 @@ -# HobbyFarm +# HobbyFarm > Hobbyfarm is an interactive coding platform that runs in the browser @@ -11,10 +11,10 @@ ### Technologies -* Front-end: Angular -* Back-end: Go -* Documentation: Markdown -* Website: Hugo +- Front-end: Angular +- Back-end: Go +- Documentation: Markdown +- Website: Hugo ### Code repositories @@ -30,16 +30,194 @@ Name | Conten ### Local setup -* Start [Gargantua](https://github.com/hobbyfarm/gargantua/blob/master/CONTRIBUTING.md) -* Start Admin UI -* TODO +- Start [Gargantua](https://github.com/hobbyfarm/gargantua/blob/master/CONTRIBUTING.md) +- Start Admin UI +- TODO ## Operations ### Installation -* [Documentation](https://hobbyfarm.github.io/docs/setup/installation/) +- [Documentation](https://hobbyfarm.github.io/docs/setup/installation/) ## References -* [Amazon EC2](https://aws.amazon.com/ec2/) +- [Amazon EC2](https://aws.amazon.com/ec2/) + +## Contributing + +### Code logic + +The application processing starts with `main.go` file at the root of the source files. All the other go code is located in `pkg` folder. + +How it works: + +- _Clients_ are TODO +- _Controllers_ are TODO +- _Servers_ define the REST API entry points (route,method -> action) + - `AuthServer` + - `CourseServer` + - `EnvironmentServer` + - `ProgressServer` + - `RbacServer` + - `ScenarioServer` + - `ScheduleEventServer` + - `SessionServer` + - `UserServer` + - `VmServer` + - `VmSetServer` + - `VmTemplateServer` + +### Local Development + +- Go 1.19 must be installed + +```bash +go version +``` + +- Build the application + +```bash +go build +``` + +- Start local Kubernetes cluster + +```bash +k3d cluster create hobbyfarm --api-port 6550 -p "8081:80@loadbalancer" -p "8082:443@loadbalancer" --agents 1 +``` + +- Create manifest files: + +```yaml +--- +# rolebindings.yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: hobbyfarm-admin-rolebinding +subjects: + - kind: User + name: admin + apiGroup: rbac.authorization.k8s.io +roleRef: + kind: Role + name: hobbyfarm-admin + apiGroup: rbac.authorization.k8s.io +--- +# roles.yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: hobbyfarm-admin +rules: + - apiGroups: ["hobbyfarm.io"] + resources: ["*"] + verbs: ["*"] + - apiGroups: ["rbac.authorization.k8s.io"] + resources: ["roles", "rolebindings"] + verbs: ["*"] +--- +# users.yaml +apiVersion: hobbyfarm.io/v1 +kind: User +metadata: + name: admin +spec: + id: admin + email: admin + password: $2a$10$33fQs0G.lHQdDAsdoECgA.8iYvNtyJ2XC2AmvR5x6ZkzxSuKXyfFm + access_codes: + - training + settings: + ctr_enabled: "true" + ctxAccessCode: example-access-code + terminal_fontSize: "16" + terminal_theme: Solarized_Dark_Higher_Contrast +``` + +- Define Kubernetes objects needed by HobbyFarm + +```bash +kubectl create ns hobbyfarm +kubectl apply -f samples/kubernetes/roles.yaml -n hobbyfarm +kubectl apply -f samples/kubernetes/users.yaml -n hobbyfarm +kubectl apply -f samples/kubernetes/rolebindings.yaml -n hobbyfarm +``` + +- Create CA and TLS files (see [How To Create CA and Generate SSL/TLS Certificates & Keys](https://scriptcrunch.com/create-ca-tls-ssl-certificates-keys/)) + +```bash +cd .ssl/ +openssl genrsa -out ca.key 2048 +openssl req -x509 -new -nodes \ + -key ca.key -subj "/CN=hobbyfarm/C=US/L=CALIFORNIA" \ + -days 1825 -out ca.crt +openssl genrsa -out server.key 2048 +cat > csr.conf <