This guide provides step-by-step instructions for setting up a complete NBForge development environment on your local machine (Mac or Linux).
When developing locally, you'll need the following components:
- PostgreSQL - Database for storing application data
- MinIO - S3-compatible storage for notebooks and results
- Backend - FastAPI application for API endpoints
- Frontend - Vue.js application for the user interface
- Notebook Runner - Component for executing notebooks
You have two options for development:
- Option 1: Run PostgreSQL, MinIO, backend and frontend directly on your host (simplest for getting started)
- Option 2: Run PostgreSQL and MinIO on your host, and both backend and frontend in Minikube with Ingress (for testing the complete Kubernetes deployment)
- Docker
- Python 3.10 or later with pyenv or Anaconda
- Node.js 16 or later
- npm or yarn
- Git
- Minikube (for Option 2)
- kubectl (for Option 2)
This option is best for frontend and backend development when you don't need to test notebook execution.
# Create a Docker volume for persistent data
docker volume create nbforge-postgres-data
# Run PostgreSQL container
docker run -d \
--name nbforge-postgres \
-e POSTGRES_USER=nbforge \
-e POSTGRES_PASSWORD=nbforge \
-e POSTGRES_DB=nbforge \
-p 5432:5432 \
-v nbforge-postgres-data:/var/lib/postgresql/data \
postgres:14# Create Docker volumes for MinIO
docker volume create nbforge-minio-data
# Run MinIO container
docker run -d \
--name nbforge-minio \
-p 9000:9000 \
-p 9001:9001 \
-e "MINIO_ROOT_USER=minioadmin" \
-e "MINIO_ROOT_PASSWORD=minioadmin" \
-v nbforge-minio-data:/data \
minio/minio server /data --console-address ":9001"After MinIO starts:
- Open http://localhost:9001 in your browser
- Log in with minioadmin / minioadmin
- Create a bucket named "nbforge"
cd backend
# Create a virtual environment with pyenv or Anaconda
pyenv virtualenv 3.10.0 nbforge-env
pyenv activate nbforge-env
# Install dependencies
pip install -r requirements.txt
# Create a .env file
cat > .env << EOF
API_URL=http://localhost:8000/api/v1
DATABASE_URL=postgresql://nbforge:nbforge@localhost:5432/nbforge
S3_ENDPOINT=http://localhost:9000
AWS_ACCESS_KEY_ID=minioadmin
AWS_SECRET_ACCESS_KEY=minioadmin
S3_BUCKET=nbforge
SECRET_KEY=dev-secret-key-for-local-testing-only
ENV=development
API_PREFIX=/api/v1
LOG_LEVEL=DEBUG
CORS_ORIGINS=http://localhost:8080
EOF
# Run database migrations
alembic upgrade head
# Start the backend server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000cd frontend
# Install dependencies
npm install
# Create a .env file
cat > .env.local << EOF
VUE_APP_API_URL=http://localhost:8000
VUE_APP_TITLE=NBForge (Local)
EOF
# Start the development server
npm run devAfter starting both the backend and frontend, you need to create the first admin account. You can do this in two ways:
Using the create_superuser.py script:
# Option 1: Create a new admin user (requires password)
python backend/scripts/create_superuser.py admin@example.com your_secure_password
# Option 2: Make an existing user an admin (no password needed)
python backend/scripts/create_superuser.py existing_user@example.comAfter creating the admin account, you can:
- Navigate to http://localhost:8080
- Log in with your admin credentials
- Access the admin panel at http://localhost:8080/admin
Navigate to http://localhost:8080 to test most of the nbforge web app functions, except submit executions. To end-to-end test the executions, please follow option 2 below.
This option runs PostgreSQL and MinIO on your host machine while running both the backend and frontend in Minikube with an Ingress for unified access.
Follow Steps 1 and 2 from Option 1 to set up PostgreSQL and MinIO.
# Start Minikube with enough resources and enable the ingress addon
minikube start --cpus 4 --memory 8192
# you only need to run the next commands once to set things up on your machine
minikube addons enable ingress
# Make your host services accessible inside Minikube
echo "$(minikube ip) host.minikube.internal" | sudo tee -a /etc/hosts
# Add nbforge.local to your hosts file
echo 127.0.0.1 nbforge.local" | sudo tee -a /etc/hostsImportant: before proceeding to the next steps, run this command to this command sets up your shell so that any Docker commands you run will interact with the Docker daemon inside Minikube.
Note that the PostgreSQL and MinIO containers on run on your laptop's Docker engine - the one you usually use for building and running containers locally. The NBForge web app conterians run inside Minikube, which provides a small Kubernetes cluster on your machine. This setup lets you test parts of the app in a full Kubernetes environment while still using your regular Docker for database and storage services.
(You can of course choose to run PostgreSQL and MinIO in Minikube too, as long as you change the address for those service accordingly in the .env setting files.)
eval $(minikube docker-env)# Navigate to the project root
cd /path/to/nbforge
# Build backend image
cd backend
docker build -t nbforge/backend:latest .
# Build frontend image
cd ../frontend
docker build -t nbforge/frontend:latest .
# Build notebook runner
cd ../notebook_runner
docker build -t nbforge/notebook-runner:latest .# Update the secrets in backend.yaml with your encoded values
cd /path/to/nbforge/deployment_new/local
echo -n "postgresql://nbforge:nbforge@host.minikube.internal:5432/nbforge" | base64
echo -n "minioadmin" | base64 # For MinIO credentials
echo -n "dev-secret-key" | base64
# Deploy the backend and frontend
kubectl apply -f backend.yaml
kubectl apply -f frontend.yaml
kubectl apply -f ingress.yaml
kubectl apply -f rbac.yaml
# Wait for deployments to be ready
kubectl wait --for=condition=available deployment/backend --timeout=120s
kubectl wait --for=condition=available deployment/frontend --timeout=120sTo see the status and logs of the Minikube cluster, you could use the Minikube Dashboard by running
minikube dashboard
After the deployments are ready, follow these steps so that you can access NBForge in your browser.
# In a new terminal window
minikube tunnelThen run
kubectl patch svc ingress-nginx-controller -n ingress-nginx \
-p '{"spec": {"type": "LoadBalancer"}}'you can access your application at:
http://nbforge.local
All API requests from your frontend to the backend will be routed through the Ingress at /api/v1/*.
After the deployment is complete, you need to create the first admin account. You can do this in two ways:
Using the create_superuser.py script:
# Get the backend pod name
BACKEND_POD=$(kubectl get pod -l app=backend -o jsonpath='{.items[0].metadata.name}')
# Option 1: Create a new admin user (requires password)
kubectl exec -it $BACKEND_POD -- python /app/scripts/create_superuser.py admin@example.com your_secure_password
# Option 2: Make an existing user an admin (no password needed)
kubectl exec -it $BACKEND_POD -- python /app/scripts/create_superuser.py existing_user@example.comAfter creating the admin account, you can:
- Navigate to http://nbforge.local
- Log in with your admin credentials
- Access the admin panel at http://nbforge.local/#/admin/users
- Check that everything is running:
kubectl get pods
kubectl get services
kubectl get ingress- Test the API endpoint directly:
curl http://nbforge.local/api/v1/health- Check backend logs:
kubectl logs deployment/backend- Check frontend logs:
kubectl logs deployment/frontendOnce your application is running in Minikube with Ingress, you can test API endpoints using service account keys:
-
Create a service account:
- Navigate to http://nbforge.local
- Log in with admin credentials
- Go to Admin → Service Accounts
- Create a new service account and save the API key
-
Use the API key to test endpoints:
# Replace YOUR_SERVICE_ACCOUNT_KEY with your actual key
curl -H "Authorization: Bearer YOUR_SERVICE_ACCOUNT_KEY" http://nbforge.local/api/v1/notebooksWhen running in Minikube, the notebook runner will be executed as a Kubernetes job:
-
Execute the notebook from the UI
-
Check the job status:
kubectl get jobs- Check job logs:
# Replace JOB_NAME with the actual job name from the above command
kubectl logs job/JOB_NAME-
Cannot connect to host PostgreSQL or MinIO from Minikube
- Ensure
host.minikube.internalis properly set up - Check your host firewall settings
- Verify PostgreSQL accepts remote connections
- Ensure
-
Images not found in Minikube
- Verify with
minikube image list | grep nbforge - Rebuild and reload images if necessary
- Verify with
-
Ingress not working
- Check Ingress status:
kubectl get ingress - Verify the Ingress controller is running:
kubectl get pods -n ingress-nginx - Check Ingress controller logs:
kubectl logs -n ingress-nginx -l app.kubernetes.io/component=controller
- Check Ingress status:
-
Cannot resolve nbforge.local
- Verify the hosts file entry is correct
- Try using the Minikube IP directly as a test
-
Jobs fail to execute
- Check job logs:
kubectl logs job/notebook-runner-JOBID - Verify S3 credentials and endpoint
- Ensure MinIO bucket exists
- Check job logs: