{"id":29633595,"url":"https://github.com/shawiizz/devops-framework","last_synced_at":"2025-07-21T14:05:30.990Z","repository":{"id":291247223,"uuid":"970979189","full_name":"Shawiizz/devops-framework","owner":"Shawiizz","description":"DevOps CI \u0026 CD Framework","archived":false,"fork":false,"pushed_at":"2025-07-20T00:43:27.000Z","size":136,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-20T02:51:40.499Z","etag":null,"topics":["ansible","cd","ci","deployment"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/Shawiizz.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":"2025-04-22T20:32:57.000Z","updated_at":"2025-07-20T00:43:24.000Z","dependencies_parsed_at":"2025-06-01T22:31:32.425Z","dependency_job_id":"eb37046b-274a-4a55-9c5e-7e5f9e5f89b4","html_url":"https://github.com/Shawiizz/devops-framework","commit_stats":null,"previous_names":["shawiizz/devops","shawiizz/devops-framework"],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/Shawiizz/devops-framework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shawiizz%2Fdevops-framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shawiizz%2Fdevops-framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shawiizz%2Fdevops-framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shawiizz%2Fdevops-framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shawiizz","download_url":"https://codeload.github.com/Shawiizz/devops-framework/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shawiizz%2Fdevops-framework/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266315763,"owners_count":23909802,"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-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["ansible","cd","ci","deployment"],"created_at":"2025-07-21T14:05:24.898Z","updated_at":"2025-07-21T14:05:30.974Z","avatar_url":"https://github.com/Shawiizz.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# DevOps Deployment Framework\n\n![Docker](https://img.shields.io/badge/Docker-2496ED?style=for-the-badge\u0026logo=docker\u0026logoColor=white)\n![Ansible](https://img.shields.io/badge/Ansible-EE0000?style=for-the-badge\u0026logo=ansible\u0026logoColor=white)\n![GitLab CI](https://img.shields.io/badge/GitLab_CI-FC6D26?style=for-the-badge\u0026logo=gitlab\u0026logoColor=white)\n![GitHub Actions](https://img.shields.io/badge/GitHub_Actions-2088FF?style=for-the-badge\u0026logo=github-actions\u0026logoColor=white)\n\n**Automated Docker deployment via CI/CD pipelines**\n\n[![License](https://img.shields.io/badge/License-MIT-00b0ff.svg?style=for-the-badge\u0026logo=opensourceinitiative\u0026logoColor=white)](https://opensource.org/licenses/MIT)\n![Version](https://img.shields.io/github/v/tag/Shawiizz/devops-framework?style=for-the-badge\u0026logo=semver\u0026logoColor=white\u0026label=Latest%20Version\u0026color=6F42C1)\n\n\u003c/div\u003e\n\n\u003e **BETA VERSION**: Functional and production-ready, but may contain issues. Please report bugs or suggestions.\n\nDeploy Docker applications to servers using GitLab/GitHub CI/CD and Ansible. Supports single or multiple containers from one repository.\n\n## Quick Start\n\n1. [Setup your server](#server-setup) - Use our CLI tool\n2. [Configure CI/CD](#cicd-setup) - Copy example files\n3. [Deploy](#deployment) - Push a git tag\n\n## Table of Contents\n\n- [How it works](#how-it-works)\n- [Server setup](#server-setup)\n- [CI/CD setup](#cicd-setup)\n- [Deployment](#deployment)\n- [Configuration](#configuration)\n- [Examples](#examples)\n\n## How it works\n\n**Compatibility:**\n- GitHub Actions\n- GitLab CI\n\n**Features:**\n- Multi-environment deployment (production, staging, etc.)\n- Multi-host deployment within same environment\n- Multi-container deployment from single repository\n- Environment isolation using `${ENV}` variable\n- SSH keys and secrets management\n- Ready-to-use separated CI/CD jobs (build validation + deployment)\n- Custom Nginx configurations deployment via templates\n- Linux services deployment and management\n- Automated script execution on remote servers\n\n**Workflow:**\n1. Build Docker images from your Dockerfiles\n2. Transfer images directly to target servers\n3. Ansible manages the deployment process\n\n**Tags deployment triggers:**\n- `X.Y.Z` → deploys to `production`\n- `X.Y.Z-[env_name]` → deploys to specified environment\n\n## Server setup\n\n**Prerequisites:**\n- Remote server: Debian/Ubuntu\n- Local machine: Docker Desktop\n\n**Automated setup (recommended):**\n\nLinux:\n```bash\ndocker run -it --rm \\\n  -v ~/.ssh:/root/.ssh \\\n  -v .:/project \\\n  shawiizz/devops-cli:latest\n```\n\nWindows PowerShell:\n```powershell\ndocker run -it --rm `\n  -v ${HOME}/.ssh:/root/.ssh `\n  -v .:/project `\n  shawiizz/devops-cli:latest\n```\n\nManual setup: [See detailed instructions](./MANUAL-REMOTE-SETUP.md)\n\n## CI/CD setup\n\n**1. Copy CI configuration:**\n- GitHub: `example/ci/github-ci.yml` → `.github/workflows/`\n- GitLab: `example/ci/gitlab-ci.yml` → repository root\n\n⚠️ **GitHub users**: Fork this repository and update the `uses` URL in the workflow file if your repository is in an organization.\n\n**Available CI/CD jobs:**\n- **build:** Validates Docker images build on every push\n- **deploy:** Deploys to target environment when pushing tags\n\n**2. Create project structure:**\n```\ndeployment/\n├── docker/\n│   ├── compose-deploy.yml\n│   └── Dockerfile.[service_name]\n└── env/\n    ├── .env.[env_name]\n    └── .env.[env_name].[host_name]\n```\n\n**3. Add repository secrets:**\n- `ANSIBLE_BECOME_PASSWORD`: Ansible user password\n- `[ENV_NAME]_SSH_PRIVATE_KEY`: SSH private key for each environment\n- For multi-host: `[ENV_NAME]_[HOST_NAME]_SSH_PRIVATE_KEY`\n\n**Notes:**\n- All secret names must be UPPERCASE\n- GitLab secrets must NOT be marked as protected\n- The base `.env.[env_name]` file automatically maps to the `main` host. Don't create additional `.env.[env_name].main` files.\n\n## Deployment\n\nCreate and push a git tag:\n```bash\ngit tag 1.0.0              # Deploy to production\ngit tag 1.0.0-staging      # Deploy to staging\ngit push origin --tags\n```\n\nThe framework will:\n1. Build your Docker images\n2. Deploy to specified environment\n3. Handle multiple services automatically\n\n## Configuration\n\n### Environment files\n\nCreate `deployment/env/.env.[env_name]` files with required variables:\n\n```bash\nHOST=192.168.1.10              # Server IP or CI secret reference\nANSIBLE_USER=ansible           # SSH user (usually 'ansible')\n# Add any other variables your app needs\n```\n\nYou can reference CI secrets:\n```bash\nHOST=$PRODUCTION_HOST          # Maps to CI secret 'PRODUCTION_HOST'\nDB_PASSWORD=$DB_SECRET         # Maps to CI secret 'DB_SECRET'\n```\nYou can also pass `$DB_SECRET` within env part of you docker compose file instead of this way.\n\n### Multi-host deployment\n\nDeploy to multiple servers in the same environment:\n\n```\ndeployment/env/\n├── .env.production            # Main host\n├── .env.production.a          # Host A\n├── .env.production.b          # Host B\n└── .env.production.c          # Host C\n```\n\nHost-specific files inherit variables from main file and can override them:\n\n```bash\n# .env.production.a\nHOST=192.168.1.11\nAPI_PORT=3001                  # Override main config\nREDIS_URL=redis://host-a:6379  # Add host-specific variable\n```\n\n**SSH keys for each host:**\n- Main: `PRODUCTION_SSH_PRIVATE_KEY`\n- Host A: `PRODUCTION_A_SSH_PRIVATE_KEY`\n- Host B: `PRODUCTION_B_SSH_PRIVATE_KEY`\n\n### Compose file\n\nYour `deployment/docker/compose-deploy.yml` can use environment variables:\n\n```yaml\nservices:\n  app:\n    image: my-app-${ENV}:${VERSION}\n    environment:\n      ENV: ${ENV}\n      DB_PASSWORD: ${DB_PASSWORD} # DB_PASSWORD can be defined in .env file or from CI secrets\n    ports:\n      - \"${APP_PORT}:3000\"\n    networks:\n      - network-${ENV}\n\nnetworks:\n  network-${ENV}:\n    driver: bridge\n```\n\n### Advanced templates\n\nCreate custom configurations in `deployment/templates/`:\n\n**Nginx:** `nginx/[name].conf.j2`     \n**Services:** `services/[name].service.j2`      \n**Scripts:** `scripts/[name].sh.j2`     \n\nAll templates support Jinja2 syntax and can access environment variables.    \n\n---\n\n## Examples\n\n**Example files:** Check `example/deployment/` folder for configuration examples.\n\n**Real projects using this framework:**\n- [MohistMC Frontend](https://github.com/MohistMC/mohistmc-frontend)\n- [MohistMC Backend](https://github.com/MohistMC/mohistmc-backend)\n- [Maven Repository](https://github.com/MohistMC/maven)\n- [Personal Website](https://github.com/Shawiizz/shawiizz.dev)\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n## Contributing\n\nContributions welcome! See [contribution guidelines](./CONTRIBUTE.md).\n\n## License\n\nMIT License\n\n\u003cp\u003eBuilt with ❤️ for the DevOps community\u003c/p\u003e\n\n\u003c/div\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshawiizz%2Fdevops-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshawiizz%2Fdevops-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshawiizz%2Fdevops-framework/lists"}