{"id":18947643,"url":"https://github.com/yousafkhamza/ipstack-containerization-with-nginx-lb","last_synced_at":"2026-05-01T12:33:19.684Z","repository":{"id":195965547,"uuid":"387097956","full_name":"yousafkhamza/ipstack-containerization-with-nginx-lb","owner":"yousafkhamza","description":"It's a sample IP location finding the website and that the website fetched the data from ipstack website. Aso, I have containerized this website and also, I included Nginx and Redis containers. Redis act as a cache and Nginx act as a load balancer server because we are using three ipstack containers for efficient working. Also, you can easily set up these containers in your environment because I wrote the above details as a docker-compose. Furthermore, the website is created using python and it's just a demonstration.","archived":false,"fork":false,"pushed_at":"2021-07-30T12:06:42.000Z","size":40,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-02T17:47:19.961Z","etag":null,"topics":["containers","docker","docker-compose","iplocation","ipstack-api","nginx","nginx-load-balancer","redis-cache"],"latest_commit_sha":null,"homepage":"","language":null,"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/yousafkhamza.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":"2021-07-18T05:28:24.000Z","updated_at":"2021-09-10T06:34:04.000Z","dependencies_parsed_at":"2023-09-20T20:13:36.150Z","dependency_job_id":null,"html_url":"https://github.com/yousafkhamza/ipstack-containerization-with-nginx-lb","commit_stats":null,"previous_names":["yousafkhamza/ipstack-containerization-with-nginx-lb"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yousafkhamza/ipstack-containerization-with-nginx-lb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yousafkhamza%2Fipstack-containerization-with-nginx-lb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yousafkhamza%2Fipstack-containerization-with-nginx-lb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yousafkhamza%2Fipstack-containerization-with-nginx-lb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yousafkhamza%2Fipstack-containerization-with-nginx-lb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yousafkhamza","download_url":"https://codeload.github.com/yousafkhamza/ipstack-containerization-with-nginx-lb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yousafkhamza%2Fipstack-containerization-with-nginx-lb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32497812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"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":["containers","docker","docker-compose","iplocation","ipstack-api","nginx","nginx-load-balancer","redis-cache"],"created_at":"2024-11-08T13:10:49.224Z","updated_at":"2026-05-01T12:33:19.663Z","avatar_url":"https://github.com/yousafkhamza.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# IP-Location finding website containerization with Nginx LoadBalancing.\n[![Build](https://travis-ci.org/joemccann/dillinger.svg?branch=master)](https://travis-ci.org/joemccann/dillinger)\n\n---\n## Description\nIt's a sample IP location finding website and that the website fetched the data from ipstack website. Aso, I have containerized this website and also, I included Nginx and Redis containers. Redis act as a cache and Nginx act as a load balancer server because we are using three ipstack containers for efficient working. Also, you can easily set up these containers into your environment because I wrote the above details as a docker-compose. Furthermore, the website is created using python and it's just a demonstration. \n\n----\n## Feature\n- IP-Location finding website (Python) (Just a demonstration)\n- Easy to migrate everywhere \n- Container load balanced (Nginx)\n- All containers are spin up with a single command\n\n---\n## Includes\n- 5 Containers for LAMP (IP-Stack, Redis, Nginx(Load Balancer))\n- 1 Network (For Container interconnecting)\n\n----\n## Pre-Requests\n- Need to install docker and docker-compose\n- You have a basic knowledge of what is docker.\n- You have a basic knowledge of what is ipstack and how it's working\n- Need an IP stack Login and API for location finding\n- Need to add apikey file before running the script. So, please find the IP stack URL and grab the key and change the same on \"env.dev\" \n\n-----\n## How to install docker, docker-compose.\n### Docker installation \nPlease refer the doc for [docker installation](https://docs.docker.com/engine/install)\n\n```sh\nyum install docker -y\nyum install git -y\n```\n### docker-compose installation\nPlease refer the doc for [docker-compose installation](https://docs.docker.com/compose/install/)\n```sh\nsudo curl -L \"https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)\" -o /usr/bin/docker-compose\nsudo chmod +x /usr/bin/docker-compose\ndocker-compose version \n```\n\u003e you guys can use [play with Docker](https://labs.play-with-docker.com/) which includes pre-installed docker and compose. It looks like a terminal and it's built from alpine OS. So, it's just used for learning purpose so who you guys can use 4hrs session without any additional installation.\n\n## How to get IPstack API\n\u003e Please go through the [ipstack](https://ipstack.com/) and click \"_GET FREE API KEY_\" on the top right corner. \n![alt text](https://i.ibb.co/FJwjZWP/ipstack.png)\n\n_vim env.dev_\n```sh\nIPSTACK_KEY=\"enter-your-key-here(without any double quotes)\"\n```\n\n----\n## How to use\n```sh\ngit clone https://github.com/yousafkhamza/ipstack-containerization-with-nginx-lb.git\ncd ipstack-containerization-with-nginx-lb.git\ndocker-compose --env-file env.dev up -d\n```\n\n----\n## Output be like\n```sh\n$ docker-compose --env-file env.dev up -d\nCreating network \"ipstack-containerization-with-nginx-lb_ipstack\" with the default driver\nPulling nginxlb (nginx:alpine)...\nalpine: Pulling from library/nginx\n5843afab3874: Pull complete\n0dc18a5274f2: Pull complete\n48a0ee941dcd: Pull complete\n2446243a1a3f: Pull complete\ncbf0756b41fb: Pull complete\nc72750a979b9: Pull complete\nDigest: sha256:91528597e842ab1b3b25567191fa7d4e211cb3cc332071fa031cfed2b5892f9e\nStatus: Downloaded newer image for nginx:alpine\nPulling redis (redis:latest)...\nlatest: Pulling from library/redis\nb4d181a07f80: Pull complete\n86e428f79bcb: Pull complete\nba0d0a025810: Pull complete\nba9292c6f77e: Pull complete\nb96c0d1da602: Pull complete\n5e4b46455da3: Pull complete\nDigest: sha256:b6a9fc3535388a6fc04f3bdb83fb4d9d0b4ffd85e7609a6ff2f0f731427823e3\nStatus: Downloaded newer image for redis:latest\nPulling ipstack1 (yousafkhamza/ipstack:latest)...\nlatest: Pulling from yousafkhamza/ipstack\n921b31ab772b: Pull complete\n1a0c422ed526: Pull complete\nec0818a7bbe4: Pull complete\nb53197ee35ff: Pull complete\n8b25717b4dbf: Pull complete\nacafaa4494be: Pull complete\nc17f91a4a471: Pull complete\nbac07450eb17: Pull complete\nDigest: sha256:99ece38dc66fbdadc69a65e63f5b9d330ecfc2681a7a8819cf464180e87747c5\nStatus: Downloaded newer image for yousafkhamza/ipstack:latest\nCreating nginx    ... done\nCreating redis ... done\nCreating ipstack2 ... done\nCreating ipstack1 ... done\nCreating ipstack3 ... done\n```\n_Containers list_\n```sh\n$ docker-compose ps\n  Name                Command               State         Ports       \n----------------------------------------------------------------------\nipstack1   python3 app.py                   Up                        \nipstack2   python3 app.py                   Up                        \nipstack3   python3 app.py                   Up                        \nnginx      /docker-entrypoint.sh ngin ...   Up      0.0.0.0:80-\u003e80/tcp\nredis      docker-entrypoint.sh redis ...   Up      6379/tcp \n```\n\n----\n## How to use ipstack website after compose up (screenshots)\n\u003e _Load your site with your server_ip:80_ \n![alt text](https://i.ibb.co/8d90FRw/Screenshot-8.png)\n\n\u003e _Add an IP which you need to find the location. (result like this)\n![alt text](https://i.ibb.co/k9qrcDH/Screenshot-7.png)\n\n----\n## Architecture\n![alt text](https://i.ibb.co/YfBgRDn/docker-ipstack.jpg)\n\n----\n## Behind the code\n_vim docker-compose.yml_\n```sh\nversion: '3'\nservices:\n\n  nginxlb:\n    image: nginx:alpine\n    container_name: nginx\n    restart: always\n    ports:\n      - \"80:80\"\n    networks:\n      - ipstack\n    volumes:\n      - ./nginx.conf:/etc/nginx/nginx.conf\n\n  redis:\n    image: redis:latest\n    container_name: redis\n    restart: always\n    networks:\n      - ipstack\n\n  ipstack1:\n    image: yousafkhamza/ipstack:latest\n    container_name: ipstack1\n    restart: always\n    depends_on:\n      - redis\n    networks:\n      - ipstack\n    environment:\n      CACHING_SERVER: redis \n      IPSTACK_KEY: \"${IPSTACK_KEY}\"\n\n  ipstack2:\n    image: yousafkhamza/ipstack:latest\n    container_name: ipstack2\n    restart: always\n    depends_on:\n      - redis\n    networks:\n      - ipstack\n    environment:\n      CACHING_SERVER: redis \n      IPSTACK_KEY: \"${IPSTACK_KEY}\"\n\n  ipstack3:\n    image: yousafkhamza/ipstack:latest\n    container_name: ipstack3\n    restart: always\n    depends_on:\n      - redis\n    networks:\n      - ipstack\n    environment:\n      CACHING_SERVER: redis \n      IPSTACK_KEY: \"${IPSTACK_KEY}\"\n           \nnetworks:\n  ipstack:\n```\n_vim nginx.conf_ (work like as a container load balancer)\n```sh\nevents {\n    worker_connections   1000;\n}\n\nhttp {\n   upstream backend {\n     server ipstack1;\n     server ipstack2;\n     server ipstack3;\n   }\n\n   server {\n       \n      listen 80; \n      location / {\n          proxy_pass http://backend;\n      }\n   }\n}\n```\n_vim env.dev_\n```sh\nIPSTACK_KEY=a37f9a05417225606d66         \u003c----------- please replace your ipstack apikey\n```\n\n----\n## Conclusion\nit's a sample IP-location website and anyone can easy to set up this iplocation project on your environment with the help of docker-compose and containerization. Also, this project includes 3 IP-location lookup (ipstack) containers for effectivly working and that can handle more clients, and that three containers datas store/fetch to a common cache server (Redis). Also, the 3 containers are connected with an Nginx server, and that server act as a load balancer, and this server is only connected with the outside world.\n\n### ⚙️ Connect with Me \n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"mailto:yousaf.k.hamza@gmail.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/Gmail-D14836?style=for-the-badge\u0026logo=gmail\u0026logoColor=white\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://www.linkedin.com/in/yousafkhamza\"\u003e\u003cimg src=\"https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge\u0026logo=linkedin\u0026logoColor=white\"/\u003e\u003c/a\u003e \n\u003ca href=\"https://www.instagram.com/yousafkhamza\"\u003e\u003cimg src=\"https://img.shields.io/badge/Instagram-E4405F?style=for-the-badge\u0026logo=instagram\u0026logoColor=white\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://wa.me/%2B917736720639?text=This%20message%20from%20GitHub.\"\u003e\u003cimg src=\"https://img.shields.io/badge/WhatsApp-25D366?style=for-the-badge\u0026logo=whatsapp\u0026logoColor=white\"/\u003e\u003c/a\u003e\u003cbr /\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyousafkhamza%2Fipstack-containerization-with-nginx-lb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyousafkhamza%2Fipstack-containerization-with-nginx-lb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyousafkhamza%2Fipstack-containerization-with-nginx-lb/lists"}