{"id":27206558,"url":"https://github.com/adamkaram/tenancyship","last_synced_at":"2026-04-29T09:08:03.008Z","repository":{"id":285489348,"uuid":"958308251","full_name":"Adamkaram/tenancyship","owner":"Adamkaram","description":"A powerful, enterprise-grade multi-tenancy toolkit for modern SaaS applications, featuring a robust microservices architecture.","archived":false,"fork":false,"pushed_at":"2025-04-05T06:46:16.000Z","size":105,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-14T13:43:26.233Z","etag":null,"topics":["docker","golang","lua","multi-tenancy","podman","podman-compose","rust-lang","surrealdb","tenancy","terraform","terraform-vault"],"latest_commit_sha":null,"homepage":"","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/Adamkaram.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":"2025-04-01T01:37:57.000Z","updated_at":"2025-04-05T06:48:45.000Z","dependencies_parsed_at":"2025-04-01T02:36:20.732Z","dependency_job_id":"43c36f3b-2085-4547-a25e-edf6c6602058","html_url":"https://github.com/Adamkaram/tenancyship","commit_stats":null,"previous_names":["adamkaram/tenancyship"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Adamkaram/tenancyship","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adamkaram%2Ftenancyship","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adamkaram%2Ftenancyship/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adamkaram%2Ftenancyship/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adamkaram%2Ftenancyship/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Adamkaram","download_url":"https://codeload.github.com/Adamkaram/tenancyship/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adamkaram%2Ftenancyship/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32418282,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["docker","golang","lua","multi-tenancy","podman","podman-compose","rust-lang","surrealdb","tenancy","terraform","terraform-vault"],"created_at":"2025-04-09T23:55:05.165Z","updated_at":"2026-04-29T09:08:02.986Z","avatar_url":"https://github.com/Adamkaram.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tenancyship 🚀 \n![New Project](https://github.com/user-attachments/assets/52c23150-37f3-40d0-b4a2-f9e5f35b729b)\n\nA powerful, enterprise-grade multi-tenancy toolkit for modern SaaS applications, featuring a robust microservices architecture.\n\n\n\n\n\n## Core Features\n\n### 🔒 Secure Tenant Isolation\n- Database-per-tenant architecture\n- Robust authentication \u0026 authorization\n- Resource quotas and rate limiting\n\n### 🛠️ Technology Stack\n- **Database Layer**: High-performance SurrealDB service powered by Rust/Axum\n- **Application Layer**: Go-based microservices with clean architecture\n- **Infrastructure**: Container orchestration with Podman/Kubernetes\n- **Gateway**: Advanced request routing with NGINX\n\n### 🌟 Key Benefits\n- Seamless tenant management\n- Horizontal scalability\n- Zero-trust security model\n- Real-time analytics\n- Infrastructure as Code (IaC)\n\n### 📈 Performance\n- Sub-millisecond tenant routing\n- Automatic failover\n- Load balancing\n- Connection pooling\n\n## Quick Links\n- [Documentation](./docs)\n- [API Reference](./api-docs)\n- [Contributing Guide](./CONTRIBUTING.md)\n- [Security](./SECURITY.md)\n\n# Tenant Service\n\nThis project implements a tenant service using Rust, SurrealDB, and Kubernetes, with Terraform for infrastructure management.\n\n## Project Structure\n```\ntenancyship/\n├── db-service/                   # SurrealDB service with Rust/Axum\n│   ├── src/                      # Rust source code\n│   ├── Cargo.toml               # Rust dependencies\n│   └── Cargo.lock               # Rust lockfile\n├── tenant-service/              # Go tenant management service\n│   ├── go.mod                   # Go module definition\n│   ├── go.sum                   # Go dependencies checksum\n│   ├── cmd/                     # Command line applications\n│   │   └── server/             # Main server application\n│   │       └── main.go         # Server entrypoint\n│   ├── internal/               # Private application code\n│   │   ├── api/               # API handlers and routes\n│   │   ├── models/            # Data models\n│   │   └── services/          # Business logic\n│   └── pkg/                    # Public packages\n│       └── tenant/            # Tenant management package\n├── terraform/                  # Infrastructure as code\n│   ├── main.tf                # Main Terraform configuration\n│   ├── variables.tf           # Variable definitions\n│   └── secrets/               # Environment-specific variables\n│       ├── template.tfvars    # Template for environment variables\n│       ├── dev.tfvars         # Development environment variables\n│       └── prod.tfvars        # Production environment variables\n├── k8s/                       # Kubernetes manifests\n│   ├── base/                  # Base configurations\n│   │   ├── namespace.yaml     # Namespace definition\n│   │   └── persistent-volumes.yaml # Persistent volume definitions\n│   ├── tenant-service/        # Tenant service configurations\n│   │   └── base/              # Base tenant service configs\n│   ├── nginx/                 # Nginx configurations\n│   │   └── base/              # Base nginx configs\n│   ├── redis/                 # Redis configurations\n│   │   └── base/              # Base redis configs\n│   └── overlays/              # Environment-specific configurations\n│       ├── dev/               # Development environment\n│       └── prod/              # Production environment\n└── scripts/                   # Utility scripts\n    └── all-in-one.sh          # All-in-one management script\n```\n\n## Prerequisites\n\n- Docker or Podman\n- Kubernetes cluster (or Minikube for local development)\n- Terraform\n- kubectl\n- kustomize (installed automatically by the management script)\n\n## Setup and Management\n\nThis project includes a comprehensive all-in-one management script that handles all aspects of development, deployment, and management.\n\n### Quick Start\n\n```bash\n# Make the script executable\nchmod +x scripts/all-in-one.sh\n\n# Create a convenient symlink\nln -sf scripts/all-in-one.sh ./manage\n\n# Run the interactive menu\n./manage\n```\n\n### Interactive Menu\n\nThe management script provides an interactive menu system with the following options:\n\n1. **Development Environment**\n   - Deploy using Kustomize\n   - Deploy using Terraform + K8s\n   - Show Kubernetes resources\n   - Get pod logs\n   - Restart deployments\n   - Shell into a pod\n   - Check SSL certificates\n   - Clean up resources\n\n2. **Production Environment**\n   - Same options as development (with confirmation prompts for safety)\n\n3. **Local Development**\n   - Run application with Go or Podman\n   - Run Rust tenant service\n   - Deploy locally using docker-compose\n\n4. **Tools \u0026 Setup**\n   - Install required tools\n   - Set up development environment\n   - Set up production environment\n\n### Command Line Usage\n\nYou can also use the script directly with commands:\n\n```bash\n# General syntax\n./manage \u003ccommand\u003e [options]\n```\n\nCommon commands:\n\n```bash\n# Install required tools\nsudo ./manage install\n\n# Set up development environment\n./manage setup dev\n\n# Deploy to development environment\n./manage deploy dev\n\n# Deploy to development with Kustomize\n./manage kustomize dev\n\n# Run local application (Go or Podman)\n./manage run-local\n\n# Run Rust tenant service\n./manage run-rust\n\n# Deploy locally with docker-compose\n./manage deploy-local\n\n# Check status of deployments\n./manage status dev\n\n# View logs from pods\n./manage logs dev\n\n# Open shell in a pod\n./manage shell dev\n\n# Check SSL certificates\n./manage ssl-status dev\n\n# Restart deployments\n./manage restart dev\n\n# Clean up resources\n./manage cleanup dev\n```\n\n## Kubernetes Structure\n\nThe Kubernetes configurations follow a Kustomize-based structure:\n\n- **Base**: Contains shared resources (namespace, persistent volumes)\n- **Component Directories**: Component-specific configurations:\n  - `tenant-service`: Main backend service\n  - `nginx`: Frontend proxy with SSL termination\n  - `redis`: Caching layer\n- **Overlays**: Environment-specific configurations\n  - `dev`: Development environment settings\n  - `prod`: Production environment settings with higher replica counts\n\n## Local Development\n\nFor local development, you can use:\n\n```bash\n# Run the Go application directly\n./manage run-local\n# Select option 1 when prompted\n\n# Run with docker-compose/podman-compose\n./manage run-local\n# Select option 2 when prompted\n\n# Run the Rust tenant service\n./manage run-rust\n\n# Deploy locally with all services\n./manage deploy-local\n```\n\n## Secret Management\n\nThis project uses a multi-layered approach to secret management:\n\n1. **Development**: Environment variables or ConfigMaps\n2. **Kubernetes**: Kubernetes Secrets mounted as files\n3. **Terraform**: Terraform variables for infrastructure secrets\n\n## Customization\n\n### Adding New Components\n\n1. Create a new directory in `k8s/` for your component\n2. Add base manifests in a `base/` subdirectory\n3. Update overlays to include your component\n4. Deploy using `./manage kustomize dev`\n\n### Adding New Environments\n\n1. Create a new directory in `k8s/overlays/` for your environment\n2. Copy files from an existing environment as templates\n3. Set up Terraform variables: `./manage setup \u003cnew-env\u003e`\n4. Deploy to the new environment: `./manage deploy \u003cnew-env\u003e`\n\n## Troubleshooting\n\nThe management script includes built-in troubleshooting capabilities:\n\n```bash\n# Check deployment status\n./manage status dev\n\n# View pod logs\n./manage logs dev\n\n# Shell into a pod for debugging\n./manage shell dev\n```\n\nCommon issues and solutions:\n\n1. **Connection to database fails**: Check the database credentials in your ConfigMap or environment variables\n2. **Kubernetes pods not starting**: Check pod status and logs with `./manage status dev` and `./manage logs dev`\n3. **Terraform errors**: Ensure your `.tfvars` file has all required variables\n\nFor more detailed troubleshooting, check the README files in each component directory:\n- `k8s/README.md`: Overview of Kubernetes structure\n- `k8s/tenant-service/README.md`: Tenant service details\n- `k8s/nginx/README.md`: Nginx proxy details\n- `k8s/redis/README.md`: Redis cache details\n- `scripts/README-all-in-one.md`: Detailed usage of the management script\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamkaram%2Ftenancyship","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadamkaram%2Ftenancyship","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamkaram%2Ftenancyship/lists"}