{"id":31834914,"url":"https://github.com/ayonious/docker-practice","last_synced_at":"2025-10-12T00:47:21.290Z","repository":{"id":317697570,"uuid":"1068316795","full_name":"ayonious/docker-practice","owner":"ayonious","description":"🐳 My practice of Docker and all common things related to docker","archived":false,"fork":false,"pushed_at":"2025-10-02T12:46:19.000Z","size":6625,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-02T14:39:59.322Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/ayonious.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-02T07:43:07.000Z","updated_at":"2025-10-02T12:46:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"e82a44f0-b8d4-4075-9eb8-894690395058","html_url":"https://github.com/ayonious/docker-practice","commit_stats":null,"previous_names":["ayonious/docker-practice"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ayonious/docker-practice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayonious%2Fdocker-practice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayonious%2Fdocker-practice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayonious%2Fdocker-practice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayonious%2Fdocker-practice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ayonious","download_url":"https://codeload.github.com/ayonious/docker-practice/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayonious%2Fdocker-practice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279009508,"owners_count":26084609,"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-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":"2025-10-12T00:47:20.203Z","updated_at":"2025-10-12T00:47:21.284Z","avatar_url":"https://github.com/ayonious.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-practice\n\nA multi-service application demonstrating Docker containerization with Node.js (Express) and Spring Boot services.\n\n## Architecture\n\nThis project consists of two microservices:\n\n1. **Express Service** (Node.js) - Port 3000\n   - REST API for user management\n   - Proxies product requests to Spring Boot service\n   - Endpoints: `/api/users`, `/api/products`\n\n2. **Spring Boot Service** (Java) - Port 8080\n   - REST API for product management\n   - Endpoints: `/api/products`, `/api/health`\n\nThe Express service calls the Spring Boot service to fetch product data, demonstrating inter-service communication.\n\n## Prerequisites\n\n- Download Docker from docker website and keep it running\n- Make sure you have docker-compose installed:\n   ```bash\n   brew install docker-compose\n   ```\n\n## Quick Start with Makefile\n\nThe project includes a Makefile with convenient shortcuts:\n\n```bash\nmake build     # Build all Docker images\nmake up        # Start all services\nmake down      # Stop all services\nmake restart   # Restart all services\nmake logs      # View logs from all services\nmake clean     # Remove all containers, images, and volumes\nmake test      # Run tests for Express service\n```\n\n## Manual Docker Compose Commands\n\n### Start both services:\n```bash\ndocker-compose up\n```\n\nTo run in detached mode:\n```bash\ndocker-compose up -d\n```\n\n### Stop the services:\n```bash\ndocker-compose down\n```\n\n### View logs:\n```bash\ndocker-compose logs -f\n```\n\n## API Endpoints\n\n### Express Service (http://localhost:3000)\n\n**User endpoints:**\n- `GET /api/users` - Get all users\n- `GET /api/users/:id` - Get user by ID\n- `POST /api/users` - Create new user (body: `{name, email}`)\n\n**Product endpoints (proxied to Spring Boot):**\n- `GET /api/products` - Get all products\n- `GET /api/products/:id` - Get product by ID\n- `POST /api/products` - Create new product (body: `{name, price}`)\n\n**Health check:**\n- `GET /health`\n\n### Spring Boot Service (http://localhost:8080)\n\n- `GET /api/products` - Get all products\n- `GET /api/products/:id` - Get product by ID\n- `POST /api/products` - Create new product\n- `GET /api/health` - Health check\n\n## Testing\n\nTest the services with curl:\n\n```bash\n# Check Express service health\ncurl http://localhost:3000/health\n\n# Get users from Express\ncurl http://localhost:3000/api/users\n\n# Get products (Express proxies to Spring Boot)\ncurl http://localhost:3000/api/products\n\n# Create a product via Express\ncurl -X POST http://localhost:3000/api/products \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"Monitor\",\"price\":299.99}'\n```\n\n## Troubleshooting\n\nIf you get a \"port already in use\" error:\n```bash\n# For port 3000\nlsof -i :3000\nkill {processNo}\n\n# For port 8080\nlsof -i :8080\nkill {processNo}\n```\n\n## Environment Variables\n\n**Express Service:**\n- `NODE_ENV`: Set to `production` by default\n- `PORT`: Service port (default: 3000)\n- `SPRINGBOOT_SERVICE_URL`: URL of Spring Boot service (default: http://springboot-service:8080)\n\n**Spring Boot Service:**\n- `SPRING_PROFILES_ACTIVE`: Set to `prod` by default\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayonious%2Fdocker-practice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fayonious%2Fdocker-practice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayonious%2Fdocker-practice/lists"}