{"id":48829336,"url":"https://github.com/paulopatto/multiport-nodejs","last_synced_at":"2026-04-14T19:33:17.663Z","repository":{"id":268201837,"uuid":"903554237","full_name":"paulopatto/multiport-nodejs","owner":"paulopatto","description":"A sample application to run in k8s \u0026 GKE","archived":false,"fork":false,"pushed_at":"2025-08-09T18:50:54.000Z","size":42,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T20:16:51.005Z","etag":null,"topics":["github-actions","gke","k8s-deployment","webapp"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/paulopatto/multiport-nodejs","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paulopatto.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,"zenodo":null}},"created_at":"2024-12-14T22:34:40.000Z","updated_at":"2025-08-09T18:50:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"66662eb9-ef74-4251-9e49-1b796d28a97e","html_url":"https://github.com/paulopatto/multiport-nodejs","commit_stats":null,"previous_names":["paulopatto/multiport-nodejs"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/paulopatto/multiport-nodejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulopatto%2Fmultiport-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulopatto%2Fmultiport-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulopatto%2Fmultiport-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulopatto%2Fmultiport-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paulopatto","download_url":"https://codeload.github.com/paulopatto/multiport-nodejs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulopatto%2Fmultiport-nodejs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31812969,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T18:05:02.291Z","status":"ssl_error","status_checked_at":"2026-04-14T18:05:01.765Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["github-actions","gke","k8s-deployment","webapp"],"created_at":"2026-04-14T19:33:15.553Z","updated_at":"2026-04-14T19:33:17.651Z","avatar_url":"https://github.com/paulopatto.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multi-Port Node.js Application\n\n## Overview\n\nThis is a multi-port Node.js application designed to demonstrate a microservice-like architecture running on Kubernetes, with support for local development and deployment.\n\n## Pre-requisites\n\n- Node.js (v18.x or later)\n- npm (v9.x or later)\n- Docker\n- Kubernetes CLI (kubectl)\n- Minikube (for local development, optional)\n- Google Cloud SDK (for GKE deployment, optional)\n\n## Local Development Setup\n\n**1. Clone the Repository**\n\n```bash\ngit clone https://github.com/paulopatto/multiport-nodejs-app.git\ncd multiport-nodejs-app\n```\n\n**2. Install Dependencies**\n\n```bash\n# Install project dependencies\nnpm install\n```\n\n**3. Run Locally**\n\n```bash\n# Run the application\nnode app.js # or via nodemon\n\n# Application will be available on ports:\n# - 8080 (Main service)\n# - 8000 (Metrics service)\n# - 9000 (Admin service)\n```\n\n## Docker Build\n\n```bash\n# Build Docker image\ndocker build -t multiport-nodejs:v1.0.0 .\n\n# Run Docker container\ndocker run -p 8080:8080 -p 8000:8000 -p 9000:9000 multiport-nodejs:v1.0.0\n```\n\n## Kubernetes Deployment\n\n### Local Minikube Deployment\n\n**1. Start Minikube**\n\n```bash\nminikube start\n```\n\n**2. Build and Load Docker Image**\n\n```bash\n# Build image\ndocker build -t multiport-nodejs:v1.0.0 .\n\n# Load image to Minikube\nminikube image load multiport-nodejs:v1.0.0\n```\n\n**3. Deploy to Kubernetes**\n\n```bash\n# Apply Kubernetes manifests\nkubectl apply -f k8s-deployment.yaml\nkubectl apply -f k8s-ingress.yaml\n```\n\n### Using Ingress NGINX Controller\n\nGiven our architecture's need to manage multiple services independently, a [reverse proxy](https://www.cloudflare.com/learning/cdn/glossary/reverse-proxy/) is an ideal choice. Essentially, a reverse proxy acts as a routing server.\nNGINX is a widely used tool for this purpose. To streamline our setup, we'll utilize a pre-built service called nginx-ingress-controller (found at https://github.com/kubernetes/ingress-nginx/). For detailed installation steps, refer to https://kubernetes.github.io/ingress-nginx/deploy/#quick-start.\n\n#### Enable ingress nginx controller via minikube addon\n\n```bash\nminikube addons enable ingress\n```\n\nor via manifest\n\n```bash\nkubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.12.0-beta.0/deploy/static/provider/cloud/deploy.yaml\n```\n\n#### Local testing (with nginx ingress controller)\n\nCreate an ingress resource. The following example uses a host that maps to `localhost`. Apply `nginx-ingress.yaml` with:\n\n```bash\nkubectl apply -f nginx-ingress.yaml\n```\n\nAlso config forward a local port to the ingress controller:\n\n```bash\n# Port-forward for port 8080\nkubectl port-forward -n multiport service/multiport-nodejs-service 8080:8080 \u0026\n\n# Port-forward for port 8000\nkubectl port-forward -n multiport service/multiport-nodejs-service 8000:8000 \u0026\n\n# Port-forward for port 9000\nkubectl port-forward -n multiport service/multiport-nodejs-service 9000:9000 \u0026\n```\n\nAt this point, you can access your deployment using\n\n**curl**\n\n```bash\ncurl --resolve multiport.local.dev:8080:127.0.0.1 http://multiport.local.dev:8080\ncurl --resolve multiport.local.dev:8000:127.0.0.1 http://multiport.local.dev:8000\ncurl --resolve multiport.local.dev:9000:127.0.0.1 http://multiport.local.dev:9000\n```\n\n**browser**\n\n- http://localhost:8080/\n- http://localhost:8000/\n- http://localhost:9000/\n\n\u003e **Additional Step(optional)**: Update the `/etc/hosts` file to resolve the local domain:\n\u003e\n\u003e `127.0.0.1 multiport.local.dev`\n\nor if the hosts configured the service can be accessed in:\n\n- http://multiport.local.dev/ (port 8080)\n- http://multiport.local.dev/metrics (port 8000)\n- http://multiport.local.dev/admin (port 9000)\n\nTo stop the port-forward processes, you can use:\n\n```bash\n# List background jobs\njobs\n\n# List jobs filterde by port-forward\nps aux | grep port-forward\n\n\n# Kill specific job by job number\nkill %1\nkill %2\nkill %3\n```\n\n## GKE Deployment\n\n1. Authenticate and Set Project\n\n```bash\n# Login to GCP\ngcloud auth login\n\n# Set your project\ngcloud config set project $PROJECT_ID\n\n# (Optional)\ngcloud containers clusters create multiport-cluster\n```\n\n2. Build and push docker image to registry\n\n```bash\ndocker build -t paulopatto/multiport-nodejs:$VERSION .\ndocker push paulopatto/multiport-nodejs:$VERSION\n```\n\n4. Deploy to GKE\n\n```bash\nkubectl apply -f manifest.k8s.yaml\n```\n\nCan check resources with:\n\n```bash\nkubectl get -n multiport deployments\nkubectl get -n multiport services\nkubectl get -n multiport pods\n\n# OR just\n\nkubectls get all -n multiport\n```\n\nThe LoadBalancer service will provide external IP addresses use `kubectl get services` to find the external IPs\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch (git checkout -b feature/AmazingFeature)\n3. Make your changes\n4. Commit your changes (git commit -m 'Add some AmazingFeature')\n5. Push to the branch (git push origin feature/AmazingFeature)\n6. Open a Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulopatto%2Fmultiport-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaulopatto%2Fmultiport-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulopatto%2Fmultiport-nodejs/lists"}