{"id":23673987,"url":"https://github.com/wlanboy/goservice","last_synced_at":"2025-12-23T04:30:25.029Z","repository":{"id":77581522,"uuid":"220954527","full_name":"wlanboy/goservice","owner":"wlanboy","description":"Golang Rest service based on gorilla, gorm using Spring cloud config and PostgreSql","archived":false,"fork":false,"pushed_at":"2024-09-15T03:59:10.000Z","size":132,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-29T12:58:12.216Z","etag":null,"topics":["cloud-config","go","godotenv","golang","gorilla-mux","gorm","gorm-orm","pg","spring-cloud-config"],"latest_commit_sha":null,"homepage":"","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/wlanboy.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-11T10:19:02.000Z","updated_at":"2024-09-15T03:59:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"89b4d3d4-f447-4bdd-8ce7-c7df65294b2f","html_url":"https://github.com/wlanboy/goservice","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wlanboy%2Fgoservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wlanboy%2Fgoservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wlanboy%2Fgoservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wlanboy%2Fgoservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wlanboy","download_url":"https://codeload.github.com/wlanboy/goservice/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239706086,"owners_count":19683785,"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":["cloud-config","go","godotenv","golang","gorilla-mux","gorm","gorm-orm","pg","spring-cloud-config"],"created_at":"2024-12-29T12:58:23.333Z","updated_at":"2025-12-23T04:30:24.694Z","avatar_url":"https://github.com/wlanboy.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Go](https://github.com/wlanboy/goservice/workflows/Go/badge.svg?branch=main)\n\n# goservice\nGolang Rest service based on gorilla, gorm using Spring cloud config and PostgreSql\n\n# using\n- \"context\"\n- \"os\"\n- \"os/signal\"\n- \"syscall\"\n- \"fmt\"\n- \"time\"\n- \"net/http\"\n- \"net/http/httputil\"\n- \"log\"\n- \"encoding/json\"\n- \"github.com/gorilla/mux\"\n- \"github.com/gorilla/handlers\"\n- \"github.com/jinzhu/gorm\"\n- \"github.com/jinzhu/gorm/dialects/postgres\"\n- \"github.com/jinzhu/gorm/dialects/sqlite\"\n- \"github.com/satori/go.uuid\"\n- \"github.com/joho/godotenv\"\n- \"github.com/prometheus/client_golang/prometheus/promhttp\"\n\n# build\n* go get -d -v\n* go clean\n* go build\n\n# build windows\n* install https://jmeubank.github.io/tdm-gcc/\n* go get github.com/mattn/go-sqlite3 in windows shell\n\n# depends on\n* PostgreSQL instance: https://github.com/wlanboy/Dockerfiles/tree/master/Postgres\n\n# run\n* go run main.go\n\n# debug\n* go get -u github.com/go-delve/delve/cmd/dlv\n* dlv debug ./goservice\n\n# dockerize (docker image size is 9.89MB)\n* GOOS=linux GOARCH=386 go build (386 needed for busybox)\n* GOOS=linux GOARCH=arm GOARM=6 go build (Raspberry Pi build)\n* GOOS=linux GOARCH=arm64 go build (Odroid C2 build)\n* docker build -t goservice .\n\n## Docker publish to github registry\n- docker tag goservice:latest docker.pkg.github.com/wlanboy/goservice/goservice:latest\n- docker push docker.pkg.github.com/wlanboy/goservice/goservice:latest\n\n## Docker Hub\n- https://hub.docker.com/r/wlanboy/goservice\n\n## Docker Registry repro\n- https://github.com/wlanboy/goservice/packages/278503\n\n# run docker container\n*docker run -d -p 8000:8000 goservice\n\n# Kubernets deployment\n\n## Prepare\n```\ncd ~\ngit clone https://github.com/wlanboy/goservice.git\n```\n\n## check you local kubectl\n```\nkubectl cluster-info\nkubectl get pods --all-namespaces\n```\n\n## deploy service on new namespace\n```\ncd ~/goservice\nkubectl create namespace go\nkubectl apply -f goservice-deployment.yaml\nkubectl apply -f goservice-service.yaml\nkubectl get pods -n go -o wide\n```\n\n## check deployment and service\n```\nkubectl describe deployments -n go goservice \nkubectl describe services -n gp goservice-service\n```\n\n## expose service and get node port\n```\nkubectl expose deployment -n go goservice --type=NodePort --name=goservice-serviceexternal --port 8000\nkubectl describe services -n go goservice-serviceexternal \n```\nResult:\n```\nName:                     goservice-serviceexternal\nNamespace:                go\nLabels:                   app=goservice\nAnnotations:              \u003cnone\u003e\nSelector:                 app=goservice\nType:                     NodePort\nIP Family Policy:         SingleStack\nIP Families:              IPv4\nIP:                       10.108.40.139\nIPs:                      10.108.40.139\nPort:                     \u003cunset\u003e  8000/TCP\nTargetPort:               8002/TCP\nNodePort:                 \u003cunset\u003e  30413/TCP  \u003c--- THIS IS THE PORT WE NEED\nEndpoints:                10.10.0.8:8000\nSession Affinity:         None\nExternal Traffic Policy:  Cluster\nEvents:                   \u003cnone\u003e\n```\n\n##  call microservice\n* curl http://192.168.56.100:30413/api/v1/event \n\n# create event\n* curl -X POST http://127.0.0.1:8000/api/v1/event -H 'Content-Type: application/json' -d '{\"name\": \"test\", \"type\": \"info\"}'\n# get all events\n* curl -X GET http://127.0.0.1:8000/api/v1/event \n# get prometheus metrics\n* curl -X GET http://127.0.0.1:8000/metrics\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwlanboy%2Fgoservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwlanboy%2Fgoservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwlanboy%2Fgoservice/lists"}