-
-
Notifications
You must be signed in to change notification settings - Fork 0
Feat - Made the app more self hostable #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
54e887e
Add Docker support and environment configuration
Yavnik 85c7762
Enhance environment configuration and add deployment documentation
Yavnik 552cad5
Update package.json with project metadata and keywords
Yavnik c9348f6
Update src/app/api/health/route.ts
Yavnik 6998d16
Update Dockerfile
Yavnik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| # Dependencies | ||
| node_modules | ||
| bun.lock | ||
| package-lock.json | ||
| yarn.lock | ||
|
|
||
| # Next.js build output | ||
| .next | ||
| out | ||
|
|
||
| # Environment variables | ||
| .env | ||
| .env.local | ||
| .env.development.local | ||
| .env.test.local | ||
| .env.production.local | ||
|
|
||
| # IDE | ||
| .vscode | ||
| .idea | ||
| *.swp | ||
| *.swo | ||
| *~ | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Git | ||
| .git | ||
| .gitignore | ||
|
|
||
| # Docker | ||
| Dockerfile* | ||
| docker-compose* | ||
| .dockerignore | ||
|
|
||
| # Documentation | ||
| README.md | ||
| CLAUDE.md | ||
| LICENSE | ||
|
|
||
| # Logs | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| .pnpm-debug.log* | ||
|
|
||
| # Runtime data | ||
| pids | ||
| *.pid | ||
| *.seed | ||
| *.pid.lock | ||
|
|
||
| # Coverage directory used by tools like istanbul | ||
| coverage | ||
| *.lcov | ||
|
|
||
| # nyc test coverage | ||
| .nyc_output | ||
|
|
||
| # ESLint cache | ||
| .eslintcache | ||
|
|
||
| # Optional REPL history | ||
| .node_repl_history | ||
|
|
||
| # Output of 'npm pack' | ||
| *.tgz | ||
|
|
||
| # Yarn Integrity file | ||
| .yarn-integrity | ||
|
|
||
| # parcel-bundler cache | ||
| .cache | ||
| .parcel-cache | ||
|
|
||
| # Temporary folders | ||
| tmp/ | ||
| temp/ | ||
|
|
||
|
|
||
| # Development scripts | ||
| scripts/dev* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,52 @@ | ||
| # Database Configuration | ||
| DATABASE_URL=postgresql://username:password@localhost:5432/command_center | ||
| # =========================================== | ||
| # REQUIRED FOR DOCKER DEPLOYMENT | ||
| # =========================================== | ||
|
|
||
| # Your public URL (e.g., https://commandops.yourdomain.com or http://localhost:3000) | ||
| NEXT_PUBLIC_BASE_URL=http://localhost:3000 | ||
|
|
||
| # Authentication secret - Generate with: openssl rand -base64 32 | ||
| BETTER_AUTH_SECRET=your-super-secure-secret-key-min-32-chars | ||
|
|
||
| # Database password for PostgreSQL (used by Docker Compose) | ||
| POSTGRES_PASSWORD=your-secure-db-password | ||
|
|
||
| # Redis password (used by Docker Compose) | ||
| REDIS_PASSWORD=your-secure-redis-password | ||
|
|
||
| # =========================================== | ||
| # REQUIRED FOR LOCAL DEVELOPMENT ONLY | ||
| # =========================================== | ||
|
|
||
| # Database URL (for local dev only; Docker Compose overrides this) | ||
| DATABASE_URL=postgresql://postgres:your-secure-db-password@localhost:5432/command_ops | ||
|
|
||
| # Authentication | ||
| BETTER_AUTH_SECRET=your-secret-key-here | ||
| BETTER_AUTH_URL=http://localhost:3000 | ||
|
|
||
| # Google OAuth | ||
| # =========================================== | ||
| # OAUTH (Currently Required) | ||
| # =========================================== | ||
|
|
||
| # Google OAuth (get from Google Cloud Console) | ||
| GOOGLE_CLIENT_ID= | ||
| GOOGLE_CLIENT_SECRET= | ||
|
|
||
| # GitHub OAuth | ||
| # GitHub OAuth (get from GitHub Developer Settings) | ||
| GITHUB_CLIENT_ID= | ||
| GITHUB_CLIENT_SECRET= | ||
|
|
||
| # Self-hosted Redis for Rate Limiting | ||
| REDIS_HOST=localhost | ||
| REDIS_PORT=6379 | ||
| REDIS_PASSWORD= # Leave empty if no password | ||
| REDIS_DB=0 # Default database | ||
| # =========================================== | ||
| # OPTIONAL - ANALYTICS | ||
| # =========================================== | ||
|
|
||
|
|
||
| # PostHog Configuration | ||
| # PostHog Analytics (optional) | ||
| NEXT_PUBLIC_POSTHOG_KEY= | ||
| NEXT_PUBLIC_POSTHOG_HOST= | ||
|
|
||
| # =========================================== | ||
| # LOCAL DEV REDIS SETTINGS (Not needed for Docker) | ||
| # =========================================== | ||
|
|
||
| REDIS_HOST=localhost | ||
| REDIS_PORT=6379 | ||
| REDIS_DB=0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| # Self-Hosting Guide | ||
|
|
||
| Deploy Command Ops on your own infrastructure using Docker. | ||
|
|
||
| ## Quick Start | ||
|
|
||
| 1. **Clone and configure:** | ||
| ```bash | ||
| git clone https://github.com/Yavnik/commandops.git | ||
| cd commandops | ||
| cp .env.example .env | ||
| ``` | ||
|
|
||
| 2. **Edit your `.env` file:** | ||
| ```bash | ||
| nano .env | ||
| ``` | ||
|
|
||
| Set these required variables: | ||
| - `NEXT_PUBLIC_BASE_URL` - Your domain (e.g., `https://commandops.yourdomain.com` or `http://192.168.1.100:3000`) | ||
| - `BETTER_AUTH_SECRET` - Random string, 32+ characters (generate with `openssl rand -base64 32`) | ||
| - `POSTGRES_PASSWORD` - Secure database password | ||
| - `REDIS_PASSWORD` - Secure Redis password | ||
|
|
||
| 3. **Deploy:** | ||
| ```bash | ||
| docker compose up -d --build | ||
| ``` | ||
|
|
||
| 4. **Access your instance:** | ||
|
|
||
| Open `http://localhost:3000` (or your configured domain) and create your account. | ||
|
|
||
| That's it! Your self-hosted Command Ops is ready. | ||
|
|
||
| ## Configuration | ||
|
|
||
| ### Required Environment Variables | ||
|
|
||
| | Variable | Description | Example | | ||
| |----------|-------------|---------| | ||
| | `NEXT_PUBLIC_BASE_URL` | Public URL of your deployment | `https://commandops.example.com` | | ||
| | `BETTER_AUTH_SECRET` | Auth secret key (32+ chars) | `your-random-secret-key-here` | | ||
| | `POSTGRES_PASSWORD` | Database password | `secure_db_password` | | ||
| | `REDIS_PASSWORD` | Redis password | `secure_redis_password` | | ||
|
|
||
| ### OAuth Login (Currently Required) | ||
|
|
||
| > **Note:** Google and GitHub OAuth credentials are currently required for authentication. We're working on making them optional for self-hosted instances. Stay tuned! | ||
|
|
||
| **Google OAuth:** | ||
|
|
||
| 1. Create OAuth credentials at [Google Cloud Console](https://console.cloud.google.com/) | ||
| 2. Add authorized origins and redirect URIs | ||
| 3. Set in `.env`: | ||
| ```bash | ||
| GOOGLE_CLIENT_ID=your_client_id | ||
| GOOGLE_CLIENT_SECRET=your_client_secret | ||
| ``` | ||
|
|
||
| **GitHub OAuth:** | ||
|
|
||
| 1. Create OAuth App at [GitHub Settings > Developer settings](https://github.com/settings/developers) | ||
| 2. Set callback URL to `{YOUR_DOMAIN}/api/auth/callback/github` | ||
| 3. Set in `.env`: | ||
| ```bash | ||
| GITHUB_CLIENT_ID=your_client_id | ||
| GITHUB_CLIENT_SECRET=your_client_secret | ||
| ``` | ||
|
|
||
| ### Optional: Analytics | ||
|
|
||
| To enable PostHog analytics: | ||
| ```bash | ||
| NEXT_PUBLIC_POSTHOG_KEY=your_posthog_key | ||
| NEXT_PUBLIC_POSTHOG_HOST=https://app.posthog.com | ||
| ``` | ||
|
|
||
| ## Maintenance | ||
|
|
||
| ### View Logs | ||
|
|
||
| ```bash | ||
| docker compose logs -f # All services | ||
| docker compose logs -f app # Application only | ||
| docker compose logs -f postgres # Database only | ||
| ``` | ||
|
|
||
| ### Update to Latest Version | ||
|
|
||
| ```bash | ||
| git pull | ||
| docker compose down | ||
| docker compose up -d --build | ||
| ``` | ||
|
|
||
| ## What's Included | ||
|
|
||
| The `docker-compose.yml` sets up: | ||
| - **App**: Next.js application (exposed on port 3000) | ||
| - **PostgreSQL**: Database with persistent storage | ||
| - **Redis**: For rate limiting and caching | ||
| - **Migrations**: Automatic database schema setup on first run | ||
|
|
||
| All data is stored in Docker volumes and persists across restarts. | ||
|
|
||
| ## Need Help? | ||
|
|
||
| - Check logs: `docker compose logs -f` | ||
| - Ensure all required environment variables are set | ||
| - Verify Docker and Docker Compose are up to date | ||
| - [Open an issue](https://github.com/Yavnik/commandops/issues) on GitHub | ||
|
|
||
| --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Health check correctly implemented.
Using
wgetfor the health check is appropriate for Alpine-based images, and the/api/healthendpoint provides a lightweight verification that the app is responsive.Verify that the health endpoint exists and returns a successful status:
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 728
Add or correct the
/api/healthhandlerNo implementation for
/api/healthwas found in the codebase; either create the API route (e.g. app/api/health/route.ts returning 200) or update the Docker HEALTHCHECK to use an existing endpoint.🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The health check route already exists in app/api/health/route.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Length of output: 69
@Yavnik, you're absolutely right, and I apologize for the incorrect comment. The health check route does exist at
src/app/api/health/route.tswith a proper implementation:The health check in the Dockerfile is correctly configured to use this endpoint. Thank you for the correction!