{"id":25703372,"url":"https://github.com/cododel/directus_template","last_synced_at":"2025-02-25T05:28:55.726Z","repository":{"id":277829244,"uuid":"900818664","full_name":"cododel/directus_template","owner":"cododel","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-09T14:26:50.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-16T12:31:41.447Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/cododel.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}},"created_at":"2024-12-09T14:26:48.000Z","updated_at":"2024-12-09T14:29:03.000Z","dependencies_parsed_at":"2025-02-16T12:50:38.088Z","dependency_job_id":null,"html_url":"https://github.com/cododel/directus_template","commit_stats":null,"previous_names":["cododel/directus_template"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cododel%2Fdirectus_template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cododel%2Fdirectus_template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cododel%2Fdirectus_template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cododel%2Fdirectus_template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cododel","download_url":"https://codeload.github.com/cododel/directus_template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240610311,"owners_count":19828771,"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":[],"created_at":"2025-02-25T05:28:55.021Z","updated_at":"2025-02-25T05:28:55.583Z","avatar_url":"https://github.com/cododel.png","language":"Shell","readme":"# Backend Template\n\nModern backend template with Docker, monitoring, and security best practices.\n\n## Requirements\n\n### Production\n- Docker and Docker Compose\n- Caddy server\n\n### Development\n- Docker and Docker Compose\n\n## Production Server Setup\n\n### Initial Server Setup\n\n1. Install Docker:\n```bash\n# Remove old versions\nfor pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do \n    sudo apt-get remove $pkg\ndone\n\n# Install Docker\nsudo apt-get update\nsudo apt-get install -y curl gnupg\nsudo install -m 0755 -d /etc/apt/keyrings\ncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg\nsudo chmod a+r /etc/apt/keyrings/docker.gpg\n\n# Add repository\necho \\\n  \"deb [arch=\"$(dpkg --print-architecture)\" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \\\n  \"$(. /etc/os-release \u0026\u0026 echo \"$VERSION_CODENAME\")\" stable\" | \\\n  sudo tee /etc/apt/sources.list.d/docker.list \u003e /dev/null\n\n# Install packages\nsudo apt-get update\nsudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin\n\n# Configure Docker\nsudo groupadd docker\nsudo usermod -aG docker $USER\nsudo systemctl enable docker.service\nsudo systemctl enable containerd.service\n```\n\n2. Configure SSH and Firewall:\n```bash\n# SSH Configuration\nsudo sed -i 's/#Port 22/Port 5000/' /etc/ssh/sshd_config\nsudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config\n\n# UFW Configuration\nsudo ufw logging on\nsudo ufw allow 5000/tcp\nsudo ufw allow 80/tcp\nsudo ufw allow 443/tcp\nsudo ufw default deny incoming\nsudo ufw enable\n```\n\n### Environment Setup\n\n1. Clone repository and setup environment variables:\n```bash\n# Copy configuration examples\ncp env.example/* env/\n```\n\n2. Required .env files:\n- `application.env`: Main application settings\n- `database.env`: PostgreSQL settings\n- `directus.env`: Directus CMS settings\n- `smtp.env`: Email settings\n- `netdata.env`: Monitoring settings\n\n## Development\n\n### Database Operations\n\n#### Migrations\nThe migration system uses two main scripts:\n- `create-migration-folder.sh`: Creates new migration folder with timestamp\n- `apply-migration.sh`: Applies migration to database\n- `run-all-migrations.sh`: Runs all pending migrations\n\n## Deployment\n\n### Application Launch\n```bash\n# Start all services\ndocker compose -f docker-compose.prod.yml up -d\n\n# Set Directus permissions\ndocker exec -u root backend_directus_1 chown -R node:node /directus/extensions /directus/uploads\n```\n\n### Monitoring\nMonitoring is implemented through Netdata with:\n- System metrics\n- Docker container monitoring\n- Custom metrics\n- Alert system\n\nAccess dashboard at `https://your-domain:19999`\n\n## Services\n\n### Main Components\n- Directus (port 8055): Headless CMS\n- PostgreSQL (port 5432): Main database\n- Redis: Caching service\n- Netdata (port 19999): Monitoring\n\n### Service Configuration\nAll services are configured through Docker Compose files:\n- `docker-compose.yml`: Base configuration\n- `docker-compose.prod.yml`: Production overrides\n- `services/docker-compose.netdata.yml`: Monitoring setup\n\n## Security\n\n- All external ports closed except 80/443 (Caddy) and 5000 (SSH)\n- Automatic SSL through Caddy\n- Password authentication disabled for SSH\n- UFW firewall enabled\n- Rate limiting on API endpoints\n- Security headers enabled\n\n## License\n\nThis template is available under the MIT License.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcododel%2Fdirectus_template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcododel%2Fdirectus_template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcododel%2Fdirectus_template/lists"}