{"id":26048592,"url":"https://github.com/jackkweyunga/docker-setup","last_synced_at":"2025-04-10T16:20:37.770Z","repository":{"id":266223494,"uuid":"897583863","full_name":"jackkweyunga/docker-setup","owner":"jackkweyunga","description":"Automated infrastructure setup tool for Docker with Traefik, Portainer, and Watchtower.","archived":false,"fork":false,"pushed_at":"2025-03-01T19:58:05.000Z","size":43,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T14:08:28.283Z","etag":null,"topics":["docker","docker-compose","portainer","traefik","watchtower"],"latest_commit_sha":null,"homepage":"https://jackkweyunga.hashnode.dev/docker-setup-a-tool-for-simple-self-hosted-infrastructure","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/jackkweyunga.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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-12-02T22:04:11.000Z","updated_at":"2025-03-01T19:58:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"b55908f1-317b-4fb0-b5ac-197e264652d0","html_url":"https://github.com/jackkweyunga/docker-setup","commit_stats":null,"previous_names":["jackkweyunga/docker-setup"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackkweyunga%2Fdocker-setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackkweyunga%2Fdocker-setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackkweyunga%2Fdocker-setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackkweyunga%2Fdocker-setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackkweyunga","download_url":"https://codeload.github.com/jackkweyunga/docker-setup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248252661,"owners_count":21072699,"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":["docker","docker-compose","portainer","traefik","watchtower"],"created_at":"2025-03-08T00:27:03.251Z","updated_at":"2025-04-10T16:20:37.762Z","avatar_url":"https://github.com/jackkweyunga.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker Setup\n\n![Version](https://img.shields.io/github/v/release/jackkweyunga/docker-setup)\n![License](https://img.shields.io/github/license/jackkweyunga/docker-setup)\n\n\u003e 🚀 Simple and streamlined Docker deployments with zero hassle\n\nDocker Setup is a lightweight tool that automates the deployment of Docker infrastructure with a reverse proxy, container management, and automated updates. Perfect for self-hosting applications with minimal configuration.\n\n## 📋 Features\n\n- **Zero-Dependency Installation**: Simple Bash script that works on any Linux distribution\n- **Automatic Docker Setup**: Installs Docker if not already present\n- **Reverse Proxy with Traefik**: Automatic HTTPS with Let's Encrypt certificates\n- **Container Management UI**: Optional Portainer integration for easy container management\n- **Automatic Updates**: Optional Watchtower integration for keeping containers up-to-date\n- **DNS Challenge Support**: Configure DNS verification for wildcard certificates (Cloudflare supported)\n- **Profile-Based Deployment**: Flexible component selection through Docker Compose profiles\n- **Command-Line Management**: Easy configuration through command-line options\n- **Traefik Dashboard**: Optional access to Traefik's monitoring interface\n\n## 🧰 Prerequisites\n\n- A Linux server (Debian, Ubuntu, CentOS, etc.)\n- Root/sudo access\n- Internet connectivity\n- A domain name (for HTTPS)\n\n## 🔧 Installation\n\n### Quick Install (Latest Version)\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/jackkweyunga/docker-setup/main/install.sh | bash\n```\n\n### Install Specific Version\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/jackkweyunga/docker-setup/main/install.sh | bash -s -- --version 1.3.1\n```\n\n### Development Install\n\nIf you've cloned the repository and want to install from your local copy:\n\n```bash\ncd docker-setup\n./install.sh --dev\n```\n\n## 🚀 Usage\n\n### Basic Setup\n\nRun the tool with sudo to start the interactive setup:\n\n`NOTE`: If you are going to use watchtower for automatic pulling of images, make sure you are logged in to your container registry after docker installation.\n\n```bash\nsudo docker-setup\n```\n\nIf docker is not installed, will prompt installation. After installation, you can login to docker incase you will be ddealing with private images.\n\n```bash\n# optional\nsudo docker login # for dockerhub\nsudo docker login ghcr.io # for github\n# ...\n```\n\nAfter docker is installed then run again:\n\n```bash\nsudo docker-setup\n```\n\nThe interactive setup will ask for:\n- Email address (for SSL certificates)\n- Whether to enable Portainer\n- Portainer domain (if enabled) but you can always access it from `http://{your-ip}:9000`\n- Whether to enable the Traefik dashboard\n- Whether to use DNS challenge for certificates\n\n### Command-Line Options\n\n```bash\n# Show help\nsudo docker-setup --help\n\n# Set Portainer domain\nsudo docker-setup --portainer-domain portainer.example.com\n\n# Set email for SSL certificates\nsudo docker-setup --email admin@example.com\n\n# Enable Traefik dashboard\nsudo docker-setup --enable-traefik-dashboard --traefik-dashboard-port 8080\n\n# Enable DNS challenge with Cloudflare\nsudo docker-setup --enable-dns-challenge --dns-provider cloudflare --cf-email user@example.com --cf-api-token your_token\n\n# Update to the latest version\nsudo docker-setup --update\n```\n\n## ⚙️ Configuration\n\nConfiguration files are stored in:\n- `/etc/docker-setup/`\n\n### Key Files\n\n- `/etc/docker-setup/docker-compose.yml`: Service definitions\n- `/etc/docker-setup/traefik/traefik.yml`: Traefik configuration\n- `/etc/docker-setup/.env`: Environment variables\n\n### Docker Compose Profiles\n\nThe tool uses Docker Compose profiles for flexible deployment:\n\n- **Default**: Traefik (always deployed)\n- **portainer**: Portainer container management UI\n- **ui**: Traefik dashboard interface\n- **maintenance**: Watchtower for automatic updates\n- **all**: All components\n\nThe tool automatically selects the appropriate profiles based on your configuration choices.\n\n## 🌐 Using with Your Applications\n\nAfter setup, add your own services with Traefik integration:\n\n```yaml\n# Example docker-compose.yml for your application\nservices:\n  my-app:\n    image: my-app-image\n    labels:\n      - \"traefik.enable=true\"\n      - \"traefik.http.routers.my-app.rule=Host(`app.example.com`)\"\n      - \"traefik.http.routers.my-app.entrypoints=websecure\"\n      - \"traefik.http.routers.my-app.tls.certresolver=production\"\n    networks:\n      - traefik_network\n\nnetworks:\n  traefik_network:\n    external: true\n```\n\n## 🔄 Updating\n\nTo update to the latest version:\n\n```bash\nsudo docker-setup --update\n```\n\n## 🚧 Troubleshooting\n\n### Common Issues\n\n1. **\"Network traefik_network not found\"**  \n   Solution: Create the network manually:\n   ```bash\n   sudo docker network create traefik_network\n   ```\n\n2. **SSL certificate issues**  \n   Solution: \n   - Ensure your domain points to your server\n   - Verify ports 80 and 443 are open\n   - Check for valid email address\n\n3. **Services not visible**  \n   Solution:\n   - Check that services are connected to `traefik_network`\n   - Verify Traefik labels are correctly configured\n   - Inspect logs: `sudo docker logs traefik`\n\n### Viewing Logs\n\n```bash\n# Traefik logs\nsudo docker logs traefik\n\n# Portainer logs\nsudo docker logs portainer\n```\n\n## 📚 Advanced Topics\n\n### DNS Challenge for Wildcard Certificates\n\nTo set up DNS challenge with Cloudflare:\n\n```bash\nsudo docker-setup --enable-dns-challenge --dns-provider cloudflare --cf-email user@example.com --cf-api-token your_token\n```\n\n#### Creating a Cloudflare API Token\n\n1. Log in to Cloudflare\n2. Go to My Profile → API Tokens\n3. Create a token with Zone:DNS:Edit permissions\n4. Use this token with the `--cf-api-token` parameter\n\n### Setting Up Subdomains with Cloudflare\n\nTo host services with wildcard subdomains with Cloudflare DNS:\n\n1. **Configure DNS Challenge** as shown above.\n\n2. **Create A/CNAME Records in Cloudflare**:\n   - Create an A record pointing your root domain to your server IP\n   - Create CNAME records for each subdomain pointing to your root domain\n   \n   Example Cloudflare DNS settings:\n   ```\n   Type    Name            Content           Proxy Status\n   A       *               your.server.ip    Proxied\n   A       example.com     your.server.ip    Proxied\n   ```\n\n3. **Use Traefik Labels to specify a HostRegexp and/or Host rule(s)**:\n\n   ```yaml\n   # Example docker-compose.yml for wilddcard subdomains\n   services:\n     web-app:\n       image: webapp:latest\n       labels:\n         - \"traefik.enable=true\"\n         - \"traefik.http.routers.webapp.rule=Host(`example.com`) || HostRegexp(`.+\\.example\\.com`)\"\n         - \"traefik.http.routers.webapp.entrypoints=websecure\"\n         - \"traefik.http.routers.webapp.tls.certresolver=cloudflare\"\n         - \"traefik.http.routers.webapp.tls.domains[0].main=example.com\"\n         - \"traefik.http.routers.webapp.tls.domains[0].sans=*.example.com\"\n       networks:\n         - traefik_network\n   \n   networks:\n     traefik_network:\n       external: true\n   ```\n\n4. **Apply Configuration**:\n   ```bash\n   docker compose up -d\n   ```\n\nThis will automatically generate a wildcard SSL certificates for each subdomain using the Cloudflare DNS challenge.\n\n### Customizing Traefik Configuration\n\nEdit the Traefik configuration:\n\n```bash\nsudo nano /etc/docker-setup/traefik/traefik.yml\n```\n\nRestart Traefik to apply changes:\n\n```bash\nsudo docker restart traefik\n```\n\n## 👥 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch\n3. Commit your changes\n4. Push to the branch\n5. Open a Pull Request\n\n## 📝 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\nDocumentation: https://jackkweyunga.hashnode.dev/docker-setup-a-tool-for-simple-self-hosted-infrastructure\n\nCreated by [Jack Kweyunga](https://github.com/jackkweyunga)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackkweyunga%2Fdocker-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackkweyunga%2Fdocker-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackkweyunga%2Fdocker-setup/lists"}