{"id":22083642,"url":"https://github.com/dockerbound-immortal/infrastructure","last_synced_at":"2026-04-13T21:31:31.193Z","repository":{"id":202140590,"uuid":"614499646","full_name":"Dockerbound-Immortal/Infrastructure","owner":"Dockerbound-Immortal","description":"Generic Infrastructure container, this can be used with any project to quickly set up a Postgres Database and Nginx Gateway.","archived":false,"fork":false,"pushed_at":"2023-03-15T22:17:00.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T22:35:29.207Z","etag":null,"topics":["adminer","api-gateway","docker","nginx","postgresql","reverse-proxy"],"latest_commit_sha":null,"homepage":"","language":"Makefile","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/Dockerbound-Immortal.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}},"created_at":"2023-03-15T17:55:48.000Z","updated_at":"2023-03-15T22:13:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"cea48521-6d26-4d7b-941a-460f2fb34155","html_url":"https://github.com/Dockerbound-Immortal/Infrastructure","commit_stats":null,"previous_names":["dockerbound-immortal/infrastructure"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/Dockerbound-Immortal/Infrastructure","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dockerbound-Immortal%2FInfrastructure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dockerbound-Immortal%2FInfrastructure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dockerbound-Immortal%2FInfrastructure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dockerbound-Immortal%2FInfrastructure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dockerbound-Immortal","download_url":"https://codeload.github.com/Dockerbound-Immortal/Infrastructure/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dockerbound-Immortal%2FInfrastructure/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31771803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T20:17:16.280Z","status":"ssl_error","status_checked_at":"2026-04-13T20:17:08.216Z","response_time":93,"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":["adminer","api-gateway","docker","nginx","postgresql","reverse-proxy"],"created_at":"2024-12-01T00:16:45.656Z","updated_at":"2026-04-13T21:31:31.151Z","avatar_url":"https://github.com/Dockerbound-Immortal.png","language":"Makefile","readme":"# Infrastructure\n\nThis project is a generic infrastructure configuration utilising `Docker` you can use this with any project to get a database and `nginx` gateway configured with minimal effort, `adminer` is also provided as a means to interact with the database.\n\n# Why use an Nginx gateway?\n\nFirst of all what is an API gateway? in simple terms it is essentially a specific method of using a reverse proxy. In this project template we use an `Nginx` configuration as a reverse proxy to control traffic within our own internal network. This is a very simple implementation but you have the benefit of having your application hidden behind an additional layer, this means only endpoints within our `Nginx` config will be exposed to the end user, even if we make a mistake on our internal network and accidentally expose more ports than necessary. From this we have less of a concern when having our `services` communicate on their internal network.\n\nTo learn more there is a great article [here](https://www.nginx.com/blog/building-microservices-using-an-api-gateway/).\n\n# How To Use\n\nIt's as simple as I could make it! all you need to do is update the `nginx.conf` with your own applications\nconfiguration, note that this does rely on your application being `dockerised` as the network being used is a\n`docker` network.\n\nFirstly, you should uncomment the proxy pass line in the config and remove the returns. These returns are here only to test the container itself builds correctly.\n\n```\nserver {\n    listen 80;\n\n    server_name localhost;\n\n     access_log  /var/log/nginx/access.log;\n     error_log   /var/log/nginx/error.log;\n\n    location / {\n        proxy_set_header Host $http_host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n        proxy_http_version 1.1;\n        proxy_set_header Connection $http_connection;\n        proxy_set_header Upgrade $http_upgrade;\n        proxy_set_header Sec-WebSocket-Extensions $http_sec_websocket_extensions;\n        proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key;\n        proxy_set_header Sec-WebSocket-Version $http_sec_websocket_version;\n        proxy_cache_bypass $http_upgrade;\n        proxy_read_timeout 900;\n        client_max_body_size 0;\n        proxy_buffering off;\n        add_header X-Accel-Buffering no;\n\n        proxy_pass http://app-client:3000/;\n    }\n\n    location /api/ {\n        proxy_pass http://app-api:3001/;\n        proxy_set_header Host $host;\n    }\n}\n```\n\nYou then likely want to change the proxy_pass `URL` to route the traffic to your own services. This initial setup is assuming a simplistic setup of only two services (a client and an api), you can expand this by adding more `location` configurations or simply run this on a per-app basis with another `reverse-proxy` routing overall traffic, this can be done through a larger docker network.\n\nFor a simple setup simply change the `app-client` and `app-api` to the name of your service containers along with the ports they are operating on, docker will handle all of the routing on the network for us.\n\nYou will of course need to add the network defined in the `docker-compose` file to your own services networks too.\n\nYou could add the default `microservice-network` to your existing services networks in their `docker-compose.yml` or you could update the name to match an existing network in your files. Alternatively you could even place this infrastructure folder in your actual service:\n\n```\nproject/services/infrastructure/docker-compose.yml\nproject/services/infrastructure/db/init.sql\nproject/services/infrastructure/nginx/nginx.conf\n\nproject/services/service1/\nproject/services/service2/\n```\n\nand then have another overarching infrastructure in the root of the project which handles the overall routing between these services. This will take quite a bit of additional configuration as you will essentially have a reverse proxy forwarding traffic upstream to another reverse proxy. \n\n# How should I use this in my project?\n\nPersonally, I would pull this into the root of a project. My own project configurations would be something like this:\n\n```\nproject/services/Makefile\nproject/infrastructure/docker-compose.yml\nproject/infrastructure/db/init.sql\nproject/infrastructure/nginx/nginx.conf\n\nproject/services/service1/\nproject/services/service2/\n```\n\nYou will\n\n# Testing\n\nTo test the container manually on the first run you can simply run `docker-compose up --build -d`. You can then traverse to `localhost:8080/` and `localhost:8080/api/`\nyou should receive a download, upon opening the file in a text editor you should see the words `Hello Client` or `Hello API` respectively. This means our routing is working as expected.\n\n# How to start the services?\n\nYou can simply run the `Makefile`, if you want this file in the root of your own project simply move it and change the path to the docker-compose files in the variables at the top.\n\nYou can see a fullstack example project template: [here](https://github.com/Dockerbound-Immortal/Infrastructure).\n\n# Versions\n- `Docker` : 3.8\n- `Postgres` : 15.2\n- `Adminer` : latest\n- `Nginx` : 1.23.3\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdockerbound-immortal%2Finfrastructure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdockerbound-immortal%2Finfrastructure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdockerbound-immortal%2Finfrastructure/lists"}