feat: new self hosting guide

This commit is contained in:
swve
2025-11-03 20:30:13 +01:00
parent 4dc4f27a0e
commit 8d7f016cfa
3 changed files with 82 additions and 100 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@@ -1,127 +1,91 @@
import { Callout } from 'nextra-theme-docs'
import { Steps } from 'nextra-theme-docs'
# Self hosting guide
# Self Hosting Guide
We use Docker & Docker Compose to run LearnHouse, this makes it easy to run the application on any machine that has Docker installed.
LearnHouse Community Edition is designed for self-hosting on your own infrastructure. We use Docker & Docker Compose to make it easy to run LearnHouse on any machine.
Tested on:
- macOS Sonoma
- Ubuntu 23.04 Lunar lobster
- (Need testers on Windows)
<Callout type="info" emoji="🛠">
Interested in helping test on Windows? Join our [Discord](https://discord.com/invite/CMyZjjYZ6x) community.
<Callout type="info" emoji="🚀">
**For complete installation instructions, please visit the [LearnHouse Community Edition repository](https://github.com/learnhouse/community-edition)**. This repository contains the latest Docker Compose setup, detailed configuration guides, and troubleshooting information.
</Callout>
## Quick Start
**TLDR**: Clone the repository, copy `.env.example` to `.env`, configure your admin credentials, and run `docker-compose -f docker-compose.yml up -d`. Should be ready in less than 2 minutes!
```bash
git clone https://github.com/learnhouse/community-edition.git
cd community-edition
cp .env.example .env
# Edit .env with your configuration
docker-compose -f docker-compose.yml up -d
```
## Prerequisites
- [Docker](https://docs.docker.com/get-docker/)
- At least 4 GB of RAM allocated to the container runtime
- **Docker Engine 20.10+** and **Docker Compose 2.0+**
- At least **2GB RAM**
- **10GB+ disk space**
- A domain name (optional, for production; use `localhost` for local development)
## Step by step
## Key Features
<Steps>
### Install Docker
To install Docker, follow the instructions for your operating system on the [Docker website](https://docs.docker.com/get-docker/).
The Community Edition includes:
### Download the LearnHouse repository
- **Multi-container architecture** with PostgreSQL, Redis, and nginx
- **Environment-based configuration** via `.env` file
- **Initial admin setup** with configurable credentials
- **Production-ready** deployment options
- **Data persistence** with Docker volumes
- **Health checks** for all services
- **Comprehensive monitoring** and logging
```bash copy
git clone https://github.com/learnhouse/learnhouse
```
#### Go to the directory
## Important Configuration
```shell copy
cd learnhouse
```
Before first start, make sure to set:
### Configure NextAuth
- `LEARNHOUSE_INITIAL_ADMIN_EMAIL`: Email for the first admin user
- `LEARNHOUSE_INITIAL_ADMIN_PASSWORD`: Password for the first admin user
- `NEXTAUTH_SECRET`: Generate with `openssl rand -base64 32`
- `LEARNHOUSE_AUTH_JWT_SECRET_KEY`: Generate with `openssl rand -base64 32`
Add these lines to your `.env` file. A template is available under `/extra/example-learnhouse-conf.env`.
<Callout type="info">
To safely encrypt tokens and email hashes, you need a NextAuth secret.
To create one, either run `npx auth secret`, or on UNIX based systems (MacOS/Linux) you can use `openssl rand -base64 33`.
Copy this string into your .env file as NEXTAUTH_SECRET=
<Callout type="warning">
**⚠️ Important**: Change the admin password after first login! The default credentials are only for initial setup.
</Callout>
```env filename=".env" copy
# NextAuth Configuration
NEXTAUTH_SECRET={generated_secret}
NEXTAUTH_URL=http://localhost:3000/
```
## Architecture
### Build and run LearnHouse
LearnHouse Community Edition uses a multi-container architecture:
```shell copy
docker-compose up -d
```
- **learnhouse-app**: Combined Next.js frontend and FastAPI backend (includes internal nginx on port 80)
- **nginx**: Reverse proxy (port 80 externally)
- **db**: PostgreSQL database
- **redis**: Redis cache
### Access LearnHouse
All containers communicate via a Docker network.
When running the application for the first time, an admin account and organization is created for you, look for the admin credentials in the logs.
## Access LearnHouse
#### Login to your account
After starting, access LearnHouse at:
- **Frontend**: http://localhost
Open your browser and go to [http://localhost/login?orgslug=default](http://localhost/login?orgslug=default) to access the application.
Login with the initial admin credentials you configured in `.env`.
#### Change your password
## Further Configuration
After logging in, don't forget to [change your password](http://localhost/dash/user-account/settings/security)
For detailed information on:
- Environment variables
- Production deployment
- Data persistence and backups
- Monitoring and troubleshooting
- Advanced configuration options
<Callout type="warning" >
It is important to change the default password to a another one, reducing the risk of unauthorized access if your server is compromised.
</Callout>
Please visit the **[LearnHouse Community Edition repository](https://github.com/learnhouse/community-edition)**.
### You're all set!
You can also check our [configuration guide](/self-hosting/configuration) for additional LearnHouse-specific settings like AI features, email configuration, S3 storage, and more.
Thanks for using LearnHouse 🎉
## Found bugs?
</Steps>
## Further configuration
You should be ready to go when following the steps above but if you'd live to enable features like **AI**, **Emails**, **Multi-org**, or customize the application, check the [configuration guide](/self-hosting/configuration).
### Environment variables usage with the LearnHouse Docker image
You can mix frontend and backend env vars defined in the COnfiguration page, in a single file like the one included on the repository (extra/example-learnhouse-conf.env)
```env filename="extra/example-learnhouse-conf.env" copy
# Frontend
NEXT_PUBLIC_LEARNHOUSE_MULTI_ORG=false
NEXT_PUBLIC_LEARNHOUSE_DEFAULT_ORG=default
# Backend
LEARNHOUSE_COOKIE_DOMAIN=.localhost
LEARNHOUSE_SQL_CONNECTION_STRING=postgresql://learnhouse:learnhouse@db:5432/learnhouse
LEARNHOUSE_REDIS_CONNECTION_STRING=redis://redis:6379/learnhouse
```
```yaml filename="docker-compose.yml" {7-8} copy
app:
build: .
ports:
- "80:80"
volumes:
- .:/usr/learnhouse
env_file:
- ./extra/example-learnhouse-conf.env
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
```
## Found bugs ?
If you find any bugs or have any suggestions, please open an issue on our [GitHub repository](https://github.com/learnhouse/learnhouse/issues/new/choose), we would love to hear from you.
If you find any bugs or have suggestions, please open an issue on the [Community Edition repository](https://github.com/learnhouse/community-edition/issues), we would love to hear from you.
Please include as much information as possible, like the steps to reproduce the bug, the expected behavior and the actual behavior.

View File

@@ -2,6 +2,29 @@
LearnHouse is open source software and can be installed and maintained on just about any Cloud provider. We also support different hosting schemas like using AWS S3 or CloudFlare R2 for content storage.
### Quick Start
**TLDR**: `cp .env.example .env` and run `docker-compose -f docker-compose.yml up -d` and inspect the logs, should be ready to go in less than 2 mins
### Prerequisites
- Docker Engine 20.10+ and Docker Compose 2.0+
- At least 2GB RAM
- 10GB+ disk space
- A domain name (optional, for production; use `localhost` for local development)
### Get Started
For detailed installation instructions, configuration options, and troubleshooting guides, please visit the **[LearnHouse Community Edition repository](https://github.com/learnhouse/community-edition)**.
The Community Edition includes:
- Complete Docker Compose setup
- PostgreSQL database
- Redis cache
- Built-in reverse proxy (nginx)
- Environment-based configuration
- Production-ready deployment guide
## LearnHouse Cloud vs Self Hosting
A common question we get from developers is whether they should use our official platform, or host the codebase on their own server independently. Deciding which option is best for you comes with some nuance, so below is a breakdown of the differences to help you decide what will fit your needs best.
@@ -20,11 +43,6 @@ A common question we get from developers is whether they should use our official
| 🚑 Product Support | Email | Community |
| 💟 Where your money goes | Supporting the team + New Features in LearnHouse | 3rd party companies |
## Prerequisites
- [Docker](https://docs.docker.com/get-docker/)
- A server with at least 2GB of RAM
## Guides
- [Self hosting Guide](/self-hosting/hosting-guide)