simplify docker setup

This commit is contained in:
LUIS NOVO 2024-11-14 09:50:33 -03:00
parent d7a8bbf435
commit cd3ad2e9fa
7 changed files with 54 additions and 73 deletions

View file

@ -8,7 +8,7 @@ PLATFORMS=linux/amd64,linux/arm64
#,linux/arm/v7,linux/386
database:
docker compose up surrealdb
docker compose --profile db_only up
run:
poetry run streamlit run app_home.py

View file

@ -109,40 +109,41 @@ Learn more about our project at [https://www.open-notebook.ai](https://www.open-
Go to the [Setup Guide](docs/SETUP.md) to learn how to set up the tool in details.
To setup with Docker/Portainer:
```yaml
version: '3'
services:
surrealdb:
image: surrealdb/surrealdb:v2
ports:
- "8000:8000"
volumes:
- surreal_data:/mydata
command: start --log trace --user root --pass root rocksdb:/mydata/mydatabase.db
pull_policy: always
user: root
open_notebook:
image: lfnovo/open_notebook:latest
ports:
- "8080:8502"
env_file:
- ./docker.env
depends_on:
- surrealdb
pull_policy: always
volumes:
surreal_data:
```
You don't need to clone this repo if you just want to use the app without building from source!
Take a look at the [Open Notebook Boilerplate](https://github.com/lfnovo/open-notebook-boilerplate) repo with a sample of how to set it up for maximum feature usability.
### Running from source
Start by cloning this repo and cd into it.
```bash
git clone https://github.com/lfnovo/open-notebook
cd open-notebook
```
Rename `.env.example` into `.env` and set up your API keys.
Also, repeat the process for `docker.env` if you plan to run this using docker.
```bash
cp .env.example .env
cp .env.example docker.env
```
Edit .env for your API keys.
To run the source code locally and experiment with the code, you just need to run:
```bash
poetry install
docker compose --profile db_only up
poetry run streamlit run app_home.py
```
If you don't want to mess around with the code and just want to run it as a docker image:
```bash
docker compose --profile multi up
```
<p align="right">(<a href="#readme-top">back to top</a>)</p>

View file

@ -1,24 +0,0 @@
version: '3'
services:
surrealdb:
image: surrealdb/surrealdb:v2
ports:
- "8000:8000"
volumes:
- ./.docker_data/surreal-data:/mydata
user: "${UID}:${GID}"
command: start --log trace --user root --pass root rocksdb:mydatabase.db
pull_policy: always
open_notebook:
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:8502"
volumes:
- ./.docker_data/data:/app/data
- ./docker.env:/app/.env
- ./google-credentials.json:/app/google-credentials.json
depends_on:
- surrealdb

View file

@ -1,13 +0,0 @@
version: '3'
services:
open_notebook_full:
build:
context: .
dockerfile: Dockerfile_full
ports:
- "8080:8502"
volumes:
- ./.docker_data/data:/app/data
- ./docker2.env:/app/.env
- ./google-credentials.json:/app/google-credentials.json

View file

@ -1,5 +1,7 @@
version: '3'
# Instructions on how to use the different compose profiles
# 1. Run `docker compose --profile single up` to start the app and database on the same container
# 2. Run `docker compose --profile multi up` to start the multi container with app and database separate
# 3. Run `docker compose --profile db_only up` to start the database only -- useful if developing locally
services:
surrealdb:
image: surrealdb/surrealdb:v2
@ -10,7 +12,7 @@ services:
command: start --log trace --user root --pass root rocksdb:/mydata/mydatabase.db
pull_policy: always
user: root
profiles: [db_only, multi]
open_notebook:
image: lfnovo/open_notebook:latest
ports:
@ -20,8 +22,21 @@ services:
depends_on:
- surrealdb
pull_policy: always
profiles: [multi]
volumes:
- notebook_data:/app/data
open_notebook_single:
build:
context: .
dockerfile: Dockerfile.single
ports:
- "8080:8502"
profiles:
- single
volumes:
- ./.docker_data/data:/app/data
- ./docker2.env:/app/.env
- ./google-credentials.json:/app/google-credentials.json
volumes:
surreal_data:

View file

@ -78,6 +78,8 @@ Several new providers are supported now:
- Vertex AI
- Gemini
- Ollama
- Groq
- xAI
All providers are installed out of the box. All you need to do is to setup the environment variable configurations (API Keys, etc) for your selected provider and decide which models to use.