{"id":19308748,"url":"https://github.com/mtulio/go-labs","last_synced_at":"2025-07-12T02:02:48.162Z","repository":{"id":43655495,"uuid":"415177642","full_name":"mtulio/go-labs","owner":"mtulio","description":"Dummy Go API to run labs behind AWS *LB","archived":false,"fork":false,"pushed_at":"2022-03-02T21:30:57.000Z","size":100,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-06T01:30:20.377Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mtulio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-09T02:14:18.000Z","updated_at":"2021-12-21T17:31:07.000Z","dependencies_parsed_at":"2022-09-05T02:50:48.092Z","dependency_job_id":null,"html_url":"https://github.com/mtulio/go-labs","commit_stats":null,"previous_names":["mtulio/go-lab-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtulio%2Fgo-labs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtulio%2Fgo-labs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtulio%2Fgo-labs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtulio%2Fgo-labs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtulio","download_url":"https://codeload.github.com/mtulio/go-labs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240409849,"owners_count":19796797,"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":[],"created_at":"2024-11-10T00:16:21.433Z","updated_at":"2025-02-24T03:17:55.454Z","avatar_url":"https://github.com/mtulio.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-lab-api (WIP)\n\nDummy Go API to run labs behind AWS *LB.\n\nSupported protocols (both service and health-check servers):\n- TCP\n- TLS\n- HTTP\n- HTTPS\n\n## Lab Apps\n\n### Lab 'app-server'\n\n- Start App to bind servers `service` and `healtch-check` using different protocols (allowed: TCP, TLS, HTTP and HTTPS) and ports\n- Watch Target group\n- Send termination signal (default timeout 2 minutes)\n- observe the metrics\n\n### Lab 'k8sapi-watcher'\n\n- Handle signal to count whether the termination time have started\n- Pull /healthy and register the response code (bool)\n- Pull TG ARN healthy targets (bool)\n- Dump metrics\n\n### Lab 'bind-all'\n\n## Examples `app-server`\n\n## Service TCP and Health Check HTTPS\n\n- Run the app that will bind in service and health-check ports\n\n\n``` shell\nexport AWS_REGION=us-east-1\nexport APP=mrb-tcp-https\n\nTG_ARN=$(aws elbv2 describe-target-groups --region us-east-1 --query \"TargetGroups[?TargetGroupName == \\`${APP}\\`].TargetGroupArn\" --output text)\n\n./lab-app-server --app-name ${APP} \\\n  --service-port 6444 --service-proto tcp \\\n  --health-check-port 6443 --health-check-proto https \\\n  --cert-pem ./server.crt --cert-key ./server.key \\\n  --log-path ./${APP}.log \\\n  --watch-target-group-arn ${TG_ARN}\n```\n\n- Force to fail health check\n\n```\nkill -TERM $(pidof lab-app-server)\n```\n\n- Wait 120sec to unhealth be cleared\n\n- Collect the logs\n\n```\nfor IP in $IP_SRV; do scp ec2-user@${IP}:~/mrb-tcp-https.log examples/mrb-tcp-https-${IP}.log; done\n```\n\n- Create a CSV for the main metrics that is printed to stdout every 1s\n\n```\necho -e \"TIMESTAMP \\t APP_TERMINATION \\t APP_HEALTHY \\t TG_HEALTHY \\t TG_HEA_CNT \\t TG_UNH_CNT \\t REQ_HC_CNT\" \u003e examples/mrb-svc-tcp-hc-https.csv\njq -r '. |select ( .type == \"metrics\" ) | .msg ' examples/mrb-tcp-https-54.83.236.78-TERM.log |jq -r ' [ .time , .app_termination, .app_healthy, .tg_healthy, .tg_health_count , .tg_unhealth_count , .reqc_hc ] | @tsv ' \u003e\u003e examples/mrb-svc-tcp-hc-https.csv\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtulio%2Fgo-labs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtulio%2Fgo-labs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtulio%2Fgo-labs/lists"}