{"id":20994461,"url":"https://github.com/laetho/person-svc-go","last_synced_at":"2026-07-04T19:31:31.369Z","repository":{"id":88557831,"uuid":"335704926","full_name":"laetho/person-svc-go","owner":"laetho","description":"Just a very simple service to test  some concepts.","archived":false,"fork":false,"pushed_at":"2021-06-18T07:05:40.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-13T12:45:16.811Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/laetho.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":"2021-02-03T17:36:39.000Z","updated_at":"2023-12-12T08:24:10.000Z","dependencies_parsed_at":"2023-03-13T18:22:58.877Z","dependency_job_id":null,"html_url":"https://github.com/laetho/person-svc-go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/laetho/person-svc-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laetho%2Fperson-svc-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laetho%2Fperson-svc-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laetho%2Fperson-svc-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laetho%2Fperson-svc-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laetho","download_url":"https://codeload.github.com/laetho/person-svc-go/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laetho%2Fperson-svc-go/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266385409,"owners_count":23921278,"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","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-19T07:18:25.493Z","updated_at":"2025-10-28T09:20:58.742Z","avatar_url":"https://github.com/laetho.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# person-svc-go\n\nThis is a really simple and basic implementation of a go lang based\nmicroservice. It's main purpose is to demonstrate how to containerize\nit, how to work with this locally and how to run this on that Kubernetes\nthing.\n\n\n\n## Building\n\nWe'll experiment with different ways of building this very simple service.\n\nWe'll try the following tools:\n\n- buildah\n- podman-compose\n- GitHub Actions\n- Openshift BuildConfig (s2i)\n\n### buildah\nExperimenting with buildah and podman instead of running a docker \ndaemon. Testing podman-compose as well. \n\n```bash\nbuildah bud -f Dockerfile -t person-svc-go\n```\n\n### podman-compose\n\n\n```bash\npodman-compose build\n```\n\n\n## Running\n\nIn this section we'll explore different ways of running the container we \nbuilt and other supporting containers we need to test or run this application. \n\nWe'll go into the following tools for running it or generating manifests to run\nit on kuberntes using diffrent tools like:\n\n- podman\n- podman-compose\n- kompose or podman 3.0\n- metagraf / mg\n\n### On my local machine\n\n#### podman\n\nPodman command to run the Postgres instance our person-svc-go service needs:\n\n```bash\npodman run --env-file configs/envfiles/postgres.env docker.io/library/postgres\n# or with --detach to get your shell back\npodman run --detach --env-file configs/envfiles/postgres.env docker.io/library/postgres\n```\n\nPodman command to run the person-svc-go container we built:\n\n```bash\n# Run the locally built image\npodman run \u003cimageid\u003e\n# or\npodman run localhost/person-svc-go\n```\n\n#### podman-compose\n\n```bash\n# or\npodman-compose up\n# Need to issue restart since the go application starts before the database is ready.\n# A deployment to Kubernetes would take care of this on it's own.\npodman-compose restart person-svc-go\n```\n\n### For Kubernetes\n\n#### kompose\n\nWe can use a tool called kompose to transform a docker-compose.yaml to \nKubernetes manifests.\n\nThis is a quick way to get some basic Kubernetes manifests going.\n\n```bash\n#todo\nkompose ....\n```\n\n#### metaGraf - Generating manifests with mg\n\nWe'll use the mg tool from the https://github.com/laetho/metagraf project\nand the person-svc-go-db.metagraf.json we wrote. We're using the *mg* specific\nconfig files in configs/mg/ as input for some of the commands.\n\nTo generate an empty .properties file from a metaGraf specification you\ncan do the following:\n\n```bash\n\u003e mg create properties person-svc-go-db.metagraf.json \u003e configs/mg/person-svc-go-db.properties \n\n\u003e mg create properties person-svc-go.metagraf.json \u003e configs/mg/person-svc-go.properties\n\n```\n\nThe *mg* tool can also validate your *.properties* file against the metaGraf specification:\n\n```bash\n\u003e mg inspect properties person-svc-go.metagraf.json configs/mg/person-svc-go.properties \nThe configs/mg/person-svc-go.properties configuration is valid for this metaGraf specification.\n```\n\nGenerate kubernetes manifests for the ephemeral PosgreSQL instance.\n\nSnippet from: [scripts/mg-generate-manifests.sh](https://github.com/laetho/person-svc-go/blob/master/scripts/mg-generate-manifests.sh):\n```bash\n...\n# Service{}\nmg create service \\\n --output \\\n --dryrun \\\n --namespace person \\\n -o yaml \\\n person-svc-go-db.metagraf.json \\\n | tee deployments/mg/person-svc-go-db.service.yaml\n\n# Deployment{}\nmg create deployment \\\n --output \\\n --dryrun \\\n --namespace person \\\n --disable-aliasing \\\n -o yaml \\\n --cvfile configs/mg/person-go-svc-db.properties \\\n person-svc-go-db.metagraf.json \\\n | tee deployments/mg/person-svc-go-db.deployment.yaml\n ...\n```\nProduced:\n- [deployments/mg/person-svc-go-db.deployment.yaml](https://github.com/laetho/person-svc-go/blob/master/deployments/mg/person-svc-go-db.deployment.yaml)\n- [deployments/mg/person-svc-go-db.service.yaml](https://github.com/laetho/person-svc-go/blob/master/deployments/mg/person-svc-go-db.service.yaml)\n\nGenerate Kubernetes manifests for the person-svc-go service:\n\nSnippet from: [scripts/mg-generate-manifests.sh](https://github.com/laetho/person-svc-go/blob/master/scripts/mg-generate-manifests.sh):\n```bash\n# person-svc-gov1 Service{}\nmg create service \\\n --output \\\n --dryrun \\\n --namespace person \\\n -o yaml \\\n person-svc-go.metagraf.json \\\n | tee deployments/mg/person-svc-go.service.yaml\n\n# person-svc-gov1 Deployment{}\n# --disable-aliasing is used because default behaviour is to expect a retag image with the\n# application name and not the upstream name on your internal registry. This should be the\n# other way around as default.\nmg create deployment \\\n --output \\\n --dryrun \\\n --namespace person \\\n --disable-aliasing \\\n -o yaml \\\n --cvfile configs/mg/person-svc-go.properties \\\n person-svc-go.metagraf.json \\\n | tee deployments/mg/person-svc-go.deployment.yaml\n```\nProduced:\n- [deployments/mg/person-svc-go.deployment.yaml](https://github.com/laetho/person-svc-go/blob/master/deployments/mg/person-svc-go.deployment.yaml)\n- [deployments/mg/person-svc-go.service.yaml](https://github.com/laetho/person-svc-go/blob/master/deployments/mg/person-svc-go.service.yaml)\n\n\n## Performance testing\n\nMy old and trusty workstation from yesteryears:\n\n```bash\n...\nmodel name      : Intel(R) Xeon(R) CPU           W3530  @ 2.80GHz\n...\n```\n\nRun that connects to Postgres and queries for persons and returns the results.\n\n```bash\nwrk -c 100 -d 60 -t 8 http://localhost:8080/persons\nRunning 1m test @ http://localhost:8080/persons\n  8 threads and 100 connections\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\n    Latency     4.48ms    3.90ms  45.51ms   63.03%\n    Req/Sec     3.02k   157.93     4.21k    68.25%\n  1442493 requests in 1.00m, 537.89MB read\nRequests/sec:  24031.57\nTransfer/sec:      8.96MB\n```\n\n\nRun that calls a status enpoint with a static JSON response.\n\n```bash\nwrk -c 100 -d 60 -t 8 http://localhost:8080/status\nRunning 1m test @ http://localhost:8080/status\n  8 threads and 100 connections\n  Thread Stats   Avg      Stdev     Max   +/- Stdev\n    Latency     2.17ms    3.11ms  57.00ms   87.35%\n    Req/Sec     9.80k     2.23k   23.82k    68.21%\n  4682922 requests in 1.00m, 553.78MB read\nRequests/sec:  77947.51\nTransfer/sec:      9.22MB\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaetho%2Fperson-svc-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaetho%2Fperson-svc-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaetho%2Fperson-svc-go/lists"}