Skip to content
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

Add detailed self-hosting instructions #605

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ A self-hostable bookmark-everything app with a touch of AI for the data hoarders
- [Screenshots](https://docs.hoarder.app/screenshots)
- [Security Considerations](https://docs.hoarder.app/security-considerations)
- [Development](https://docs.hoarder.app/Development/setup)
- [Self-Hosting Instructions](https://docs.hoarder.app/Installation/docker)

## Demo

Expand All @@ -54,6 +55,41 @@ password: demodemo

The demo is seeded with some content, but it's in read-only mode to prevent abuse.

## Self-Hosting with Docker Compose

To self-host the Hoarder app, follow these steps:

1. **Create a new directory** 📁: Create a new directory to host the compose file and environment variables.
2. **Download the compose file** 📥: Download the Docker Compose file provided here or use the command:
```bash
wget https://raw.githubusercontent.com/hoarder-app/hoarder/main/docker/docker-compose.yml
```
3. **Populate the environment variables** 📝: Create a `.env` file in the directory and add the following minimal environment variables:
```bash
HOARDER_VERSION=release
NEXTAUTH_SECRET=super_random_string
MEILI_MASTER_KEY=another_random_string
NEXTAUTH_URL=http://localhost:3000
```
You can use `openssl rand -base64 36` to generate the random strings. Change the `NEXTAUTH_URL` variable to point to your server address.
4. **Setup OpenAI (optional)** 🤖: To enable automatic tagging, configure OpenAI by adding the API key to the `.env` file:
```bash
OPENAI_API_KEY=<key>
```
5. **Start the service** 🚀: Run the following command to start the service:
```bash
docker compose up -d
```
6. **Access the service** 🌐: Visit `http://localhost:3000` to access the Hoarder app.

Here is the single bash command that captures all the steps:

```bash
eof
mkdir hoarder-app && cd hoarder-app && wget https://raw.githubusercontent.com/hoarder-app/hoarder/main/docker/docker-compose.yml && echo -e "HOARDER_VERSION=release\nNEXTAUTH_SECRET=$(openssl rand -base64 36)\nMEILI_MASTER_KEY=$(openssl rand -base64 36)\nNEXTAUTH_URL=http://localhost:3000" > .env && docker compose up -d
eof
```

## Stack

- [NextJS](https://nextjs.org/) for the web app. Using app router.
Expand Down
4 changes: 3 additions & 1 deletion docker/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ DATA_DIR=/data
MEILI_ADDR=http://127.0.0.1:7700
MEILI_MASTER_KEY=[generate with <openssl rand -base64 36>]
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=[generate with <openssl rand -base64 36>]
NEXTAUTH_SECRET=[generate with <openssl rand -base64 36>]
HOARDER_VERSION=release
OPENAI_API_KEY=[optional]
28 changes: 28 additions & 0 deletions docs/versioned_docs/version-v0.18.0/02-Installation/01-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,31 @@ Updating hoarder will depend on what you used for the `HOARDER_VERSION` env vari

- If you pinned the app to a specific version, bump the version and re-run `docker compose up -d`. This should pull the new version for you.
- If you used `HOARDER_VERSION=release`, you'll need to force docker to pull the latest version by running `docker compose up --pull always -d`.

### Single Bash Command

To automate the entire process, you can use the following single bash command. This command will create the necessary directory, download the compose file, create the `.env` file, and start the service.

```
#!/bin/bash
set -e

# Create directory
mkdir -p hoarder && cd hoarder

# Download docker-compose.yml
wget https://raw.githubusercontent.com/hoarder-app/hoarder/main/docker/docker-compose.yml

# Create .env file
cat <<EOF > .env
HOARDER_VERSION=release
NEXTAUTH_SECRET=$(openssl rand -base64 36)
MEILI_MASTER_KEY=$(openssl rand -base64 36)
NEXTAUTH_URL=http://localhost:3000
EOF

# Start the service
docker compose up -d
```

This script will automate the entire setup process. Just copy and paste it into your terminal and run it.