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.
Tested on:
- macOS Sonoma
- Ubuntu 23.04 Lunar lobster
- (Need testers on Windows)
Interested in helping test on Windows? Join our Discord (opens in a new tab) community.
Prerequisites
- Docker (opens in a new tab)
- At least 4 GB of RAM allocated to the container runtime
Step by step
Install Docker
To install Docker, follow the instructions for your operating system on the Docker website (opens in a new tab).
Download the LearnHouse repository
git clone https://github.com/learnhouse/learnhouse
Go to the directory
cd learnhouse
Configure NextAuth
Add these lines to your .env
file. A template is available under /extra/example-learnhouse-conf.env
.
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=
# NextAuth Configuration
NEXTAUTH_SECRET={generated_secret}
NEXTAUTH_URL=http://localhost:3000/
Build and run LearnHouse
docker-compose up -d
Access LearnHouse
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.
Login to your account
Open your browser and go to http://localhost/login (opens in a new tab) to access the application.
Change your password
After logging in, don't forget to change your password (opens in a new tab)
It is important to change the default password to a another one, reducing the risk of unauthorized access if your server is compromised.
You're all set!
Thanks for using LearnHouse 🎉
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.
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)
# 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
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 (opens in a new tab), 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.