* chore(dev): run one threads Celery worker with beat in dev The Docker and native dev stacks start a single Celery worker for every queue, with redbeat embedded, instead of a worker, an export worker and a beat process. It uses a new ThreadsPool that sends worker_process_init, so telemetry and the lazy import check still run under the threads pool. * fix(ws): stop closing every event loop's Redis pools after a broadcast send_messages_to_channel_group called channel_layer.close_pools(), which closes the pools of every event loop, including the ones other worker threads are still sending with. Under the threads pool about a third of broadcasts failed with "attached to a different loop" and some hung. channels_redis now closes a loop's pools itself when that loop closes. * fix(telemetry): keep Celery trace context per thread on threads workers The Celery instrumentation keys a running task's span, context token and start time by the task's id. A task replaced with self.replace(), like every automation node, keeps its id, and on a threads worker the replacement can start in another thread before the original ends. The original then ended the replacement's span and detached its context from the wrong thread, logging "Failed to detach context" and leaving its own context on the thread. That state is now kept per thread. * feat(celery): enforce soft and hard time limits in ThreadsPool Celery's own threads pool ignores soft_time_limit and time_limit, so on a threads worker tasks that rely on them would run on. ThreadsPool now raises the limit in the task's thread, only while that task runs, so a limit never reaches the next task of the thread. EMAIL_TIMEOUT stops a silent SMTP server from blocking a worker thread forever. * fix(chat-runs): cancel a run that keeps going after its deadline The deadline only asks a run to stop. A run whose tools or provider call ignore that request now gets 60 more seconds, is then cancelled, and is saved as timed out. Celery's limit moves after that, so the run's own stop always comes first. On a threads worker this is the only way to end it, because a time limit can't reach a thread waiting inside async_to_sync. * fix(premium): share one capped thread pool across AI field generations Each generation started its own pool of BASEROW_AI_FIELD_MAX_CONCURRENT_GENERATIONS threads, so a threads worker running several jobs multiplied the threads and model calls. All generations in a process now share one pool of that size. A prefork process runs one job at a time, so nothing changes there. * feat(celery): cancel queries at the hard limit and report overdue tasks ThreadsPool checks every running task's time limits from one watchdog thread, like the prefork pool's timeout handler, instead of starting timer threads for each task. At the hard limit it also cancels the query the task's thread is running, which the limit's exception can't interrupt. A thread can't be killed, so a task still running 60 seconds after its hard limit is reported to Sentry instead. Every limit reached is counted in baserow.celery.task.time_limit, per task and limit. * fix(airtable): time out requests to Airtable Two Airtable import requests had no timeout, so a server that stopped answering held the import, and on a threads worker its thread, forever. All Airtable requests now use the same 3 minute read timeout. * fix(celery): load sentry_sdk only when reporting an overdue task The overdue report imported sentry_sdk at the top of baserow.config.celery, which every process imports, so it was loaded even with Sentry off. * chore: add a changelog entry for the Celery task timeouts * fix(celery): raise threads pool time limits at the task's next query An exception raised into a thread from outside can land right after a lock is taken and before the code that releases it, leaving the lock held for every thread of the worker. The pool now marks a reached limit and the task's own next query raises it, once, through a connection execute wrapper. The hard limit still cancels the running query, and raises TimeLimitExceeded whatever the soft limit is. Limits end before Celery's success callback runs. Savepoint queries are never interrupted, through a helper shared with the periodic field update deadline. * fix(celery): apply the worker default time limits on the threads pool Celery passes CELERY_TASK_SOFT_TIME_LIMIT and CELERY_TASK_TIME_LIMIT to the pool and None per task when a task sets no limit. The prefork pool falls back to the pool's values; the threads pool now does too. * fix(celery): keep threads pool time limits until running tasks end The watchdog stopped before on_stop waited for the running tasks, so a task passing its limit during a warm shutdown was never stopped or reported. * chore: name the emails the SMTP timeout covers in the changelog EMAIL_TIMEOUT applies to the instance's own emails only. Automation and builder SMTP steps already time out after 30 seconds. * chore(dev): drop dev.sh tabs for the removed Celery workers The export and beat services are disabled, so attaching to them made the script exit before opening the remaining tabs. * test(celery): cover thread time limits and savepoint rollback * fix(ai): use one generation slot for nonpositive limits * fix(chat): warn that an action may finish after a reply times out * docs(celery): explain which timeout guarantees require prefork * docs(celery): record the threads pool decision and task contract * fix(chat): keep the worker slot until started tools finish * fix(chat): warn visitors about repeating a timed-out request * docs(chat): clarify when the stop grace period begins
11 KiB
Running the Dev Environment Locally (Without Docker)
This guide covers running Baserow's backend and frontend natively on your machine, using Docker only for infrastructure services (PostgreSQL, Redis). This approach offers faster iteration, easier debugging, and better IDE integration compared to full Docker development.
Prerequisites
Required Tools
-
Docker - For running PostgreSQL, Redis, and other services
- Install from https://docs.docker.com/desktop/
-
just - Command runner
# macOS brew install just # Linux curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/.local/bin -
Python 3.14 - For the backend
# macOS brew install python@3.14 # Linux (Ubuntu/Debian) sudo apt install python3.14 python3.14-dev -
uv - Fast Python package manager
# macOS brew install uv # Linux curl -LsSf https://astral.sh/uv/install.sh | sh -
Node.js 24.15 or later (24.x) - For the frontend
# Using nvm (recommended) curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash nvm install 24 nvm use 24 # macOS with Homebrew brew install node@24Older 24.x versions fail
yarn installwithThe engine "node" is incompatible with this module; runnvm install 24again (orbrew upgrade node@24) to get the latest 24.x. nvm keeps global packages per Node version, so runnpm install -g yarnagain after switching. -
Yarn - Frontend package manager
npm install -g yarn -
Git - Install from https://git-scm.com/downloads
See supported.md for minimum version requirements.
Verify Installation
docker -v
just --version
python3 --version
uv --version
node -v
yarn -v
git --version
Quick Start
# Clone the repository
git clone --branch develop https://github.com/baserow/baserow.git
cd baserow
# Initialize backend and frontend (creates venv, installs deps, creates .env.local)
just init
# Start everything (Ctrl+C to stop)
just dev up
Once started, access:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- Mailhog (email testing): http://localhost:8025
To run in background:
just dev up -d # Start in background
just dev logs # View logs
just dev ps # Check what's running
just dev stop # Stop all services
just dev tmux # Alternative: start tmux session with all services (you need to install tmux first)
How It Works
The just dev up command orchestrates:
- Docker services: PostgreSQL, Redis, Mailhog, OpenTelemetry collector
- Database migrations: Applied automatically
- Backend server: Django development server on port 8000
- Celery worker: One worker for every queue, with the beat scheduler inside it
- Frontend server: Nuxt development server on port 3000
just dev up
├── Docker: db, redis, mailhog, otel-collector
├── Backend: Django dev server (port 8000)
├── Celery: one worker for every queue, with beat
└── Frontend: Nuxt dev server (port 3000)
All processes log to /tmp/:
/tmp/baserow-backend.log/tmp/baserow-celery.log/tmp/baserow-web-frontend.log
Environment Configuration
The .env.local File
The just init command creates .env.local in the project root with sensible defaults, taken from .env.local-dev.example:
# Key settings in .env.local
DATABASE_HOST=localhost
DATABASE_PORT=5432
REDIS_HOST=localhost
REDIS_PORT=6379
SECRET_KEY=<auto-generated>
DJANGO_SETTINGS_MODULE=baserow.config.settings.dev
SYNC_TEMPLATES_ON_STARTUP=false
All backend commands automatically load this file.
Customizing Settings
Look at Configuration to customize your environment.
Common Commands
Shortcuts: b = backend, f = frontend
Backend Commands
All backend commands can be run from the project root with just backend (or just b) or from backend/:
# From project root (just b is shorthand for just backend)
just b test # Run tests
just b lint # Run linters
just b fix # Auto-fix code style
just b shell_plus # Django shell_plus with SQL logging
just b m makemigrations # Create migrations
just b m migrate # Apply migrations
# From backend/
cd backend
just test
just lint
just shell_plus
Frontend Commands
# From project root (just f is shorthand for just frontend)
just f lint # Run ESLint + Stylelint
just f test # Run Vitest tests
just f fix # Auto-fix code style
# From web-frontend/
cd web-frontend
just lint
just test
Viewing Logs
Works like docker compose logs - services and options can be in any order:
just dev logs # All services (backend, celery, frontend)
just dev logs -f # Follow all logs in real-time
just dev logs backend # Backend only
just dev logs backend celery # Backend and celery
just dev logs -f backend # Follow backend only
just dev logs backend -n 100 # Last 100 lines of backend
just dev logs -n 50 backend celery # Last 50 lines of backend and celery
Managing Docker Services
# Start only database and redis
just dc-dev up -d db redis
# Stop Docker services
just dc-dev stop db redis
# View Docker service logs
just dc-dev logs db
Manual Setup (Alternative)
If you prefer more control over each component:
1. Start Infrastructure Services
just dc-dev up -d db redis mailhog
2. Initialize Backend
cd backend
just init # Creates venv, installs deps
just migrate # Apply migrations
3. Run Backend Server
cd backend
just run-dev-server
4. Run the Celery Worker (separate terminal)
cd backend
just run-dev-celery
5. Initialize and Run Frontend (separate terminal)
cd web-frontend
just install # Install node_modules
just run-dev-server # Start Nuxt dev server
Running Tests
Backend Tests
# Run all tests
just b test
# Run tests in parallel (faster)
just b test -n=auto
# Run specific test file
just b test tests/baserow/core/test_core_models.py
# Run with coverage
just b test-coverage
Fast Tests with Ramdisk Database
For 2-5x faster tests, use a PostgreSQL container with tmpfs:
# Start ramdisk database (port 5433)
just test-db start
# Run tests against it
DATABASE_URL=postgres://baserow:baserow@localhost:5433/baserow just b test -n=auto
# Stop when done
just test-db stop
Frontend Tests
just f test # Run Vitest tests
just f yarn test:core # Watch mode (core tests; also test:premium, test:enterprise)
Database Operations
Running Migrations
just b migrate
# or
just b m migrate
Creating Migrations
just b m makemigrations
just b m makemigrations core # Specific app
Creating a Superuser
just b m createsuperuser
Syncing Templates
Templates (example databases, forms, etc.) are not synced by default for faster startup:
just b m sync_templates
Accessing the Database
# Django database shell
just b m dbshell
# Direct PostgreSQL (via Docker)
just dc-dev exec db psql -U baserow
Resetting the Database
# Stop Docker, remove volumes, restart
just dc-dev down -v
just dc-dev up -d db redis
just b migrate
Debugging
Backend Debugging
The Django dev server supports standard Python debugging:
# Add breakpoint in your code
breakpoint() # or: import pdb; pdb.set_trace()
For VS Code, add to .vscode/launch.json:
{
"name": "Django Backend",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/backend/src/baserow/manage.py",
"args": ["runserver", "0.0.0.0:8000"],
"django": true,
"env": {
"DJANGO_SETTINGS_MODULE": "baserow.config.settings.dev"
},
"envFile": "${workspaceFolder}/.env.local"
}
Celery Debugging
# Run with debug logging
CELERY_LOG_LEVEL=DEBUG just b run-dev-celery
Troubleshooting
"Module not found" Errors
just b uv sync
just f yarn
Database Connection Errors
# Ensure Docker services are running
just dc-dev ps
# Check if PostgreSQL is ready
just dc-dev exec db pg_isready -U baserow
# Verify .env.local settings
grep DATABASE .env.local
Port Already in Use
# Find what's using the port
lsof -i :8000
lsof -i :3000
# Kill the process or change the port
kill -9 $(lsof -i :8000 | awk 'NR==2 {print $2}')
kill -9 $(lsof -i :3000 | awk 'NR==2 {print $2}')
Celery Pool
For the rollout decision and the contract for new tasks, see ADR 018.
The dev worker runs concurrent tasks in one Python process. Threads share the
memory used to load Django and let other tasks run while one waits for I/O.
They also avoid fork crashes on macOS. With prefork, each task slot has its
own child process. Celery can kill and replace that child at the hard time limit.
Python cannot safely kill one thread. An exception injected while the thread
holds a lock can leave other tasks blocked, and killing the process interrupts
every task in it.
On Baserow's threads pool, a soft limit raises SoftTimeLimitExceeded at the
task thread's next ordinary Django query. At the hard limit, the watchdog also
asks PostgreSQL to cancel any query running on that thread's connections. The
cancelled query or the next ordinary query raises TimeLimitExceeded. The
exception is delivered once so cleanup can still use the database. A task
blocked on a socket, computing in Python, or catching the exception can keep
its slot past the deadline. After 60 more seconds the watchdog records
overdue in baserow.celery.task.time_limit and reports the task to Sentry
when configured. The slot becomes available when the task exits.
Give blocking calls their own timeouts and check a deadline between batches of long-running work. A WebSocket disconnect task can do its entire job in Redis, so its socket timeout matters even if it never queries PostgreSQL. Threads share CPU and the process memory limit too. CPU-heavy Python work competes with other tasks, and a process crash loses every task running in that worker. Use prefork when a task requires forced termination or process isolation. With either pool, a timeout can leave committed writes and external requests in effect.
Use solo to run one task at a time, for example with breakpoints:
CELERY_POOL=solo just b run-dev-celery
Frontend Build Errors
# Clear node_modules and reinstall
rm -rf web-frontend/node_modules
just f install
# Clear Nuxt cache
rm -rf web-frontend/.nuxt
Further Reading
- justfile.md - Complete command reference
- running-tests.md - Detailed testing guide
- running-the-dev-env-with-docker.md - Alternative: Docker development
- vscode-setup.md - VS Code configuration
- intellij-setup.md - IntelliJ/PyCharm configuration