From 3ee371c287f682fe79b486a7c56d2fc1d7ccee72 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 14 Nov 2025 13:54:06 +0000 Subject: [PATCH 1/2] Initial plan From 5757ede32d03fa63c78a1e0025d0ea72e89e8940 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 14 Nov 2025 14:04:05 +0000 Subject: [PATCH 2/2] docs: add comprehensive first batch of documentation Co-authored-by: undefinedhuman <56697016+undefinedhuman@users.noreply.github.com> --- .../docs/1.getting-started/1.introduction.md | 85 +++- .../docs/1.getting-started/2.installation.md | 245 +++++++++++ .../docs/1.getting-started/3.quick-start.md | 220 ++++++++++ content/docs/3.core-concepts/1.overview.md | 213 +++++++++ content/docs/4.guides/1.configuration.md | 411 ++++++++++++++++++ nuxt.config.ts | 4 + 6 files changed, 1173 insertions(+), 5 deletions(-) create mode 100644 content/docs/1.getting-started/2.installation.md create mode 100644 content/docs/1.getting-started/3.quick-start.md create mode 100644 content/docs/3.core-concepts/1.overview.md create mode 100644 content/docs/4.guides/1.configuration.md diff --git a/content/docs/1.getting-started/1.introduction.md b/content/docs/1.getting-started/1.introduction.md index 133d921..4a0150f 100644 --- a/content/docs/1.getting-started/1.introduction.md +++ b/content/docs/1.getting-started/1.introduction.md @@ -1,10 +1,85 @@ --- title: "Introduction" -description: "" +description: "Welcome to Cosmify - A self-hosted Platform as a Service (PaaS) solution" --- -Coming soon! +# Introduction -```typescript [intro.ts] -Hello, world! -``` \ No newline at end of file +Welcome to **Cosmify**, a powerful self-hosted Platform as a Service (PaaS) that gives you complete control over your infrastructure without vendor lock-in. + +## What is Cosmify? + +Cosmify is an open-source platform that enables you to deploy, manage, and scale applications on your own infrastructure. Think of it as your own Heroku or Platform.sh, but running on servers you control. + +## Key Features + +### 🚀 Self-Hosted Deployment +Deploy applications and manage infrastructure effortlessly on your own servers or cloud provider of choice. + +### ☁️ Multi-Cloud Support +Works seamlessly with various cloud providers (AWS, DigitalOcean, Hetzner, etc.) or self-hosted environments. + +### 🎨 User-Friendly UI +A clean and intuitive dashboard built with Vue.js for better usability and management. + +### 🐳 Docker-Based +Leverages Docker for containerized deployments, ensuring consistency across environments. + +### 🔐 Secure by Design +Built-in security measures including authentication, authorization, and isolated environments. + +### 📊 Organization Management +Multi-tenancy support with organizations, projects, and role-based access control. + +## Core Capabilities + +Cosmify currently provides: + +- **Project Management**: Organize your applications into projects +- **Container Orchestration**: Deploy and manage Docker containers +- **Network Management**: Configure virtual networks for your applications +- **Server Management**: Connect and manage multiple servers +- **Environment Variables**: Secure configuration management +- **Port Mapping**: Expose your applications to the internet + +## Coming Soon + +Cosmify is actively being developed. Upcoming features include: + +- **Database Management**: Deploy and manage PostgreSQL, MySQL, Redis, and more +- **Automated Deployments**: Git-based workflows with GitHub and GitLab integration +- **Advanced Monitoring**: Built-in metrics, logging, and alerting +- **Load Balancing**: Distribute traffic across multiple instances +- **Backup & Recovery**: Automated backups for databases and volumes + +## Why Choose Cosmify? + +- **No Vendor Lock-In**: Your infrastructure, your rules +- **Cost Effective**: Pay only for your infrastructure costs +- **Full Control**: Complete access to your data and configurations +- **Open Source**: Transparent, auditable, and community-driven +- **Privacy First**: Your data stays on your infrastructure + +## Who is Cosmify For? + +Cosmify is ideal for: + +- **Startups** looking for a cost-effective PaaS alternative +- **Development Teams** wanting control over their deployment pipeline +- **Agencies** managing multiple client applications +- **Enterprises** requiring on-premises or private cloud deployments +- **Developers** who want to learn about PaaS architecture + +## Architecture + +Cosmify consists of three main components: + +1. **Backend API**: Express.js REST API handling all business logic +2. **Frontend Dashboard**: Vue.js web application for management +3. **PostgreSQL Database**: Stores all configuration and metadata + +The platform communicates with your servers via SSH to manage Docker containers and orchestrate deployments. + +## Next Steps + +Ready to get started? Head over to the [Installation](/docs/getting-started/installation) guide to set up Cosmify on your infrastructure. \ No newline at end of file diff --git a/content/docs/1.getting-started/2.installation.md b/content/docs/1.getting-started/2.installation.md new file mode 100644 index 0000000..a422750 --- /dev/null +++ b/content/docs/1.getting-started/2.installation.md @@ -0,0 +1,245 @@ +--- +title: "Installation" +description: "Learn how to install and set up Cosmify on your infrastructure" +--- + +# Installation + +This guide walks you through installing Cosmify on your infrastructure. Cosmify can be installed on a single server or distributed across multiple servers. + +## Prerequisites + +Before installing Cosmify, ensure you have: + +- A server with **Ubuntu 20.04+** or **Debian 11+** (other Linux distributions may work but are untested) +- At least **2GB RAM** and **20GB disk space** +- **Docker** and **Docker Compose** installed +- **PostgreSQL 13+** (can be installed via Docker) +- **Node.js 18+** and **Yarn** (for building from source) +- **SSH access** with sudo privileges + +## System Requirements + +### Minimum Requirements +- **CPU**: 2 cores +- **RAM**: 2GB +- **Storage**: 20GB +- **OS**: Ubuntu 20.04+ or Debian 11+ + +### Recommended Requirements +- **CPU**: 4 cores +- **RAM**: 4GB +- **Storage**: 50GB SSD +- **OS**: Ubuntu 22.04 LTS + +## Installation Methods + +### Method 1: Docker Compose (Recommended) + +The easiest way to get started with Cosmify is using Docker Compose. + +#### Step 1: Clone the Repository + +```bash +git clone https://github.com/cosmify-dev/cosmify.git +cd cosmify +``` + +#### Step 2: Configure Environment Variables + +Create a `.env` file in the root directory: + +```bash +cp .env.example .env +``` + +Edit the `.env` file with your configuration: + +```bash +# Database Configuration +POSTGRES_HOST=database +POSTGRES_PORT=5432 +POSTGRES_USER=admin +POSTGRES_PASSWORD=your_secure_password_here +POSTGRES_DB=cosmify + +# Backend Configuration +BACKEND_PORT=3001 +NODE_ENV=production + +# Frontend Configuration +VITE_API_URL=http://localhost:3001 + +# Security +JWT_SECRET=your_jwt_secret_here +SESSION_SECRET=your_session_secret_here +``` + +#### Step 3: Start Services + +Start the development environment: + +```bash +docker-compose -f infra/docker-compose.dev.yml up -d +``` + +Or for production: + +```bash +docker-compose up -d +``` + +#### Step 4: Access Cosmify + +Open your browser and navigate to: +- **Frontend**: `http://localhost:3000` +- **Backend API**: `http://localhost:3001` + +### Method 2: Manual Installation + +For more control, you can install Cosmify manually. + +#### Step 1: Install Dependencies + +```bash +# Update system packages +sudo apt update && sudo apt upgrade -y + +# Install Node.js 18 +curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - +sudo apt install -y nodejs + +# Install Yarn +npm install -g yarn + +# Install Docker +curl -fsSL https://get.docker.com -o get-docker.sh +sudo sh get-docker.sh +sudo usermod -aG docker $USER + +# Install PostgreSQL +sudo apt install -y postgresql postgresql-contrib +``` + +#### Step 2: Set Up Database + +```bash +# Create database and user +sudo -u postgres psql < "$BACKUP_DIR/cosmify_$TIMESTAMP.sql" + +# Compress backup +gzip "$BACKUP_DIR/cosmify_$TIMESTAMP.sql" + +# Remove backups older than 30 days +find "$BACKUP_DIR" -name "*.sql.gz" -mtime +30 -delete +``` + +Add to crontab: + +```bash +# Daily backup at 2 AM +0 2 * * * /usr/local/bin/backup-cosmify.sh +``` + +### Resource Limits + +Configure Docker resource limits in docker-compose.yml: + +```yaml +services: + backend: + # ... other config + deploy: + resources: + limits: + cpus: '2' + memory: 2G + reservations: + cpus: '1' + memory: 1G +``` + +### Logging + +Configure log rotation for Docker: + +```json +{ + "log-driver": "json-file", + "log-opts": { + "max-size": "10m", + "max-file": "3" + } +} +``` + +Add to `/etc/docker/daemon.json` and restart Docker: + +```bash +sudo systemctl restart docker +``` + +## Security Hardening + +### Firewall Configuration + +Configure UFW (Ubuntu Firewall): + +```bash +# Allow SSH +sudo ufw allow 22/tcp + +# Allow HTTP/HTTPS +sudo ufw allow 80/tcp +sudo ufw allow 443/tcp + +# Enable firewall +sudo ufw enable +``` + +### SSH Hardening + +Update `/etc/ssh/sshd_config`: + +``` +# Disable root login +PermitRootLogin no + +# Use SSH keys only +PasswordAuthentication no +PubkeyAuthentication yes + +# Disable empty passwords +PermitEmptyPasswords no + +# Set login timeout +LoginGraceTime 30 +``` + +Restart SSH: + +```bash +sudo systemctl restart sshd +``` + +### Database Security + +Secure PostgreSQL: + +```bash +# Edit pg_hba.conf to restrict access +sudo nano /etc/postgresql/15/main/pg_hba.conf + +# Only allow localhost connections +local all all peer +host all all 127.0.0.1/32 scram-sha-256 +``` + +## Environment-Specific Configuration + +### Development + +```bash +NODE_ENV=development +LOG_LEVEL=debug +ENABLE_CORS=true +CORS_ORIGIN=* +``` + +### Staging + +```bash +NODE_ENV=staging +LOG_LEVEL=info +ENABLE_CORS=true +CORS_ORIGIN=https://staging.cosmify.example.com +``` + +### Production + +```bash +NODE_ENV=production +LOG_LEVEL=warn +ENABLE_CORS=true +CORS_ORIGIN=https://cosmify.example.com +RATE_LIMIT_ENABLED=true +``` + +## Monitoring Configuration + +### Health Checks + +Configure health check endpoints: + +```yaml +services: + backend: + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:3001/health"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s +``` + +### Logging + +Configure Winston logger in backend: + +```javascript +// Backend logging configuration +const logger = winston.createLogger({ + level: process.env.LOG_LEVEL || 'info', + format: winston.format.json(), + transports: [ + new winston.transports.File({ filename: 'error.log', level: 'error' }), + new winston.transports.File({ filename: 'combined.log' }), + ], +}); +``` + +## Next Steps + +- [Deployment Guide](/docs/guides/deployment) - Deploy to production +- [Security Best Practices](/docs/guides/security) - Secure your installation +- [Troubleshooting](/docs/guides/troubleshooting) - Common issues and solutions diff --git a/nuxt.config.ts b/nuxt.config.ts index a396595..50f56ea 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -60,7 +60,11 @@ export default defineNuxtConfig({ routes: [ "/sitemap.xml", "/", + "/docs/getting-started/introduction", "/docs/getting-started/installation", + "/docs/getting-started/quick-start", + "/docs/core-concepts/overview", + "/docs/guides/configuration", "/docs/community/contribute-docs", ], },