{"id":35015976,"url":"https://github.com/0xtlt/coolify-apps-restarter","last_synced_at":"2026-05-23T04:32:09.094Z","repository":{"id":309676617,"uuid":"1037142787","full_name":"0xtlt/coolify-apps-restarter","owner":"0xtlt","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-13T07:46:04.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-06T21:58:13.903Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/0xtlt.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-13T06:10:11.000Z","updated_at":"2025-08-13T07:46:07.000Z","dependencies_parsed_at":"2025-08-13T08:20:18.913Z","dependency_job_id":"c20cfc34-d51f-4c03-ac52-0bc2a3c3b8b7","html_url":"https://github.com/0xtlt/coolify-apps-restarter","commit_stats":null,"previous_names":["0xtlt/coolify-apps-restarter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/0xtlt/coolify-apps-restarter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xtlt%2Fcoolify-apps-restarter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xtlt%2Fcoolify-apps-restarter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xtlt%2Fcoolify-apps-restarter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xtlt%2Fcoolify-apps-restarter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xtlt","download_url":"https://codeload.github.com/0xtlt/coolify-apps-restarter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xtlt%2Fcoolify-apps-restarter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28072875,"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-12-27T02:00:05.897Z","response_time":58,"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":[],"created_at":"2025-12-27T05:19:54.297Z","updated_at":"2025-12-27T05:19:54.703Z","avatar_url":"https://github.com/0xtlt.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Coolify Apps Restarter\n\nA lightweight Bun application that automatically restarts your Coolify applications using deployment webhooks on a configurable cron schedule.\n\n## 🚀 Features\n\n- **Automated Scheduling**: Uses cron expressions to schedule app restarts\n- **Multiple App Support**: Restart multiple applications with a single configuration\n- **Dual Deployment Methods**: Choose between webhook URLs or Coolify API with app UUIDs\n- **Webhook Integration**: Leverages Coolify's deployment webhooks for reliable restarts\n- **API Integration**: Direct Coolify API integration using instance URL and app UUIDs\n- **Parallel Execution**: Triggers all deployments simultaneously for faster execution\n- **Environment Configuration**: Secure configuration through environment variables\n- **Docker Support**: Run anywhere with Docker containerization\n- **Error Handling**: Robust error handling with detailed logging\n\n## 📋 Prerequisites\n\n- [Bun](https://bun.sh) v1.0+ (for local development)\n- Docker (for containerized deployment)\n- Coolify instance with API access\n- Deployment webhooks configured for your applications\n\n## 🛠️ Installation\n\n### Local Development\n\n1. **Clone the repository**:\n   ```bash\n   git clone \u003crepository-url\u003e\n   cd coolify-apps-restarter\n   ```\n\n2. **Install dependencies**:\n   ```bash\n   bun install\n   ```\n\n3. **Configure environment**:\n   ```bash\n   cp .env.example .env\n   ```\n   \n   Edit `.env` with your configuration (choose one deployment method):\n   \n   **Option 1 - Using Webhook URLs:**\n   ```env\n   COOLIFY_TOKEN=your_coolify_api_token_here\n   WEBHOOK_URLS=https://your-coolify.com/webhooks/app1,https://your-coolify.com/webhooks/app2\n   CRON_SCHEDULE=0 */6 * * *\n   ```\n   \n   **Option 2 - Using Coolify API:**\n   ```env\n   COOLIFY_TOKEN=your_coolify_api_token_here\n   COOLIFY_API_URL=https://your-coolify.com/api/v1\n   COOLIFY_APP_UUIDS=uuid1,uuid2,uuid3\n   CRON_SCHEDULE=0 */6 * * *\n   ```\n\n4. **Run the application**:\n   ```bash\n   bun start\n   ```\n\n### Docker Deployment\n\n1. **Build the image**:\n   ```bash\n   docker build -t coolify-apps-restarter .\n   ```\n\n2. **Run the container** (choose one deployment method):\n\n   **Option 1 - Using Webhook URLs:**\n   ```bash\n   docker run -d \\\n     --name coolify-restarter \\\n     -e COOLIFY_TOKEN=\"your_token_here\" \\\n     -e WEBHOOK_URLS=\"https://your-coolify.com/webhooks/app1,https://your-coolify.com/webhooks/app2\" \\\n     -e CRON_SCHEDULE=\"0 */6 * * *\" \\\n     coolify-apps-restarter\n   ```\n\n   **Option 2 - Using Coolify API:**\n   ```bash\n   docker run -d \\\n     --name coolify-restarter \\\n     -e COOLIFY_TOKEN=\"your_token_here\" \\\n     -e COOLIFY_API_URL=\"https://your-coolify.com/api/v1\" \\\n     -e COOLIFY_APP_UUIDS=\"uuid1,uuid2,uuid3\" \\\n     -e CRON_SCHEDULE=\"0 */6 * * *\" \\\n     coolify-apps-restarter\n   ```\n\n### Docker Compose\n\n**Option 1 - Using Webhook URLs:**\n```yaml\nversion: '3.8'\nservices:\n  coolify-restarter:\n    build: .\n    environment:\n      - COOLIFY_TOKEN=your_token_here\n      - WEBHOOK_URLS=https://your-coolify.com/webhooks/app1,https://your-coolify.com/webhooks/app2\n      - CRON_SCHEDULE=0 */6 * * *\n    restart: unless-stopped\n```\n\n**Option 2 - Using Coolify API:**\n```yaml\nversion: '3.8'\nservices:\n  coolify-restarter:\n    build: .\n    environment:\n      - COOLIFY_TOKEN=your_token_here\n      - COOLIFY_API_URL=https://your-coolify.com/api/v1\n      - COOLIFY_APP_UUIDS=uuid1,uuid2,uuid3\n      - CRON_SCHEDULE=0 */6 * * *\n    restart: unless-stopped\n```\n\n## ⚙️ Configuration\n\n### Environment Variables\n\n| Variable | Description | Required | Default |\n|----------|-------------|----------|---------|\n| `COOLIFY_TOKEN` | Your Coolify API token | ✅ | - |\n| `WEBHOOK_URLS` | Comma-separated webhook URLs | ⚠️* | - |\n| `COOLIFY_API_URL` | Coolify API base URL (e.g., https://your-coolify.com/api/v1) | ⚠️* | - |\n| `COOLIFY_APP_UUIDS` | Comma-separated app UUIDs for API-based deployment | ⚠️* | - |\n| `CRON_SCHEDULE` | Cron expression for scheduling | ❌ | `0 */6 * * *` |\n| `DEPLOY_ON_START` | Trigger deployment on app startup (true/false, on/off, yes/no, 1/0) | ❌ | `false` |\n| `FORCE` | Force rebuild without cache (true/false, on/off, yes/no, 1/0) | ❌ | `false` |\n| `DEBUG` | Enable detailed logging of requests/responses (true/false, on/off, yes/no, 1/0) | ❌ | `false` |\n\n**\\*** At least one deployment method must be configured: either `WEBHOOK_URLS` or both `COOLIFY_API_URL` + `COOLIFY_APP_UUIDS`.\n\n### Getting Coolify API Token\n\n1. Navigate to your Coolify dashboard\n2. Go to **Settings** → **API Tokens**\n3. Click **+ New Token**\n4. Give your token a descriptive name (e.g., \"Apps Restarter\")\n5. **Select permissions**: Make sure to enable **Deploy** permission (required for triggering webhooks)\n6. Copy the generated token immediately (it won't be shown again)\n7. Use this token as your `COOLIFY_TOKEN` environment variable\n\n\u003e **Note**: The token needs **Deploy** permission to successfully trigger deployment webhooks.\n\n### Getting Coolify Webhooks (Option 1)\n\n1. Navigate to your Coolify dashboard\n2. Select the application you want to restart\n3. Go to **Settings** → **Webhooks**\n4. Copy the deployment webhook URL\n5. Repeat for each application\n\n### Getting App UUIDs for API (Option 2)\n\n1. Navigate to your Coolify dashboard\n2. Select the application you want to restart\n3. The UUID is visible in the browser URL: `https://your-coolify.com/application/{uuid}`\n4. Copy the UUID from the URL\n5. Repeat for each application\n6. Set `COOLIFY_API_URL` to your Coolify API base URL (e.g., `https://your-coolify.com/api/v1`)\n7. Set `COOLIFY_APP_UUIDS` to comma-separated list of UUIDs\n\n### Cron Schedule Examples\n\n| Schedule | Cron Expression | Description |\n|----------|----------------|-------------|\n| Every 6 hours | `0 */6 * * *` | Default schedule |\n| Daily at 2 AM | `0 2 * * *` | Once per day |\n| Every Monday at 9 AM | `0 9 * * 1` | Weekly restart |\n| Every 30 minutes | `*/30 * * * *` | Frequent restarts |\n| Twice daily | `0 6,18 * * *` | 6 AM and 6 PM |\n\n## 📊 Monitoring\n\nThe application provides detailed console output:\n\n```\n⏰ Scheduler started with cron pattern: 0 */6 * * *\n📡 Monitoring 3 webhook URLs\n🟢 Coolify Apps Restarter is running...\n\n🕐 2024-01-15T12:00:00.000Z - Executing scheduled restart...\n🚀 Starting deployment restart for 3 apps...\n🔄 Pinging webhook: https://your-coolify.com/webhooks/app1\n🔄 Pinging webhook: https://your-coolify.com/webhooks/app2\n🔄 Pinging webhook: https://your-coolify.com/webhooks/app3\n✅ Successfully triggered deployment for: https://your-coolify.com/webhooks/app1\n✅ Successfully triggered deployment for: https://your-coolify.com/webhooks/app2\n✅ Successfully triggered deployment for: https://your-coolify.com/webhooks/app3\n🎉 All deployment webhooks have been triggered!\n```\n\n## 🐳 Production Deployment\n\n### Coolify Deployment\n\nIf you're using Coolify to deploy this app:\n\n1. Create a new application in Coolify\n2. Connect your Git repository\n3. Set environment variables in the application settings\n4. Deploy and monitor logs\n\n### Docker Swarm / Kubernetes\n\nThe application is stateless and perfect for container orchestration:\n\n```yaml\n# kubernetes-deployment.yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: coolify-restarter\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: coolify-restarter\n  template:\n    metadata:\n      labels:\n        app: coolify-restarter\n    spec:\n      containers:\n      - name: coolify-restarter\n        image: coolify-apps-restarter:latest\n        env:\n        - name: COOLIFY_TOKEN\n          valueFrom:\n            secretKeyRef:\n              name: coolify-secrets\n              key: token\n        - name: WEBHOOK_URLS\n          value: \"https://your-coolify.com/webhooks/app1,https://your-coolify.com/webhooks/app2\"\n        - name: CRON_SCHEDULE\n          value: \"0 */6 * * *\"\n```\n\n## 🔧 Development\n\n### Scripts\n\n- `bun dev` - Run in development mode\n- `bun start` - Run in production mode\n- `bun build` - Build the application\n- `bun lint` - Type checking\n\n### Project Structure\n\n```\ncoolify-apps-restarter/\n├── index.ts              # Main application\n├── package.json          # Dependencies and scripts\n├── Dockerfile           # Container configuration\n├── .env.example         # Environment template\n├── .gitignore          # Git ignore rules\n└── README.md           # This file\n```\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests if applicable\n5. Submit a pull request\n\n## 📄 License\n\nThis project is open source and available under the [MIT License](LICENSE).\n\n## ⚠️ Security Notes\n\n- Never commit your `.env` file or expose your Coolify token\n- Use secrets management in production environments\n- Regularly rotate your Coolify API tokens\n- Monitor webhook endpoint access logs\n\n## 🆘 Troubleshooting\n\n### Common Issues\n\n**Error: COOLIFY_TOKEN environment variable is required**\n- Ensure your `.env` file exists and contains the token\n- Check that the environment variable is properly set in your deployment\n\n**Webhook requests failing**\n- Verify webhook URLs are correct and accessible\n- Check that your Coolify token has proper permissions\n- Ensure your Coolify instance is reachable from the deployment environment\n\n**Cron jobs not executing**\n- Validate your cron expression using [crontab.guru](https://crontab.guru)\n- Check application logs for error messages\n- Ensure the application container doesn't exit unexpectedly\n\n### Getting Help\n\n- Check the application logs for detailed error messages\n- Verify your Coolify webhook configuration\n- Test webhook URLs manually using curl:\n  ```bash\n  curl -X POST \"https://your-coolify.com/webhooks/your-app\" \\\n       -H \"Authorization: Bearer your_token\"\n  ```\n\n---\n\nBuilt with ❤️ using [Bun](https://bun.sh) - A fast all-in-one JavaScript runtime.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xtlt%2Fcoolify-apps-restarter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xtlt%2Fcoolify-apps-restarter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xtlt%2Fcoolify-apps-restarter/lists"}