{"id":15779759,"url":"https://github.com/rgl/hello-etcd","last_synced_at":"2026-05-04T10:40:23.478Z","repository":{"id":216611899,"uuid":"741352771","full_name":"rgl/hello-etcd","owner":"rgl","description":"Hello World example application using Go and etcd","archived":false,"fork":false,"pushed_at":"2024-06-09T08:35:11.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-31T11:06:03.313Z","etag":null,"topics":["docker","docker-compose","etcd","hello-world","kubernetes"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rgl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-10T08:10:29.000Z","updated_at":"2024-06-09T08:35:14.000Z","dependencies_parsed_at":"2024-01-11T08:48:46.605Z","dependency_job_id":"9ed9f03f-079a-44d9-ab21-519a3714f75b","html_url":"https://github.com/rgl/hello-etcd","commit_stats":null,"previous_names":["rgl/hello-etcd"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fhello-etcd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fhello-etcd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fhello-etcd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgl%2Fhello-etcd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rgl","download_url":"https://codeload.github.com/rgl/hello-etcd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246492290,"owners_count":20786341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","etcd","hello-world","kubernetes"],"created_at":"2024-10-04T18:21:24.282Z","updated_at":"2026-05-04T10:40:23.473Z","avatar_url":"https://github.com/rgl.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About\n\n[![Build](https://github.com/rgl/hello-etcd/actions/workflows/build.yml/badge.svg)](https://github.com/rgl/hello-etcd/actions/workflows/build.yml)\n\nThis an Hello World example application using Go and etcd.\n\n# Docker Compose Usage\n\nStart the environment defined in the [compose.yml file](compose.yml) and leave it running in foreground:\n\n```bash\ndocker compose up --build\n```\n\nExecute the following commands in another shell.\n\nShow the running containers:\n\n```bash\ndocker compose ps\n```\n\nTry executing commands inside the containers:\n\n```bash\ndocker compose exec -T hello hello --version\ndocker compose exec -T etcd etcd --version\ndocker compose exec -T etcd etcdctl version\ndocker compose exec -T etcd etcdctl endpoint health\ndocker compose exec -T etcd etcdctl member list\ndocker compose exec -T etcd etcdctl put foo bar\ndocker compose exec -T etcd etcdctl get foo\n```\n\nInvoke the [hello endpoint](http://localhost:8888):\n\n```bash\nwget -qO- http://localhost:8888\n```\n\nAt the first shell, stop the environment by pressing `Ctrl+C`, then start it\nagain. Back at the second shell, redo the test, and notice that the hello\ncounter resumes where it was left off due to etcd using a persistent volume.\n\nDestroy the environment, including the persistent volumes:\n\n```bash\ndocker compose down --volumes --timeout=0\n```\n\n# Kubernetes Usage\n\n**NB** This assumes you are using a [Kind Kubernetes cluster](https://github.com/kubernetes-sigs/kind) as configured in [rgl/my-ubuntu-ansible-playbooks](https://github.com/rgl/my-ubuntu-ansible-playbooks/tree/main/roles/kind). So YMMV.\n\nEnsure that your Kubernetes cluster has support for persistent data. For that,\ndisplay the available `StorageClass`, and ensure that is has a `standard`\nclass, otherwise you have to modify the [`manifest.yml` file](manifest.yml) to\nuse a class that exists in your particular cluster:\n\n```bash\nkubectl get sc\n```\n\nDeploy the manifest:\n\n```bash\nkubectl apply -f manifest.yml\n```\n\nWait for the deployments to finish, and `PersistentVolumeClaim` to be bound:\n\n```bash\nkubectl rollout status deployment hello-etcd\nkubectl rollout status statefulset hello-etcd-etcd\nkubectl wait --for jsonpath='{.status.phase}=Bound' pvc/etcd-data-hello-etcd-etcd-0\n```\n\nDisplay the `Ingress`, `Service`, `Pod`, `PersistentVolumeClaim`,\n`PersistentVolume`, and `StorageClass` resources:\n\n```bash\nkubectl get service,pod,pvc,pv,sc\n```\n\nAccess the `hello-etcd` service from a [kubectl port-forward local port](https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/):\n\n```bash\nkubectl port-forward service/hello-etcd 6789:web \u0026\nsleep 3\nwget -qO- http://localhost:6789 # Hello World #1!\nwget -qO- http://localhost:6789 # Hello World #2!\nwget -qO- http://localhost:6789 # Hello World #3!\nkill %1\nsleep 1\n```\n\nDelete the resources:\n\n**NB** Since we are using a `StatefulSet` with `persistentVolumeClaimRetentionPolicy` set to `Retain` (the default), the `PersistentVolumeClaim` and `PersistentVolume` resources are not automatically deleted.\n\n```bash\nkubectl delete -f manifest.yml\n```\n\nVerify that the `PersistentVolumeClaim` and `PersistentVolume` resources are\nstill available:\n\n```bash\nkubectl get pvc,pv\n```\n\nRecreate the resources:\n\n```bash\nkubectl apply -f manifest.yml\nkubectl rollout status deployment hello-etcd\nkubectl rollout status statefulset hello-etcd-etcd\nkubectl get service,statefulset,pod,pvc,pv,sc\n```\n\nAccess the `hello-etcd` service from a [kubectl port-forward local port](https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/):\n\n```bash\nkubectl port-forward service/hello-etcd 6789:web \u0026\nsleep 3\nwget -qO- http://localhost:6789 # Hello World #4!\nwget -qO- http://localhost:6789 # Hello World #5!\nwget -qO- http://localhost:6789 # Hello World #6!\nkill %1\nsleep 1\n```\n\nNotice that the hello counter resumes where it was left off due to etcd using a\npersistent volume.\n\nDelete everything, including the persistent volume:\n\n```bash\nkubectl delete -f manifest.yml\nkubectl delete persistentvolumeclaim/etcd-data-hello-etcd-etcd-0\nkubectl get service,pod,pvc,pv,sc\n```\n\n# References\n\n* [Dockerfile Reference](https://docs.docker.com/engine/reference/builder/)\n* [Compose Spec](https://github.com/compose-spec/compose-spec/blob/master/spec.md)\n* [OCI Image Format](https://github.com/opencontainers/image-spec)\n  * [Pre-Defined Annotation Keys](https://github.com/opencontainers/image-spec/blob/main/annotations.md) (used in the [Dockerfile](Dockerfile) `LABEL` instructions)\n* Kubernetes\n  * [StatefulSet](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/)\n  * [Persistent Volumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/)\n  * [Configure a Security Context for a Pod or Container](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fhello-etcd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frgl%2Fhello-etcd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgl%2Fhello-etcd/lists"}