{"id":17967200,"url":"https://github.com/lahcenezzara/composedemo","last_synced_at":"2026-04-05T20:31:41.077Z","repository":{"id":259425249,"uuid":"877843319","full_name":"LahcenEzzara/composedemo","owner":"LahcenEzzara","description":"Lab: Setting up a Multi-Container Architecture with Docker Compose","archived":false,"fork":false,"pushed_at":"2024-10-24T10:43:49.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T09:29:16.531Z","etag":null,"topics":["api","backend","cloud","containerization","devops","docker","docker-compose","dockerfile","flask","microservices","multi-container","python","python3","redis","scalable-architecture","web-application","web-server"],"latest_commit_sha":null,"homepage":"https://lahcenezzara.github.io/composedemo/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LahcenEzzara.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":"2024-10-24T10:41:45.000Z","updated_at":"2024-10-24T10:47:00.000Z","dependencies_parsed_at":"2024-10-25T09:14:05.583Z","dependency_job_id":null,"html_url":"https://github.com/LahcenEzzara/composedemo","commit_stats":null,"previous_names":["lahcenezzara/composedemo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LahcenEzzara%2Fcomposedemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LahcenEzzara%2Fcomposedemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LahcenEzzara%2Fcomposedemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LahcenEzzara%2Fcomposedemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LahcenEzzara","download_url":"https://codeload.github.com/LahcenEzzara/composedemo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247081330,"owners_count":20880408,"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":["api","backend","cloud","containerization","devops","docker","docker-compose","dockerfile","flask","microservices","multi-container","python","python3","redis","scalable-architecture","web-application","web-server"],"created_at":"2024-10-29T14:04:32.734Z","updated_at":"2025-12-30T23:09:02.511Z","avatar_url":"https://github.com/LahcenEzzara.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker Compose Flask \u0026 Redis App\n\nThis project demonstrates a simple Python web application built with Flask and Redis, using Docker Compose to set up a multi-container architecture.\n\n## Project Structure\n\n```\ncomposedemo/\n│\n├── app.py                # Flask application\n├── Dockerfile            # Dockerfile to build the web app\n├── docker-compose.yml    # Docker Compose configuration\n└── requirements.txt      # Python dependencies\n```\n\n## Prerequisites\n\n- Docker installed on your machine.\n- Docker Compose installed.\n\n## Getting Started\n\nFollow these steps to set up and run the project locally.\n\n### 1. Clone the Repository\n```bash\ngit clone https://github.com/LahcenEzzara/composedemo.git\ncd composedemo\n```\n\n### 2. Define the Flask Application\n\nThe main Flask application logic is in `app.py`. It uses Redis to count the number of times the page has been accessed.\n\n### 3. Define Dependencies\n\nThe `requirements.txt` file lists the necessary dependencies for the Flask app:\n```\nflask\nredis\n```\n\n### 4. Build and Run the Containers\n\nUse Docker Compose to build and run the application:\n```bash\ndocker compose up\n```\n\nThe application will be accessible at [http://localhost:8000](http://localhost:8000). Every time you refresh the page, the counter increments.\n\n### 5. Stop the Application\n\nTo stop the running containers, use the following command:\n```bash\ndocker compose down\n```\n\n## Updating the Application\n\nThe `docker-compose.yml` file includes a bind mount that allows live updates to the code. Any changes made to the `app.py` file will automatically apply to the running container without needing to rebuild the image.\n\nIf you modify the code, simply refresh the page to see the changes:\n```python\nreturn 'Hello from Docker! I was here {} times.\\n'.format(count)\n```\n\n## File Descriptions\n\n### `app.py`\nA simple Flask application that connects to Redis to count the number of hits on the page.\n\n### `Dockerfile`\nDefines how to build the Docker image for the Flask application:\n- Uses Python 3.7 Alpine.\n- Installs necessary dependencies from `requirements.txt`.\n- Exposes port 5000 for the Flask app to run.\n\n### `docker-compose.yml`\nSets up two services:\n- **web**: Runs the Flask application.\n- **redis**: Uses the official Redis Alpine image.\n\n### `requirements.txt`\nSpecifies the Python dependencies for the Flask app:\n- `flask`\n- `redis`\n\n## Rebuild the Application\n\nIf you need to rebuild the application after making changes, you can do so with:\n```bash\ndocker compose up --build\n```\n\n## License\n\nThis project is open source and available under the [MIT License](LICENSE).\n\n---\n\nHappy coding! 🎉","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flahcenezzara%2Fcomposedemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flahcenezzara%2Fcomposedemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flahcenezzara%2Fcomposedemo/lists"}