chore: switch to uv and justfile (#4369)

* create backend justfile; switch to uv

* Add deploy and dc-deploy recipes to build images

* Add uv.lock for reproducible builds

* CI fixes + improvements

* Reduce build time

* improve CI caching

* Improve exit early conditions

* Set requires_python==3.11.*; add backend/media to gitignore

* Fix all-in-one Dockerfiles and some other fixes

* Introduce frontend justfile + some other useful recipes

* Fix permissions issue with dev containers

* Improve dockerfiles and docs on how to use the dev env

* Fix mjml-email-compiler service

* Update docs + address feedback

* Fix containers healthchecks

* Fix yarn test in dev container

* Minor fixes to docs and justfile attach command

* Address Petr's feedback

* Address additional feedback

* Add changelog entry

* Address feedback: Petr and Przemek

* address feedback + prepare for saas PR

* minor fixes

* Address Bram's feedback 2
This commit is contained in:
Davide Silvestri authored and GitHub committed 2026-01-15 11:22:22 +01:00
1 parent 0ad6100984
commit e25988ea0d
78 files changed
+19204 -8585

No files matched your search

+21 -4
View File
@@ -1,9 +1,26 @@
**/.nuxt
**/.nuxt-storybook
**/.storybook
**/node_modules
**/.pytest_cache
*.iml
.idea/
.local/
**/.cache
web-frontend/reports/
**/.venv/
**/.ruff_cache
**/.pytest_cache
**/__pycache__
**/*.pyc
**/*.pyo
backend/reports/
backend/src/baserow.egg-info
backend/media/
*.iml
.idea/
.vscode/
.local/
.git/
**/.claude/
**/.gitignore
**/Dockerfile
**/docker-compose*.yml
-43
View File
@@ -1,43 +0,0 @@
# An example .env file for use with
# `docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d`.
#
# DO NOT USE THIS FILE IN PRODUCTION. ONLY USE THIS FOR LOCAL DEVELOPMENT.
SECRET_KEY=baserow
DATABASE_PASSWORD=baserow
REDIS_PASSWORD=baserow
# You can find your uid and gid by running the `id` command.
UID=replace me with your uid
GID=replace me with your gid
# Do not edit the following override, it is required to work with docker-compose.dev.yml.
BASEROW_PUBLIC_URL=
# In the Dev environment we set the next two variables to force the Caddy reverse proxy
# onto an unused port. We only want to use Caddy to serve media files and not act
# as a reverse proxy between your browser and Baserow.
WEB_FRONTEND_PORT=4000
WEB_FRONTEND_SSL_PORT=4443
PUBLIC_BACKEND_URL=http://localhost:8000
PUBLIC_WEB_FRONTEND_URL=http://localhost:3000
# If you change WEB_FRONTEND_PORT above you also need the change the 4000 here to match.
MEDIA_URL=http://localhost:4000/media/
# Optional PostgreSQL config for better performance
POSTGRES_DEV_EXTRA_ARGS="-c shared_buffers=512MB -c fsync=off -c full_page_writes=off -c synchronous_commit=off"
POSTGRES_IMAGE_VERSION=13
# Settings for local dev with MinIO to have local s3-like object storage
# AWS_ACCESS_KEY_ID=<REDACTED>
# AWS_SECRET_ACCESS_KEY=<REDACTED>
# AWS_STORAGE_BUCKET_NAME=baserow
# AWS_S3_ENDPOINT_URL=http://192.168.1.16:9000
# AWS_S3_USE_SSL=off
# AWS_S3_CUSTOM_DOMAIN=
# AWS_DEFAULT_ACL=
# AWS_S3_VERIFY=off
# AWS_S3_SIGNATURE_VERSION = 's3v4'
# AWS_S3_ADDRESSING_STYLE = 'path'
+49
View File
@@ -0,0 +1,49 @@
# Docker development environment for Baserow
# Used by: just dc-dev (docker-compose.dev.yml)
#
# This file is auto-created from .env.docker-dev.example when you run `just dc-dev`.
# For native local development (without Docker), use .env.local instead.
#
# DO NOT USE THIS FILE IN PRODUCTION.
# Compose profiles to enable. By default, all services including optional ones
# (storybook, flower) are started. Set to empty to disable optional services.
# See: https://docs.docker.com/compose/how-tos/profiles/
COMPOSE_PROFILES=optional
SECRET_KEY=baserow
DATABASE_PASSWORD=baserow
REDIS_PASSWORD=baserow
# Do not edit the following override, it is required to work with docker-compose.dev.yml.
BASEROW_PUBLIC_URL=
PRIVATE_BACKEND_URL=http://backend:8000
# In the Dev environment we set the next two variables to force the Caddy reverse proxy
# onto an unused port. We only want to use Caddy to serve media files and not act
# as a reverse proxy between your browser and Baserow.
WEB_FRONTEND_PORT=4000
WEB_FRONTEND_SSL_PORT=4443
PUBLIC_BACKEND_URL=http://localhost:8000
PUBLIC_WEB_FRONTEND_URL=http://localhost:3000
# If you change WEB_FRONTEND_PORT above you also need the change the 4000 here to match.
MEDIA_URL=http://localhost:4000/media/
# Optional PostgreSQL config for better performance (must be single line in .env files)
POSTGRES_DEV_EXTRA_ARGS=-c shared_buffers=512MB -c fsync=off -c full_page_writes=off -c synchronous_commit=off -c max_locks_per_transaction=512 -c logging_collector=off -c log_statement=none -c log_duration=off -c log_min_duration_statement=-1 -c log_checkpoints=off -c log_connections=off -c log_disconnections=off -c log_lock_waits=off -c log_temp_files=-1 -c checkpoint_timeout=1h -c max_wal_size=10GB -c min_wal_size=1GB -c wal_level=minimal -c max_wal_senders=0 -c autovacuum=off -c random_page_cost=1.0 -c effective_io_concurrency=200 -c work_mem=256MB -c maintenance_work_mem=512MB
POSTGRES_IMAGE_VERSION=13
# Settings for local dev with MinIO to have local s3-like object storage
# AWS_ACCESS_KEY_ID=<REDACTED>
# AWS_SECRET_ACCESS_KEY=<REDACTED>
# AWS_STORAGE_BUCKET_NAME=baserow
# AWS_S3_ENDPOINT_URL=http://YOUR_LOCAL_IP:9000
# AWS_S3_USE_SSL=off
# AWS_S3_CUSTOM_DOMAIN=
# AWS_DEFAULT_ACL=
# AWS_S3_VERIFY=off
# AWS_S3_SIGNATURE_VERSION = 's3v4'
# AWS_S3_ADDRESSING_STYLE = 'path'
+74
View File
@@ -0,0 +1,74 @@
# Local development environment for Baserow
# Copy this file to .env.local and adjust as needed
#
# This file is for running Baserow OUTSIDE of Docker (native Python/Node).
# For Docker development, use .env.dev.example instead.
#
# =============================================================================
# Django Settings
# =============================================================================
DJANGO_SETTINGS_MODULE=baserow.config.settings.dev
# For running tests:
# DJANGO_SETTINGS_MODULE=baserow.config.settings.test
# =============================================================================
# Security (use simple values for local dev only!)
# =============================================================================
SECRET_KEY=local-dev-secret-key-not-for-production
BASEROW_JWT_SIGNING_KEY=local-dev-jwt-key-not-for-production
# =============================================================================
# Database (local PostgreSQL)
# =============================================================================
DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_NAME=baserow
DATABASE_USER=baserow
DATABASE_PASSWORD=baserow
# speed up operations and tests (must be single line, quoted for bash sourcing)
POSTGRES_DEV_EXTRA_ARGS="-c shared_buffers=512MB -c fsync=off -c full_page_writes=off -c synchronous_commit=off -c max_locks_per_transaction=512 -c logging_collector=off -c log_statement=none -c log_duration=off -c log_min_duration_statement=-1 -c log_checkpoints=off -c log_connections=off -c log_disconnections=off -c log_lock_waits=off -c log_temp_files=-1 -c checkpoint_timeout=1h -c max_wal_size=10GB -c min_wal_size=1GB -c wal_level=minimal -c max_wal_senders=0 -c autovacuum=off -c random_page_cost=1.0 -c effective_io_concurrency=200 -c work_mem=256MB -c maintenance_work_mem=512MB"
# Or use a connection URL:
# DATABASE_URL=postgresql://baserow:baserow@localhost:5432/baserow
# =============================================================================
# Redis (local Redis)
# =============================================================================
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=baserow
# =============================================================================
# URLs
# =============================================================================
BASEROW_PUBLIC_URL=
PUBLIC_BACKEND_URL=http://localhost:8000
PUBLIC_WEB_FRONTEND_URL=http://localhost:3000
PRIVATE_BACKEND_URL=http://localhost:8000
# =============================================================================
# Backend Development Settings
# =============================================================================
BASEROW_BACKEND_DEBUG=on
BASEROW_BACKEND_LOG_LEVEL=INFO
# Disable template sync on startup for faster boot
SYNC_TEMPLATES_ON_STARTUP=false
MIGRATE_ON_STARTUP=false
# =============================================================================
# Optional: Email (use console backend for local dev)
# =============================================================================
# EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
# =============================================================================
# Optional: Celery
# =============================================================================
# Run celery tasks synchronously (no separate worker needed)
# CELERY_TASK_ALWAYS_EAGER=true
# =============================================================================
# Media files (path relative to the backend folder)
# =============================================================================
MEDIA_ROOT=./media
MEDIA_URL=http://localhost:8000/media/
+110 -165
View File
@@ -6,9 +6,16 @@ on:
- develop
- master
pull_request:
workflow_dispatch:
inputs:
clear_cache:
description: 'Clear Docker build cache before building'
required: false
default: false
type: boolean
# Customize the workflow run name to show branch/PR info
run-name: "CI: ${{ github.event_name == 'pull_request' && github.event.pull_request.title || github.ref_name }}"
run-name: "CI: ${{ github.event_name == 'pull_request' && github.event.pull_request.title || github.ref_name }}${{ inputs.clear_cache && ' (cache cleared)' || '' }}"
# Automatically cancel in-progress workflows for the same branch/PR
concurrency:
@@ -53,7 +60,7 @@ jobs:
# ==========================================================================
build-backend:
name: Build Backend Dev Image
name: Build Backend CI Image
runs-on: ubuntu-latest
permissions:
contents: read
@@ -82,39 +89,23 @@ jobs:
FULL_IMAGE="${IMAGE_NAME}:${IMAGE_TAG}"
echo "full=${FULL_IMAGE}" >> $GITHUB_OUTPUT
- name: Determine cache sources
id: cache
run: |
BRANCH_NAME="${GITHUB_REF_NAME}"
TRUNCATED_BRANCH="${BRANCH_NAME:0:100}"
TRUNCATED_BRANCH="${TRUNCATED_BRANCH//\//-}"
IMAGE_NAME="${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}/backend_dev"
BRANCH_CACHE="${IMAGE_NAME}:${{ env.CI_IMAGE_TAG_PREFIX }}${TRUNCATED_BRANCH}"
DEVELOP_CACHE="${IMAGE_NAME}:${{ env.CI_IMAGE_TAG_PREFIX }}${{ env.DEVELOP_BRANCH_NAME }}"
echo "branch=${BRANCH_CACHE}" >> $GITHUB_OUTPUT
echo "develop=${DEVELOP_CACHE}" >> $GITHUB_OUTPUT
- name: Build and push backend dev image
- name: Build and push backend CI image
uses: docker/build-push-action@v5
with:
context: .
file: backend/Dockerfile
target: dev
target: ci
push: true
tags: ${{ steps.image.outputs.full }}
cache-from: |
type=registry,ref=${{ steps.cache.outputs.branch }}
type=registry,ref=${{ steps.cache.outputs.develop }}
cache-to: type=inline
cache-from: ${{ inputs.clear_cache != true && 'type=gha,scope=backend-ci' || '' }}
cache-to: type=gha,scope=backend-ci,mode=max
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.revision=${{ env.REAL_GITHUB_SHA }}
org.opencontainers.image.created=${{ github.event.head_commit.timestamp }}
build-frontend:
name: Build Web-Frontend Dev Image
name: Build Web-Frontend CI Image
runs-on: ubuntu-latest
permissions:
contents: read
@@ -143,32 +134,16 @@ jobs:
FULL_IMAGE="${IMAGE_NAME}:${IMAGE_TAG}"
echo "full=${FULL_IMAGE}" >> $GITHUB_OUTPUT
- name: Determine cache sources
id: cache
run: |
BRANCH_NAME="${GITHUB_REF_NAME}"
TRUNCATED_BRANCH="${BRANCH_NAME:0:100}"
TRUNCATED_BRANCH="${TRUNCATED_BRANCH//\//-}"
IMAGE_NAME="${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}/web-frontend_dev"
BRANCH_CACHE="${IMAGE_NAME}:${{ env.CI_IMAGE_TAG_PREFIX }}${TRUNCATED_BRANCH}"
DEVELOP_CACHE="${IMAGE_NAME}:${{ env.CI_IMAGE_TAG_PREFIX }}${{ env.DEVELOP_BRANCH_NAME }}"
echo "branch=${BRANCH_CACHE}" >> $GITHUB_OUTPUT
echo "develop=${DEVELOP_CACHE}" >> $GITHUB_OUTPUT
- name: Build and push web-frontend dev image
- name: Build and push web-frontend CI image
uses: docker/build-push-action@v5
with:
context: .
file: web-frontend/Dockerfile
target: dev
target: ci
push: true
tags: ${{ steps.image.outputs.full }}
cache-from: |
type=registry,ref=${{ steps.cache.outputs.branch }}
type=registry,ref=${{ steps.cache.outputs.develop }}
cache-to: type=inline
cache-from: ${{ inputs.clear_cache != true && 'type=gha,scope=frontend-ci' || '' }}
cache-to: type=gha,scope=frontend-ci,mode=max
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.revision=${{ env.REAL_GITHUB_SHA }}
@@ -227,19 +202,11 @@ jobs:
needs:
- build-backend
- detect-changes
if: needs.detect-changes.outputs.backend == 'true' || github.ref_name == 'develop' || github.ref_name == 'master'
permissions:
contents: read
packages: read
steps:
- name: Exit early if backend not changed and not develop/master
run: |
if [[ "${{ needs.detect-changes.outputs.backend }}" != "true" && \
"${{ github.ref_name }}" != "develop" && \
"${{ github.ref_name }}" != "master" ]]; then
echo "No backend changes detected — skipping backend lint."
exit 0
fi
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
@@ -256,19 +223,11 @@ jobs:
needs:
- build-frontend
- detect-changes
if: needs.detect-changes.outputs.frontend == 'true' || github.ref_name == 'develop' || github.ref_name == 'master'
permissions:
contents: read
packages: read
steps:
- name: Exit early if frontend not changed and not develop/master
run: |
if [[ "${{ needs.detect-changes.outputs.frontend }}" != "true" && \
"${{ github.ref_name }}" != "develop" && \
"${{ github.ref_name }}" != "master" ]]; then
echo "No backend changes detected — skipping backend lint."
exit 0
fi
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
@@ -283,21 +242,11 @@ jobs:
name: Dockerfile Lint (hadolint)
runs-on: ubuntu-latest
needs:
- backend-lint
- frontend-lint
- detect-changes
if: needs.detect-changes.outputs.dockerfiles == 'true' || github.ref_name == 'develop' || github.ref_name == 'master'
permissions:
contents: read
steps:
- name: Exit early if dockerfiles not changed and not develop/master
run: |
if [[ "${{ needs.detect-changes.outputs.dockerfiles }}" != "true" && \
"${{ github.ref_name }}" != "develop" && \
"${{ github.ref_name }}" != "master" ]]; then
echo "No backend changes detected — skipping backend lint."
exit 0
fi
- name: Checkout code
uses: actions/checkout@v4
@@ -335,18 +284,10 @@ jobs:
runs-on: ubuntu-latest
needs:
- detect-changes
if: needs.detect-changes.outputs.helm == 'true' || github.ref_name == 'develop' || github.ref_name == 'master'
permissions:
contents: read
steps:
- name: Exit early if helm not changed and not develop/master
run: |
if [[ "${{ needs.detect-changes.outputs.helm }}" != "true" && \
"${{ github.ref_name }}" != "develop" && \
"${{ github.ref_name }}" != "master" ]]; then
echo "No backend changes detected — skipping backend lint."
exit 0
fi
- name: Checkout code
uses: actions/checkout@v4
@@ -377,8 +318,8 @@ jobs:
runs-on: ubuntu-latest
needs:
- build-backend
- backend-lint
- detect-changes
if: needs.detect-changes.outputs.backend == 'true' || github.ref_name == 'develop' || github.ref_name == 'master'
permissions:
contents: read
packages: read
@@ -394,16 +335,9 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
--tmpfs /var/lib/postgresql/data:rw,noexec,nosuid,size=4g
--shm-size=512m
steps:
- name: Exit early if backend not changed and not develop/master
run: |
if [[ "${{ needs.detect-changes.outputs.backend }}" != "true" && \
"${{ github.ref_name }}" != "develop" && \
"${{ github.ref_name }}" != "master" ]]; then
echo "No backend changes detected — skipping backend lint."
exit 0
fi
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
@@ -433,8 +367,8 @@ jobs:
runs-on: ubuntu-latest
needs:
- build-backend
- backend-lint
- detect-changes
if: needs.detect-changes.outputs.backend == 'true' || github.ref_name == 'develop' || github.ref_name == 'master'
permissions:
contents: read
packages: read
@@ -456,16 +390,9 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
--tmpfs /var/lib/postgresql/data:rw,noexec,nosuid,size=4g
--shm-size=512m
steps:
- name: Exit early if backend not changed and not develop/master
run: |
if [[ "${{ needs.detect-changes.outputs.backend }}" != "true" && \
"${{ github.ref_name }}" != "develop" && \
"${{ github.ref_name }}" != "master" ]]; then
echo "No backend changes detected — skipping backend lint."
exit 0
fi
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
@@ -513,8 +440,8 @@ jobs:
runs-on: ubuntu-latest
needs:
- build-frontend
- frontend-lint
- detect-changes
if: needs.detect-changes.outputs.frontend == 'true' || github.ref_name == 'develop' || github.ref_name == 'master'
permissions:
contents: read
packages: read
@@ -525,15 +452,6 @@ jobs:
matrix:
shard: [1, 2, 3, 4]
steps:
- name: Exit early if frontend not changed and not develop/master
run: |
if [[ "${{ needs.detect-changes.outputs.frontend }}" != "true" && \
"${{ github.ref_name }}" != "develop" && \
"${{ github.ref_name }}" != "master" ]]; then
echo "No backend changes detected — skipping backend lint."
exit 0
fi
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
@@ -573,21 +491,11 @@ jobs:
name: Zapier Integration Tests
runs-on: ubuntu-latest
needs:
- backend-lint
- frontend-lint
- detect-changes
if: needs.detect-changes.outputs.zapier == 'true' || github.ref_name == 'develop' || github.ref_name == 'master'
permissions:
contents: read
steps:
- name: Exit early if zapier not changed and not develop/master
run: |
if [[ "${{ needs.detect-changes.outputs.zapier }}" != "true" && \
"${{ github.ref_name }}" != "develop" && \
"${{ github.ref_name }}" != "master" ]]; then
echo "No backend changes detected — skipping backend lint."
exit 0
fi
- name: Checkout code
uses: actions/checkout@v4
@@ -595,6 +503,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "yarn"
cache-dependency-path: "integrations/zapier/yarn.lock"
- name: Run Zapier tests
run: |
@@ -606,21 +516,11 @@ jobs:
name: Check MJML Email Templates Compiled
runs-on: ubuntu-latest
needs:
- backend-lint
- frontend-lint
- detect-changes
if: needs.detect-changes.outputs.mjml == 'true' || github.ref_name == 'develop' || github.ref_name == 'master'
permissions:
contents: read
steps:
- name: Exit early if mjml not changed and not develop/master
run: |
if [[ "${{ needs.detect-changes.outputs.mjml }}" != "true" && \
"${{ github.ref_name }}" != "develop" && \
"${{ github.ref_name }}" != "master" ]]; then
echo "No backend changes detected — skipping backend lint."
exit 0
fi
- name: Checkout code
uses: actions/checkout@v4
@@ -628,6 +528,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "yarn"
cache-dependency-path: "backend/email_compiler/yarn.lock"
- name: Compile MJML templates
run: |
@@ -655,8 +557,7 @@ jobs:
- detect-changes
- build-backend
- build-frontend
- backend-lint
- frontend-lint
if: needs.detect-changes.outputs.backend == 'true' || needs.detect-changes.outputs.frontend == 'true' || needs.detect-changes.outputs.dockerfiles == 'true' || github.ref_name == 'develop' || github.ref_name == 'master'
permissions:
contents: read
packages: read
@@ -665,7 +566,7 @@ jobs:
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
shard: [1, 2]
services:
db:
image: pgvector/pgvector:pg13
@@ -678,6 +579,8 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
--tmpfs /var/lib/postgresql/data:rw,noexec,nosuid,size=4g
--shm-size=512m
redis:
image: redis:6-alpine
options: >-
@@ -685,6 +588,7 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
--tmpfs /data:rw,noexec,nosuid,size=256m
s3mock:
image: adobe/s3mock:3.12.0
env:
@@ -692,17 +596,6 @@ jobs:
ports:
- 9090:9090
steps:
- name: Exit early if no relevant changes
run: |
if [[ "${{ needs.detect-changes.outputs.backend }}" != "true" && \
"${{ needs.detect-changes.outputs.frontend }}" != "true" && \
"${{ needs.detect-changes.outputs.dockerfiles }}" != "true" && \
"${{ github.ref_name }}" != "develop" && \
"${{ github.ref_name }}" != "master" ]]; then
echo "No backend, frontend, or Dockerfile changes detected — skipping job."
exit 0
fi
- name: Checkout code
uses: actions/checkout@v4
@@ -720,8 +613,22 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Start backend service
- name: Restore database from dump
run: |
echo "Restoring database from dump to container ${{ job.services.db.id }}..."
# Drop and recreate database
docker exec ${{ job.services.db.id }} psql -U baserow -d postgres -c "DROP DATABASE IF EXISTS baserow;"
docker exec ${{ job.services.db.id }} psql -U baserow -d postgres -c "CREATE DATABASE baserow;"
# Restore from dump (migrations and templates already applied)
docker exec -i ${{ job.services.db.id }} pg_restore -U baserow -d baserow --no-owner --no-acl < e2e-tests/fixtures/e2e-db.dump || true
echo "Database restored successfully!"
- name: Start all services in parallel
run: |
# Start backend
docker run -d --network="${{ job.services.db.network }}" \
--name backend \
-e DATABASE_HOST=db \
@@ -739,12 +646,12 @@ jobs:
-e AWS_S3_URL_PROTOCOL=http: \
-e FEATURE_FLAGS="*" \
-e DJANGO_SETTINGS_MODULE=baserow.config.settings.e2e \
-e BASEROW_TRIGGER_SYNC_TEMPLATES_AFTER_MIGRATION=false \
-e MIGRATE_ON_STARTUP=true \
-e PRIVATE_BACKEND_URL=http://backend:8000 \
-p 8000:8000 \
${{ needs.build-backend.outputs.image }} gunicorn
${{ needs.build-backend.outputs.image }} gunicorn &
- name: Start celery worker
run: |
# Start celery worker
docker run -d --network="${{ job.services.db.network }}" \
--name celery \
-e DATABASE_HOST=db \
@@ -764,24 +671,42 @@ jobs:
-e DJANGO_SETTINGS_MODULE=baserow.config.settings.e2e \
-e BASEROW_RUN_MINIMAL=yes \
-e BASEROW_AMOUNT_OF_WORKERS=1 \
${{ needs.build-backend.outputs.image }} celery-worker
${{ needs.build-backend.outputs.image }} celery-worker &
- name: Start web-frontend service
run: |
# Start web-frontend
docker run -d --network="${{ job.services.db.network }}" \
--name web-frontend \
-e PUBLIC_BACKEND_URL=http://localhost:8000 \
-e PUBLIC_WEB_FRONTEND_URL=http://localhost:3000 \
-e PRIVATE_BACKEND_URL=http://backend:8000 \
-e FEATURE_FLAGS="*" \
-e NODE_OPTIONS=--max-old-space-size=8192 \
-p 3000:3000 \
${{ needs.build-frontend.outputs.image }} nuxt-dev-no-attach
${{ needs.build-frontend.outputs.image }} nuxt-local &
- name: Install Playwright
# Wait for all docker run commands to complete
wait
echo "All services started"
- name: Install dependencies
run: |
cd e2e-tests
yarn install
- name: Get Playwright version
id: playwright-version
run: echo "version=$(cd e2e-tests && yarn list @playwright/test --depth=0 | grep @playwright/test | sed 's/.*@//')" >> $GITHUB_OUTPUT
- name: Cache Playwright browsers
uses: actions/cache@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}
- name: Install Playwright browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: |
cd e2e-tests
npx playwright install --with-deps firefox
- name: Wait for services
@@ -801,7 +726,7 @@ jobs:
PRIVATE_BACKEND_URL: http://backend:8000
run: |
cd e2e-tests
CI=1 npx playwright test --timeout=30000 --grep-invert=@slow --shard=${{ matrix.shard }}/4 --project=firefox
CI=1 npx playwright test --timeout=30000 --grep-invert=@slow --shard=${{ matrix.shard }}/2 --project=firefox
- name: Upload E2E test results
uses: actions/upload-artifact@v4
@@ -812,6 +737,18 @@ jobs:
retention-days: 7
include-hidden-files: true
- name: Dump container logs on failure
if: failure()
run: |
echo "=== Backend logs ==="
docker logs backend 2>&1 || true
echo ""
echo "=== Celery logs ==="
docker logs celery 2>&1 || true
echo ""
echo "=== Web-frontend logs ==="
docker logs web-frontend 2>&1 || true
- name: Cleanup containers
if: always()
run: |
@@ -953,11 +890,14 @@ jobs:
with:
context: .
file: backend/Dockerfile
target: prod
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}/backend:ci-tested-${{ env.REAL_GITHUB_SHA }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}/backend_dev:ci-${{ env.REAL_GITHUB_SHA }}
cache-to: type=inline
cache-from: |
type=gha,scope=backend-ci
type=gha,scope=backend-prod
cache-to: type=gha,scope=backend-prod,mode=max
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.revision=${{ env.REAL_GITHUB_SHA }}
@@ -992,11 +932,14 @@ jobs:
with:
context: .
file: web-frontend/Dockerfile
target: prod
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}/web-frontend:ci-tested-${{ env.REAL_GITHUB_SHA }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}/web-frontend_dev:ci-${{ env.REAL_GITHUB_SHA }}
cache-to: type=inline
cache-from: |
type=gha,scope=frontend-ci
type=gha,scope=frontend-prod
cache-to: type=gha,scope=frontend-prod,mode=max
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.revision=${{ env.REAL_GITHUB_SHA }}
@@ -1036,7 +979,8 @@ jobs:
FROM_WEBFRONTEND_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}/web-frontend:ci-tested-${{ env.REAL_GITHUB_SHA }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}/baserow:ci-tested-${{ env.REAL_GITHUB_SHA }}
cache-to: type=inline
cache-from: type=gha,scope=all-in-one
cache-to: type=gha,scope=all-in-one,mode=max
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.revision=${{ env.REAL_GITHUB_SHA }}
@@ -1074,7 +1018,8 @@ jobs:
FROM_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}/baserow:ci-tested-${{ env.REAL_GITHUB_SHA }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}/cloudron:ci-tested-${{ env.REAL_GITHUB_SHA }}
cache-to: type=inline
cache-from: type=gha,scope=cloudron
cache-to: type=gha,scope=cloudron,mode=max
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.revision=${{ env.REAL_GITHUB_SHA }}
+16
View File
@@ -95,8 +95,17 @@ docker-compose.override.yml
# python
venv/
.venv/
.profiles/
# Media files
backend/media/
# Local environment files (not for Docker)
.env.local
**/.env.local
.env.docker-dev
web-frontend/plugins/
backend/plugins/
web-frontend/reports/
@@ -124,6 +133,13 @@ out/
.cursor-config/
!config/cursor/.cursor-config/
# Claude Code local settings
.claude/settings.local.md
# Personal justfile recipes (not tracked)
local.just
**/local.just
# Pyright config file
pyrightconfig.json
-202
View File
@@ -1,202 +0,0 @@
ifeq ($(shell uname -s),Darwin)
REALPATH:=grealpath -em
else
REALPATH:=realpath -em
endif
SHELL=/bin/bash
WORKDIR:=$(shell $(REALPATH) $(shell pwd))
SUBDIRS:=backend web-frontend
DOCKERCLI:=docker
DOCKERC:=$(DOCKERCLI) compose
DOCKER_SPLIT_CONF:=-f docker-compose.yml -f docker-compose.dev.yml
DOCKER_ALL_IN_ONE_CONF:=-f deploy/all-in-one/docker-compose.yml -f deploy/all-in-one/docker-compose.dev.yml
.PHONY: install build .callsubcmd $(SUBDIRS) help package-build test tests\
lint lint-fix docker-lint changelog\
docker-status docker-build docker-start docker-clean docker-stop docker-kill \
deps deps-upgrade \
clean clean-all
help:
@echo "baserow make. available targets:"
@echo "targets that are executed in backend/frontend dirs:"
@echo " make install - install locally with dependencies"
@echo " make package-build - build packages locally"
@echo " make lint - check code style"
@echo " make test - run test suite"
@echo " make changelog - add a new changelog entry"
@echo " make clean-all - remove docker images, venv and frontend node_modules dir"
@echo " "
@echo "targets that are executed at top-dir level:"
@echo ""
@echo " make docker-build - build docker images for dev env"
@echo " make docker-start - start local dev env"
@echo " make docker-stop - stop local dev env"
@echo " make docker-status - show current docker containers"
@echo " make docker-clean - remove docker images"
@echo " make docker-lint - validate dockerfiles"
@echo ""
@echo " make docker-backend-shell - start a shell in backend container"
@echo " make docker-backend-logs - follow logs in backend container"
@echo " make docker-backend-attach - attach to backend container"
@echo ""
@echo " make docker-frontend-shell - start a shell in frontend container"
@echo " make docker-frontend-logs - follow logs in frontend container"
@echo " make docker-frontend-attach - attach to frontend container"
@echo ""
@echo " make docker-allinone-build - build all-in-one dev container"
@echo " make docker-allinone-start - start all-in-one dev container"
@echo " make docker-allinone-stop - stop all-in-one dev container"
@echo ""
# create .env file with default values if no file exists
.env:
@cat .env.example > .env
@echo "### DEV VARS" >> .env
@cat .env.dev.example >> .env
@sed -i'' -e 's/replace me with your uid/$(shell id -u)/g' .env
@sed -i'' -e 's/replace me with your gid/$(shell id -g)/g' .env
@echo "Created .env file with default values"
@echo "Please review contents of .env"
@echo ""
# execute $(SUBCMD) in subdirs with make
# NOTE: SUBCMD is substituted at rule level while $SDIR is shell variable
.subcmd:
@echo "calling $(SUBCMD) in subdirs"
for SDIR in $(SUBDIRS); do echo "$$SDIR/$(SUBCMD)"; \
cd $(WORKDIR) && cd $$SDIR && $(MAKE) $(SUBCMD) && cd ..; \
done
# NOTE: each target that need to call subdir mae
install: SUBCMD=install deps-install deps-install-dev
install: .subcmd
package-build: SUBCMD=package-build
package-build: .subcmd
lint: SUBCMD=lint
lint: .subcmd docker-lint
lint-fix: SUBCMD=lint-fix
lint-fix: .subcmd
test: SUBCMD=test
test: .subcmd
tests: test
changelog:
$(MAKE) -C changelog add
.docker-build: .env
$(DOCKERC) $(DOCKER_CONFIG_FILES) build
.docker-start: .env
$(DOCKERC) $(DOCKER_CONFIG_FILES) up -d
.docker-stop: .env
$(DOCKERC) $(DOCKER_CONFIG_FILES) stop
.docker-kill: .env
$(DOCKERC) $(DOCKER_CONFIG_FILES) kill
.docker-clean: .env
$(DOCKERC) $(DOCKER_CONFIG_FILES) rm -f -v
docker-build: DOCKER_CONFIG_FILES=$(DOCKER_SPLIT_CONF)
docker-build: .docker-build
docker-start: DOCKER_CONFIG_FILES=$(DOCKER_SPLIT_CONF)
docker-start: docker-build .docker-start
docker-stop: DOCKER_CONFIG_FILES=$(DOCKER_SPLIT_CONF)
docker-stop: .docker-stop
docker-kill: DOCKER_CONFIG_FILES=$(DOCKER_SPLIT_CONF)
docker-kill: .docker-kill
docker-clean: DOCKER_CONFIG_FILES=$(DOCKER_SPLIT_CONF)
docker-clean: docker-stop .docker-clean
docker-lint:
$(DOCKERCLI) run --rm -i -v "$(shell pwd)":/opt/hadolint/. -w /opt/hadolint \
hadolint/hadolint:2.9.3-debian \
hadolint -f tty \
--ignore DL3008 \
backend/Dockerfile \
web-frontend/Dockerfile \
heroku.Dockerfile \
e2e-tests/Dockerfile \
deploy/*/Dockerfile
# those images are required to build all-in-one image
.docker-build-standalone-images:
docker build -f backend/Dockerfile . -t baserow_backend
docker build -f web-frontend/Dockerfile . -t baserow_web-frontend
docker-allinone-build: DOCKER_CONFIG_FILES=$(DOCKER_ALL_IN_ONE_CONF)
docker-allinone-build: .docker-build-standalone-images .docker-build
docker-allinone-start: DOCKER_CONFIG_FILES=$(DOCKER_ALL_IN_ONE_CONF)
docker-allinone-start: docker-allinone-build .docker-start
docker-allinone-stop: DOCKER_CONFIG_FILES=$(DOCKER_ALL_IN_ONE_CONF)
docker-allinone-stop: .docker-stop
docker-allinone-restart: docker-allinone-stop docker-allinone-start
docker-allinone-shell:
$(DOCKERC) $(DOCKER_ALL_IN_ONE_CONF) exec baserow_all_in_one bash
docker-allinone-attach:
$(DOCKERC) $(DOCKER_ALL_IN_ONE_CONF) attach baserow_all_in_one
docker-allinone-logs:
$(DOCKERC) $(DOCKER_ALL_IN_ONE_CONF) logs -tf baserow_all_in_one
docker-backend-shell:
$(DOCKERC) $(DOCKER_SPLIT_CONF) exec backend bash
docker-backend-attach:
$(DOCKERC) $(DOCKER_SPLIT_CONF) attach backend
docker-backend-logs:
$(DOCKERC) $(DOCKER_SPLIT_CONF) logs -tf backend
docker-frontend-shell:
$(DOCKERC) $(DOCKER_SPLIT_CONF) exec web-frontend bash
docker-frontend-attach:
$(DOCKERC) $(DOCKER_SPLIT_CONF) attach web-frontend
docker-frontend-logs:
$(DOCKERC) $(DOCKER_SPLIT_CONF) logs -tf web-frontend
docker-db-logs:
$(DOCKERC) $(DOCKER_SPLIT_CONF) logs -tf db
docker-db-shell:
$(DOCKERC) $(DOCKER_SPLIT_CONF) exec db bash
clean: SUBCMD=clean
clean: .subcmd docker-clean
clean-all: SUBCMD=clean-all
clean-all: .subcmd docker-clean
deps: SUBCMD=deps
deps: .subcmd
deps-upgrade: SUBCMD=deps-upgrade
deps-upgrade: .subcmd
docker-status: .env
$(DOCKERC) $(DOCKER_SPLIT_CONF) ps
+7 -7
View File
@@ -81,10 +81,12 @@ https://api.baserow.io/api/schema.json.
If you want to contribute to Baserow you can setup a development environment like so:
```
$ git clone https://github.com/baserow/baserow.git
$ cd baserow
$ ./dev.sh --build
```bash
git clone https://github.com/baserow/baserow.git
cd baserow
just dc-dev build --parallel
just dc-dev up -d
```
The Baserow development environment is now running.
@@ -92,9 +94,7 @@ Visit [http://localhost:3000](http://localhost:3000) in your browser to see a wo
version in development mode with hot code reloading and other dev features enabled.
More detailed instructions and more information about the development environment can be
found
at [https://baserow.io/docs/development/development-environment](./docs/development/development-environment.md)
.
found at [https://baserow.io/docs/development/development-environment](./docs/development/development-environment.md).
## Why Baserow?
+8997 -4744
View File
File diff suppressed because it is too large. Load diff
+344 -115
View File
@@ -1,140 +1,369 @@
# syntax = docker/dockerfile:1.3
FROM debian:bookworm-slim AS base
# syntax=docker/dockerfile:1.4
ARG UID="9999"
ARG GID="9999"
ARG UID
ENV UID=${UID:-9999}
ARG GID
ENV GID=${GID:-9999}
# =============================================================================
# Builder for su-exec (replaces gosu, safer with smaller footprint)
# Pinned to v0.2 (commit 212b75144bbc) with SHA256 verification
# =============================================================================
FROM debian:bookworm-slim AS tool-builder
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# We might be running as a user which already exists in this image. In that situation
# Everything is OK and we should just continue on.
RUN groupadd -g $GID baserow_docker_group || exit 0
RUN useradd --shell /bin/bash -u $UID -g $GID -o -c "" -m baserow_docker_user -l || exit 0
ENV DOCKER_USER=baserow_docker_user
ENV POSTGRES_VERSION=15
ENV BASEROW_IMAGE_TYPE="backend"
ENV SU_EXEC_VERSION=212b75144bbc06722fbd7661f651390dc47a43d1 \
SU_EXEC_SHA256=d6c40440609a23483f12eb6295b5191e94baf08298a856bab6e15b10c3b82891
# hadolint ignore=DL3013
RUN apt-get update && \
# hadolint ignore=DL3008
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends ca-certificates curl build-essential dos2unix tini && \
curl -fsSL -o /usr/local/bin/su-exec.c "https://github.com/ncopa/su-exec/raw/${SU_EXEC_VERSION}/su-exec.c" && \
echo "${SU_EXEC_SHA256} /usr/local/bin/su-exec.c" | sha256sum -c - && \
gcc -Wall -Werror -static -o /usr/local/bin/su-exec /usr/local/bin/su-exec.c && \
chmod 0755 /usr/local/bin/su-exec
# =============================================================================
# Production base builder stage: builds runtime dependencies only
# =============================================================================
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim AS builder-prod-base
ARG UID
ARG GID
# Runtime dependencies only - this layer is always cached
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
build-essential
ENV UV_PYTHON_DOWNLOADS=0 \
UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
UV_PROJECT_ENVIRONMENT=/baserow/venv \
UV_CACHE_DIR=/tmp/baserow_uv_cache \
UV_VERBOSE=1 \
PYTHONUNBUFFERED=1 \
PATH="/baserow/venv/bin:$PATH" \
PYTHONPATH="/baserow/backend/src:/baserow/premium/backend/src:/baserow/enterprise/backend/src"
# Create baserow directory structure (including subdirs for COPY targets)
RUN mkdir -p /baserow/ && chown -R $UID:$GID /baserow/
USER $UID:$GID
WORKDIR /baserow/backend
RUN --mount=type=cache,target=$UV_CACHE_DIR,sharing=locked,uid=$UID,gid=$GID \
--mount=type=bind,source=LICENSE,target=/baserow/LICENSE \
--mount=type=bind,source=backend/uv.lock,target=/baserow/backend/uv.lock \
--mount=type=bind,source=backend/pyproject.toml,target=/baserow/backend/pyproject.toml \
--mount=type=bind,source=premium/LICENSE,target=/baserow/premium/LICENSE \
--mount=type=bind,source=premium/backend/pyproject.toml,target=/baserow/premium/backend/pyproject.toml \
--mount=type=bind,source=enterprise/LICENSE,target=/baserow/enterprise/LICENSE \
--mount=type=bind,source=enterprise/backend/pyproject.toml,target=/baserow/enterprise/backend/pyproject.toml \
uv sync --frozen --no-dev --no-install-workspace --no-install-project \
&& find /baserow/venv -type f \( -name "*.c" -o -name "*.h" \) -not -path "*/autobahn/*" -delete \
# Strip test/doc directories from site-packages (keep django/drf tests - used at runtime)
# Keep botocore/docs and boto3/docs - they're imported at runtime
&& (find /baserow/venv/lib -type d \( -name "test" -o -name "tests" \) \
-not -path "*/django/*" -not -path "*/rest_framework/*" -prune -exec rm -rf {} \; || true) \
&& (find /baserow/venv/lib -type d \( -name "doc" -o -name "docs" -o -name "example" -o -name "examples" \) \
-not -path "*/botocore/*" -not -path "*/boto3/*" -prune -exec rm -rf {} \; || true)
# =============================================================================
# CI Builder - includes dev dependencies for testing
# =============================================================================
FROM builder-prod-base AS builder-ci
ARG UID
ARG GID
USER $UID:$GID
WORKDIR /baserow/backend
# Install dev dependencies before copying source code to leverage caching
RUN --mount=type=cache,target=$UV_CACHE_DIR,sharing=locked,uid=$UID,gid=$GID \
--mount=type=bind,source=LICENSE,target=/baserow/LICENSE \
--mount=type=bind,source=backend/uv.lock,target=/baserow/backend/uv.lock \
--mount=type=bind,source=backend/pyproject.toml,target=/baserow/backend/pyproject.toml \
--mount=type=bind,source=premium/LICENSE,target=/baserow/premium/LICENSE \
--mount=type=bind,source=premium/backend/pyproject.toml,target=/baserow/premium/backend/pyproject.toml \
--mount=type=bind,source=enterprise/LICENSE,target=/baserow/enterprise/LICENSE \
--mount=type=bind,source=enterprise/backend/pyproject.toml,target=/baserow/enterprise/backend/pyproject.toml \
uv sync --frozen --no-install-workspace --no-install-project \
&& find /baserow/venv -type f \( -name "*.c" -o -name "*.h" \) -not -path "*/autobahn/*" -delete \
# Strip test/doc directories from site-packages (keep django/drf tests - used at runtime)
# Keep botocore/docs and boto3/docs - they're imported at runtime
&& (find /baserow/venv/lib -type d \( -name "test" -o -name "tests" \) \
-not -path "*/django/*" -not -path "*/rest_framework/*" -prune -exec rm -rf {} \; || true) \
&& (find /baserow/venv/lib -type d \( -name "doc" -o -name "docs" -o -name "example" -o -name "examples" \) \
-not -path "*/botocore/*" -not -path "*/boto3/*" -prune -exec rm -rf {} \; || true)
COPY --link --from=tool-builder /usr/bin/dos2unix /usr/local/bin/dos2unix
# Copy source code and tests
COPY --chown=$UID:$GID LICENSE /baserow/LICENSE
COPY --chown=$UID:$GID backend /baserow/backend
COPY --chown=$UID:$GID premium/LICENSE /baserow/premium/LICENSE
COPY --chown=$UID:$GID premium/backend /baserow/premium/backend
COPY --chown=$UID:$GID enterprise/LICENSE /baserow/enterprise/LICENSE
COPY --chown=$UID:$GID enterprise/backend /baserow/enterprise/backend
COPY --chown=$UID:$GID tests /baserow/tests
USER $UID:$GID
WORKDIR /baserow/backend
RUN dos2unix /baserow/backend/docker/docker-entrypoint.sh \
&& chmod a+x /baserow/backend/docker/docker-entrypoint.sh
# Install the project with premium and enterprise plugins
RUN --mount=type=cache,target=$UV_CACHE_DIR,sharing=locked,uid=$UID,gid=$GID \
uv sync --frozen \
&& find /baserow/venv -type f \( -name "*.c" -o -name "*.h" \) -not -path "*/autobahn/*" -delete \
# Strip test/doc directories from site-packages (keep django/drf tests - used at runtime)
# Keep botocore/docs and boto3/docs - they're imported at runtime
&& (find /baserow/venv/lib -type d \( -name "test" -o -name "tests" \) \
-not -path "*/django/*" -not -path "*/rest_framework/*" -prune -exec rm -rf {} \; || true) \
&& (find /baserow/venv/lib -type d \( -name "doc" -o -name "docs" -o -name "example" -o -name "examples" \) \
-not -path "*/botocore/*" -not -path "*/boto3/*" -prune -exec rm -rf {} \; || true)
# =============================================================================
# Production builder stage - creates runtime packages only
# =============================================================================
FROM builder-prod-base AS builder-prod
ARG UID
ARG GID
COPY --link --from=tool-builder /usr/bin/dos2unix /usr/local/bin/dos2unix
USER $UID:$GID
WORKDIR /baserow/backend
# Copy source code
COPY --chown=$UID:$GID LICENSE /baserow/LICENSE
COPY --chown=$UID:$GID backend /baserow/backend
COPY --chown=$UID:$GID premium/LICENSE /baserow/premium/LICENSE
COPY --chown=$UID:$GID premium/backend /baserow/premium/backend
COPY --chown=$UID:$GID enterprise/LICENSE /baserow/enterprise/LICENSE
COPY --chown=$UID:$GID enterprise/backend /baserow/enterprise/backend
RUN dos2unix /baserow/backend/docker/docker-entrypoint.sh \
&& chmod a+x /baserow/backend/docker/docker-entrypoint.sh
# Install the project with premium and enterprise workspaces, removing tests and unneeded files
RUN --mount=type=cache,target=$UV_CACHE_DIR,sharing=locked,uid=$UID,gid=$GID \
uv sync --frozen --no-dev \
&& find /baserow/venv -type f \( -name "*.c" -o -name "*.h" \) -not -path "*/autobahn/*" -delete \
# Strip test/doc directories from site-packages (keep django/drf tests - used at runtime)
# Keep botocore/docs and boto3/docs - they're imported at runtime
&& (find /baserow/ -type d \( -name "test" -o -name "tests" -o -name "email_compiler" \) \
-not -path "*/django/*" -not -path "*/rest_framework/*" -prune -exec rm -rf {} \; || true) \
&& (find /baserow/ -type d \( -name "doc" -o -name "docs" -o -name "example" -o -name "examples" \) \
-not -path "*/botocore/*" -not -path "*/boto3/*" -prune -exec rm -rf {} \; || true)
# =============================================================================
# CI Target - lightweight image for pytest and E2E tests
# =============================================================================
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim AS ci
ARG UID
ARG GID
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
xmlsec1
ENV DOCKER_USER=baserow_docker_user \
BASEROW_IMAGE_TYPE="backend" \
PYTHONUNBUFFERED=1 \
UV_PROJECT_ENVIRONMENT=/baserow/venv \
UV_CACHE_DIR=/tmp/baserow_uv_cache \
PATH="/baserow/venv/bin:$PATH" \
PYTHONPATH="/baserow/backend/src:/baserow/premium/backend/src:/baserow/enterprise/backend/src:/baserow/backend/tests:/baserow/premium/backend/tests:/baserow/enterprise/backend/tests" \
DJANGO_SETTINGS_MODULE='baserow.config.settings.test'
RUN groupadd --system --gid $GID ${DOCKER_USER} && \
useradd --shell /bin/bash -l -u $UID -g $GID -o -c "" -d /baserow -m ${DOCKER_USER}
COPY --link --from=tool-builder /usr/local/bin/su-exec /usr/local/bin/su-exec
COPY --link --from=tool-builder /usr/bin/tini /usr/bin/tini
# Create baserow directory structure (including subdirs for COPY targets)
RUN mkdir -p /baserow/backend/reports /baserow/premium/backend /baserow/enterprise/backend /baserow/media && \
chown -R $UID:$GID /baserow/
# Copy the virtual environment and source code with tests
COPY --link --from=builder-ci /baserow /baserow
COPY --chown=$UID:$GID deploy/plugins/*.sh /baserow/plugins/
USER $UID:$GID
WORKDIR /baserow/backend
ENTRYPOINT ["/usr/bin/tini", "--", "/bin/bash", "/baserow/backend/docker/docker-entrypoint.sh"]
# =============================================================================
# Dev image: includes dev dependencies and tools for local development
# Only works mounting the source code as a bind mount. See docker-compose.dev.yml for usage.
# =============================================================================
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim AS dev
ARG UID="9999"
ARG GID="9999"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Build dependencies - this layer is always cached
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
build-essential \
lsb-release \
python3.11-dev \
ca-certificates \
curl \
gnupg2 \
libpq-dev \
dos2unix \
tini \
&& \
# Postgresql repository has to be added manually to get pre-13 versions.
echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& \
apt-get update && \
apt-get install --no-install-recommends -y \
postgresql-client-$POSTGRES_VERSION \
gettext \
procps \
python3 \
python3-pip \
python3-dev \
python3-venv\
git \
postgresql-client-15 \
xmlsec1 \
&& python3 -m pip install --no-cache-dir --upgrade pip setuptools==78.1.1 --break-system-packages \
&& rm -rf /usr/lib/python3/dist-packages/setuptools* /usr/lib/python3/dist-packages/pkg_resources* \
&& apt-get autoclean \
&& apt-get clean \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/*
curl \
graphviz \
procps \
tmux \
vim \
sudo
# Install su-exec as a safer alternative to gosu
RUN curl -L -o /usr/local/bin/su-exec.c https://github.com/ncopa/su-exec/raw/master/su-exec.c \
&& gcc -Wall -Werror -static -o /usr/local/bin/su-exec /usr/local/bin/su-exec.c \
&& chmod 0755 /usr/local/bin/su-exec \
&& rm /usr/local/bin/su-exec.c
ENV DOCKER_USER=baserow_docker_user \
BASEROW_IMAGE_TYPE="backend" \
UV_PYTHON_DOWNLOADS=0 \
UV_COMPILE_BYTECODE=0 \
UV_LINK_MODE=copy \
UV_PROJECT_ENVIRONMENT=/baserow/venv \
UV_CACHE_DIR=/tmp/baserow_uv_cache_dev \
PYTHONUNBUFFERED=1 \
PATH=/baserow/venv/bin:$PATH \
PYTHONPATH=/baserow/backend/src:/baserow/premium/backend/src:/baserow/enterprise/backend/src:/baserow/backend/tests:/baserow/premium/backend/tests:/baserow/enterprise/backend/tests \
DJANGO_SETTINGS_MODULE=baserow.config.settings.dev
RUN getent group $GID || groupadd --system --gid $GID ${DOCKER_USER} && \
useradd --shell /bin/bash -l -u $UID -g $GID -o -c "" -d /baserow -m ${DOCKER_USER} && \
echo "${DOCKER_USER} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${DOCKER_USER} && \
chmod 0440 /etc/sudoers.d/${DOCKER_USER}
COPY --link --from=tool-builder /usr/local/bin/su-exec /usr/local/bin/su-exec
COPY --link --from=tool-builder /usr/bin/tini /usr/bin/tini
COPY --link --from=tool-builder /usr/bin/dos2unix /usr/local/bin/dos2unix
# Create directory structure to install dependencies
RUN mkdir -p /baserow/backend/docker /baserow/premium/ /baserow/enterprise/ /baserow/media && \
chown -R $UID:$GID /baserow/
USER $UID:$GID
# In slim docker images, mime.types is removed and we need it for mimetypes guessing
COPY --chown=$UID:$GID ./backend/docker/mime.types /etc/
# Install non-dev base dependencies into a virtual env.
COPY --chown=$UID:$GID ./backend/requirements/base.txt /baserow/requirements/
RUN python3 -m venv /baserow/venv
ENV PIP_CACHE_DIR=/tmp/baserow_pip_cache
# hadolint ignore=SC1091,DL3042,DL3013
RUN --mount=type=cache,mode=777,target=$PIP_CACHE_DIR,uid=$UID,gid=$GID . /baserow/venv/bin/activate \
&& pip3 install --no-cache-dir --upgrade pip setuptools==78.1.1 \
&& pip3 install --no-compile -r /baserow/requirements/base.txt \
&& find /baserow/venv -type d -name "__pycache__" -prune -exec rm -rf '{}' + \
&& find /baserow/venv -type f \( -name "*.pyc" -o -name "*.pyo" \) -delete \
&& find /baserow/venv -type f \( -name "*.c" -o -name "*.h" \) -delete
# Build a dev_deps stage which also has the dev dependencies for use by the dev layer.
FROM base AS dev_deps
COPY ./backend/requirements/dev.txt /baserow/requirements/
# hadolint ignore=SC1091,DL3042,DL3013
RUN --mount=type=cache,mode=777,target=$PIP_CACHE_DIR,uid=$UID,gid=$GID . /baserow/venv/bin/activate \
&& pip3 install --no-cache-dir --upgrade pip setuptools==78.1.1 \
&& pip3 install -r /baserow/requirements/dev.txt
# The core stage contains all of Baserows source code and sets up the entrypoint
FROM base AS core
# Copy over backend code.
COPY --chown=$UID:$GID ./docs /baserow/docs
# TODO - This copy also re-copies the requirements above, meaning this will be re-run
# and not cached even though we already have separate layers above.
COPY --chown=$UID:$GID ./backend /baserow/backend
COPY --chown=$UID:$GID ./premium/backend /baserow/premium/backend
COPY --chown=$UID:$GID ./enterprise/backend /baserow/enterprise/backend
WORKDIR /baserow/backend
# Ensure that Python outputs everything that's printed inside
# the application rather than buffering it.
ENV PYTHONUNBUFFERED=1
# Install all dependencies
RUN --mount=type=cache,target=$UV_CACHE_DIR,sharing=locked,uid=$UID,gid=$GID \
--mount=type=bind,source=LICENSE,target=/baserow/LICENSE \
--mount=type=bind,source=backend/uv.lock,target=/baserow/backend/uv.lock \
--mount=type=bind,source=backend/pyproject.toml,target=/baserow/backend/pyproject.toml \
--mount=type=bind,source=premium/LICENSE,target=/baserow/premium/LICENSE \
--mount=type=bind,source=premium/backend/pyproject.toml,target=/baserow/premium/backend/pyproject.toml \
--mount=type=bind,source=enterprise/LICENSE,target=/baserow/enterprise/LICENSE \
--mount=type=bind,source=enterprise/backend/pyproject.toml,target=/baserow/enterprise/backend/pyproject.toml \
uv sync --frozen --no-install-workspace --no-install-project
COPY --chown=$UID:$GID ./deploy/plugins/*.sh /baserow/plugins/
# Configure tmux to preserve environment variables (don't start login shell)
RUN echo 'set -g default-command "${SHELL}"' > /baserow/.tmux.conf
RUN dos2unix /baserow/backend/docker/docker-entrypoint.sh && \
chmod a+x /baserow/backend/docker/docker-entrypoint.sh && \
/baserow/venv/bin/pip install --no-cache-dir -e /baserow/backend/ && \
/baserow/venv/bin/pip install --no-cache-dir -e /baserow/premium/backend/ && \
/baserow/venv/bin/pip install --no-cache-dir -e /baserow/enterprise/backend/
# Create .bashrc with environment variables for interactive shells
RUN printf '%s\n' \
'# Aliases' \
'alias j="just"' \
'alias m="python /baserow/backend/src/baserow/manage.py"' \
'alias pytest="python -m pytest"' \
'' \
'# Show a helpful message' \
'echo "Baserow backend dev container"' \
'echo " m <cmd> - Django manage.py (e.g., m shell_plus)"' \
'echo " pytest - Run tests"' \
'echo " j - See available commands"' \
> /baserow/.bashrc
COPY --chown=$UID:$GID LICENSE /baserow/LICENSE
COPY --chown=$UID:$GID backend/docker/docker-entrypoint.sh /baserow/backend/docker/docker-entrypoint.sh
RUN dos2unix /baserow/backend/docker/docker-entrypoint.sh \
&& chmod a+x /baserow/backend/docker/docker-entrypoint.sh
HEALTHCHECK --interval=60s CMD ["/bin/bash", "/baserow/backend/docker/docker-entrypoint.sh", "backend-healthcheck"]
ENTRYPOINT ["/usr/bin/tini", "--", "/bin/bash", "/baserow/backend/docker/docker-entrypoint.sh"]
FROM core AS dev
COPY --chown=$UID:$GID ./tests /baserow/tests/
USER root
RUN apt-get update && \
apt-get install -y --no-install-recommends \
graphviz apache2-utils \
&& apt-get autoclean \
&& apt-get clean \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/*
USER $UID:$GID
# Override virtualenv with one containing dev dependencies.
COPY --chown=$UID:$GID --from=dev_deps /baserow/venv /baserow/venv
# Override env variables and initial cmd to start up in dev mode.
ENV DJANGO_SETTINGS_MODULE='baserow.config.settings.dev'
CMD ["django-dev"]
FROM core AS local
ENV DJANGO_SETTINGS_MODULE='baserow.config.settings.base'
# =============================================================================
# Production target
# =============================================================================
FROM python:3.11-slim-bookworm AS local
ARG UID
ARG GID
ENV POSTGRES_VERSION=15 \
DOCKER_USER=baserow_docker_user \
BASEROW_IMAGE_TYPE="backend" \
UV_PROJECT_ENVIRONMENT=/baserow/venv \
PYTHONUNBUFFERED=1 \
PATH="/baserow/venv/bin:$PATH" \
PYTHONPATH="/baserow/backend/src:/baserow/premium/backend/src:/baserow/enterprise/backend/src" \
DJANGO_SETTINGS_MODULE='baserow.config.settings.base'
# Runtime dependencies only - this layer is always cached
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
postgresql-client-${POSTGRES_VERSION} \
xmlsec1 \
gettext
RUN groupadd --system --gid $GID ${DOCKER_USER} && \
useradd --shell /bin/bash -l -u $UID -g $GID -o -c "" -d /baserow -m ${DOCKER_USER}
# In slim docker images, mime.types is removed and we need it for mimetypes guessing
COPY ./backend/docker/mime.types /etc/
COPY --link --from=tool-builder /usr/local/bin/su-exec /usr/local/bin/su-exec
COPY --link --from=tool-builder /usr/bin/tini /usr/bin/tini
RUN mkdir -p /baserow/media && chown -R $UID:$GID /baserow/
# Copy the virtual environment with the production dependencies
COPY --link --from=builder-prod /baserow/venv /baserow/venv/
COPY --chown=$UID:$GID LICENSE /baserow/LICENSE
COPY --link --from=builder-prod /baserow/backend /baserow/backend/
COPY --link --from=builder-prod /baserow/premium /baserow/premium/
COPY --link --from=builder-prod /baserow/enterprise /baserow/enterprise/
COPY --chown=$UID:$GID deploy/plugins/*.sh /baserow/plugins/
USER $UID:$GID
WORKDIR /baserow/backend
HEALTHCHECK --interval=60s CMD ["/bin/bash", "/baserow/backend/docker/docker-entrypoint.sh", "backend-healthcheck"]
ENTRYPOINT ["/usr/bin/tini", "--", "/bin/bash", "/baserow/backend/docker/docker-entrypoint.sh"]
CMD ["gunicorn"]
FROM local AS prod
CMD ["gunicorn"]
+1 -1
View File
@@ -13,7 +13,7 @@ recursive-include src/ *.py
recursive-include templates/ *
recursive-include flake8_plugins/
include tests/
include requirements/*.in requirements/*.txt docker/ email_compiler/
include docker/ email_compiler/
include README.md
include pyproject.toml
include MANIFEST.in
-272
View File
@@ -1,272 +0,0 @@
# optionally include .env files
# you can override variables in .env files
# mind that paths are caclucated from variables are
# relative to this Makefile location
-include ../.env .env ../Makefile.local Makefile.local
ifeq ($(shell uname -s),Darwin)
REALPATH:=grealpath -em
else
REALPATH:=realpath -em
endif
WORKDIR:=$(shell $(REALPATH) $(shell pwd))
# use PYBIN to customize python interpreter path
PYBIN:=$(shell which python3.11 || which python3 || which python)
VENV_DIR:=$(shell $(REALPATH) -em $(if $(VENV_DIR),$(VENV_DIR),$(WORKDIR)/../venv))
# make sure we use one specific shell
SHELL=/bin/bash
# .SHELLFLAGS=-e
VPY:=$(VENV_DIR)/bin/python
VPIP:=$(VENV_DIR)/bin/pip
VPIPC:=$(VENV_DIR)/bin/pip-compile
VFLAKE:=$(VENV_DIR)/bin/flake8
VBLACK:=$(VENV_DIR)/bin/black
VISORT:=$(VENV_DIR)/bin/isort
VBANDIT:=$(VENV_DIR)/bin/bandit
VDJANGO:=$(VENV_DIR)/bin/django-admin
VPYTEST:=$(VENV_DIR)/bin/pytest
VCOVERAGE:=$(VENV_DIR)/bin/coverage
VBASEROW:=$(VENV_DIR)/bin/baserow
VGUNICORN:=$(VENV_DIR)/bin/gunicorn
# will be used if no DJANGO_SETTINGS_MODULE is provided
DJANGO_SETTINGS_MODULE:=baserow.config.settings.dev
# ip:port to use when running dev server
RUNSERVER_BIND:=0.0.0.0:8000
VENV_TOUCH:=$(VENV_DIR)/bin/activate
DOCKER:=docker
DOCKERC:=docker compose
PYTEST_SPLITS:=1
PYTEST_SPLIT_GROUP:=1
PYTEST_EXTRA_ARGS?=
SOURCE_DIRS=./ ../premium/backend/ ../enterprise/backend/
BACKEND_SOURCE_DIRS=src/ ../premium/backend/src/ ../enterprise/backend/src/
BACKEND_TESTS_DIRS=tests/ ../premium/backend/tests/ ../enterprise/backend/tests/
BACKEND_TESTS_DIRS_FROM_ROOT=backend/tests/ premium/backend/tests/ enterprise/backend/tests/
#no-file targets
.PHONY: help venv venv-clean install-oss install install-extra package docker-build package-install\
clean clean-all package-build package-clean deps deps-clean deps-install deps-install-dev deps-upgrade\
lint lint-fix lint-python format sort make-translations compile-translations\
test test-builder test-builder-parallel test-coverage test-parallel test-regenerate-ci-durations\
ci-test-python ci-check-startup-python ci-coverage-report fix\
run-dev
# This is a first target in the file, will be executed as default if no targets
# are specified. We'll use it to display usage
help:
@echo "make commands available"
@echo " make install - create a venv, install full Baserow package (base + premium/enterprise) in it"
@echo " make venv - create a venv"
@echo " make deps-install - install deps to venv"
@echo " make install-oss - install Baserow OSS version without premium/enterprise"
@echo " make install-extra - install Baserow premium/enterprise only (this still requires install-oss)"
@echo " make lint - run lint/style tools"
@echo " make lint-fix - run lint/style tools and fix the code"
@echo " make package-build - build wheel package"
@echo " make docker-build - build docker image for backend only"
@echo " make clean - remove build artifacts"
@echo " make clean-all - remove build artifacts and venv"
@echo " make deps - update dependencies without upgrade"
@echo " make deps-upgrade - recalculate dependencies with versions upgrade"
@echo " make deps-install - install runtime deps"
@echo " make deps-install-dev - install development deps"
@echo " make run-dev - run development server"
# touchfile for venv. If this file is present, the target won't be executed
# (so venv will be created from scratch only if there's no venv/bin/activate).
$(VENV_TOUCH):
$(PYBIN) -m venv $(VENV_DIR)
$(VPIP) install --upgrade pip==24.0
touch $(VENV_TOUCH)
# this is a shortcut - use venv as a dependent target elsewhere
venv: $(VENV_TOUCH)
# install premium/enterprise apps
.install-extra:
$(VPIP) install -e ../premium/backend/
$(VPIP) install -e ../enterprise/backend/
# install base open-source version
.install-oss:
$(VPIP) install -e .
# create venv and install base version of BR
install-oss: deps-install-dev .install-oss
install-extra: deps-install-dev .install-extra
# install premium/enterprise versions
install: deps-install-dev .install-oss .install-extra
# build wheel packages
package-build: venv deps-install-dev
$(VPY) -m build . -o dist/
$(VPY) -m build ../premium/backend/ -o dist/ || true
$(VPY) -m build ../enterprise/backend/ -o dist/ || true
package-install: package
for p in $(wildcard dist/*whl); do $(VPIP) install --force-reinstall dist/$${p}; done;
docker-build:
$(DOCKER) build .
# rebuild deps for the app. do not upgrade already recorded deps
deps: venv install
$(VPIPC) --no-upgrade requirements/base.in
$(VPIPC) --no-upgrade requirements/dev.in
# rebuild and upgrade deps
deps-upgrade: venv install
$(VPIPC) requirements/base.in
$(VPIPC) requirements/dev.in
# install runtime deps
deps-install: venv
# handle gracefull, as not all uses debian-alikes)
(apt-get update && apt-get install -y libpq-dev postgresql-client) || true
$(VPIP) install -r requirements/base.txt
# install dev deps
deps-install-dev: deps-install
$(VPIP) install -r requirements/dev.txt
.check-dev:
test -f $(VBASEROW) || $(MAKE) deps-install-dev install
# run lint check on backend code
lint: .check-dev
$(VFLAKE) $(BACKEND_SOURCE_DIRS) $(BACKEND_TESTS_DIRS)
$(VBLACK) $(BACKEND_SOURCE_DIRS) $(BACKEND_TESTS_DIRS) --check --config=pyproject.toml
$(VISORT) --check --skip generated $(BACKEND_SOURCE_DIRS) $(BACKEND_TESTS_DIRS)
# TODO: make baserow command reading dotenv files
DJANGO_SETTINGS_MODULE=$(DJANGO_SETTINGS_MODULE) $(VBASEROW) makemigrations --dry-run --check
$(VBANDIT) -r --exclude src/baserow/test_utils,src/baserow/config/settings/local.py $(BACKEND_SOURCE_DIRS)
lint-python: lint
format: .check-dev
$(VBLACK) --config=pyproject.toml $(BACKEND_SOURCE_DIRS) $(BACKEND_TESTS_DIRS) || exit;
lint-fix: sort format
# compatibility with previous convention
fix: lint-fix
sort: .check-dev
$(VISORT) --skip generated --overwrite-in-place $(BACKEND_SOURCE_DIRS) $(BACKEND_TESTS_DIRS) || exit;
test: .check-dev
$(VPYTEST) $(BACKEND_TESTS_DIRS) || exit;
test-diff: .check-dev
$(VPYTEST) $(BACKEND_TESTS_DIRS) --testmon || exit;
test-coverage: .check-dev
$(VPYTEST) -n 10 --cov-report term --cov-report html:reports/html --cov=src $(BACKEND_TESTS_DIRS) || exit;
test-builder: .check-dev
$(VPYTEST) tests/baserow/contrib/integrations tests/baserow/contrib/builder || exit
test-builder-parallel: .check-dev
$(VPYTEST) tests/baserow/contrib/integrations tests/baserow/contrib/builder -n 10 || exit
test-automation: .check-dev
$(VPYTEST) tests/baserow/contrib/integrations tests/baserow/contrib/automation || exit
test-automation-parallel: .check-dev
$(VPYTEST) tests/baserow/contrib/integrations tests/baserow/contrib/automation -n 10 || exit
test-regenerate-ci-durations: .check-dev
$(VPYTEST) $(BACKEND_TESTS_DIRS) --store-durations || exit;
test-parallel: .check-dev
$(VPYTEST) $(BACKEND_TESTS_DIRS) -n 10 || exit;
test-diff-parallel: .check-dev
$(VPYTEST) $(BACKEND_TESTS_DIRS) --testmon -n 10 || exit;
.make-django-cmd: .check-dev
for pkg_dir in $(SOURCE_DIRS); do echo $$pkg_dir ; cd $$pkg_dir ; \
$(VDJANGO) $(DJANGO_COMMAND) || true ; cd - ;\
done
make-translations: DJANGO_COMMAND=makemessages -l en --ignore 'tests/*'
make-translations: .make-django-cmd
compile-translations: DJANGO_COMMAND=compilemessages -l en
compile-translations: .make-django-cmd
# coverage needs to be executed from repo root
# to match paths in backend/ premium/ and enterprise/
ci-test-python: .check-dev
mkdir reports/ -p
cd $(WORKDIR)/../ ; COVERAGE_FILE=backend/reports/.coverage.$(PYTEST_SPLIT_GROUP) $(VCOVERAGE) run \
--rcfile=backend/.coveragerc \
-m pytest -vv \
--durations-path=backend/.test_durations \
--splits $(PYTEST_SPLITS) \
--group $(PYTEST_SPLIT_GROUP) \
--junitxml=backend/reports/report.xml \
$(PYTEST_EXTRA_ARGS) $(BACKEND_TESTS_DIRS_FROM_ROOT);
# coverage needs to be executed from repo root
# to match paths in backend/ premium/ and enterprise/
ci-coverage-report: .check-dev
cd $(WORKDIR)/../ ; cp backend/reports/.coverage.* . ; export COVERAGE_RCFILE=backend/.coveragerc ; \
$(VCOVERAGE) combine ; \
$(VCOVERAGE) report ; \
$(VCOVERAGE) xml -o coverage.xml
define check_startup_python
@set -euo pipefail; set -x; \
BASEROW_OSS_ONLY=$(1) DJANGO_SETTINGS_MODULE=$(DJANGO_SETTINGS_MODULE) $(VDJANGO) check; \
BASEROW_OSS_ONLY=$(1) DJANGO_SETTINGS_MODULE=$(DJANGO_SETTINGS_MODULE) timeout --preserve-status 10s \
$(VGUNICORN) --workers=1 -b 0.0.0.0:8002 \
-k uvicorn.workers.UvicornWorker baserow.config.asgi:application
endef
ci-check-startup-python: .check-dev
$(call check_startup_python,)
ci-check-startup-python-oss-only: .check-dev
$(call check_startup_python,true)
# clean targets
# remove wheel packages from build output dir
package-clean:
rm -fr dist/*
# remove venv
venv-clean:
rm -fr $(VENV_DIR)
# clean env and build
clean: package-clean
clean-all: clean venv-clean
deps-clean:
rm -f requirements/base.txt
rm -f requirements/base.txt
run-dev: .check-dev
$(VBASEROW) runserver $(RUNSERVER_BIND)
+13 -10
View File
@@ -181,11 +181,10 @@ celery-exportworker-healthcheck : Checks the celery-exportworker health
DEV COMMANDS (most will only work in the baserow_backend_dev image):
django-dev : Start a normal Baserow backend django development server, performs
the same checks and setup as the gunicorn command above.
lint-shell : Run the linting (only available if using dev target)
lint-shell : Run the linting interactively (only available if using dev target)
lint : Run the linting and exit (only available if using dev target)
test: : Run the tests (only available if using dev target)
ci-test: : Run the tests for ci including various reports (dev only)
ci-check-startup: Start up a single gunicorn and timeout after 10 seconds for ci (dev)
ci-test : Run the tests for CI with coverage/splits (dev only)
ci-check-startup: Start up a single gunicorn and timeout after 10 seconds for CI (dev)
watch-py CMD : Auto reruns the provided CMD whenever python files change
install-plugin : Installs a baserow plugin.
"""
@@ -350,19 +349,19 @@ case "$1" in
exec python3 /baserow/backend/src/baserow/manage.py shell
;;
lint-shell)
attachable_exec make lint-python
attachable_exec just lint
;;
lint)
exec make lint-python
exec just lint
;;
ci-test)
exec make ci-test-python PYTEST_SPLITS="${PYTEST_SPLITS:-1}" PYTEST_SPLIT_GROUP="${PYTEST_SPLIT_GROUP:-1}" PYTEST_EXTRA_ARGS="${*:2}"
exec just ci-test --splits "${PYTEST_SPLITS:-1}" --group "${PYTEST_SPLIT_GROUP:-1}" "${@:2}"
;;
ci-check-startup)
exec make ci-check-startup-python
exec just ci-check-startup
;;
ci-check-startup-oss-only)
exec make ci-check-startup-python-oss-only
exec just ci-check-startup-oss-only
;;
celery-worker)
if [[ -n "${BASEROW_RUN_MINIMAL}" && $BASEROW_AMOUNT_OF_WORKERS == "1" ]]; then
@@ -400,7 +399,11 @@ case "$1" in
"startup errors."
sleep "$BASEROW_CELERY_BEAT_STARTUP_DELAY"
export OTEL_SERVICE_NAME="celery-beat"
exec celery -A baserow beat -l "${BASEROW_CELERY_BEAT_DEBUG_LEVEL}" -S redbeat.RedBeatScheduler "${@:2}"
exec celery -A baserow beat --pidfile=/tmp/celerybeat.pid -l "${BASEROW_CELERY_BEAT_DEBUG_LEVEL}" -S redbeat.RedBeatScheduler "${@:2}"
;;
celery-beat-healthcheck)
echo "Running celery beat healthcheck..."
exec test -f /tmp/celerybeat.pid && kill -0 $(cat /tmp/celerybeat.pid) || exit 1
;;
celery-flower)
exec celery -A baserow flower "$@"
+5 -4
View File
@@ -1,9 +1,10 @@
## How to run
`dev.sh` will automatically start `baserowEmailCompiler.js` in watch mode so no need
to run this manually if you are using it, otherwise:
The Docker development environment (`just dc-dev up -d`) automatically starts
`baserowEmailCompiler.js` in watch mode, so no need to run this manually if you
are using it.
In this directory run:
* `yarn install`
For manual compilation, in this directory run:
* `yarn install`
* To watch: `yarn run watch`
* To compile once and exit: `yarn run compile`
+642
View File
@@ -0,0 +1,642 @@
# Baserow Backend Justfile
# NOTE: All recipes here must work the same inside Docker and on local dev setups
# without requiring any changes. Please make sure to not add docker-specific
# commands or assumptions here.
# Uses uv for Python package management
# Import personal recipes if they exist (not tracked in git)
import? 'local.just'
# Environment file configuration:
# - .env.local : Local development (recommended, gitignored)
# - .env : Docker/production (used by docker-compose)
# - .env.test : Test environment
#
# Note: just doesn't support dynamic dotenv-filename, so we handle env loading in recipes
# Default recipe - show help
default:
@just --list
# Show documentation links for each command group
[group('0 - help')]
help:
@echo "Baserow Backend - Documentation Links"
@echo "======================================"
@echo ""
@echo "Setup & Development:"
@echo " docs/development/running-the-dev-env-locally.md - Local development setup"
@echo " docs/development/running-the-dev-env-with-docker.md - Docker development setup"
@echo " docs/development/directory-structure.md - Project structure"
@echo ""
@echo "Testing:"
@echo " docs/development/running-tests.md - Running backend tests"
@echo " docs/development/e2e-testing.md - End-to-end testing"
@echo ""
@echo "Code Quality:"
@echo " docs/development/code-quality.md - Linting and formatting"
@echo ""
@echo "CI/CD & Production:"
@echo " docs/development/ci-cd.md - CI/CD pipelines"
@echo " docs/development/building-and-running-production-images.md - Production images"
@echo ""
@echo "IDE Setup:"
@echo " docs/development/vscode-setup.md - VS Code configuration"
@echo " docs/development/intellij-setup.md - IntelliJ/PyCharm setup"
@echo ""
@echo "Other:"
@echo " docs/development/justfile.md - Just command reference"
@echo " docs/development/debugging.md - Debugging tips"
@echo " docs/development/feature-flags.md - Feature flags"
@echo ""
@echo "Quick shortcuts: l=lint, t=test, dev=run-dev-server, m=manage"
# Allow `just backend <cmd>` or `just b <cmd>` to work (for consistency with root justfile)
backend *ARGS:
@just {{ ARGS }}
alias b := backend
# Common shortcuts
alias l := lint
alias f := fix
alias t := test
alias dev := run-dev-server
alias serve := run-dev-server
# Variables
python_version := "3.11"
# Venv location: use UV_PROJECT_ENVIRONMENT if set (e.g., in Docker), otherwise default to project root
venv_dir := env("UV_PROJECT_ENVIRONMENT", justfile_directory() / "../.venv")
# Export for uv to use
export UV_PROJECT_ENVIRONMENT := venv_dir
# Use --active to respect VIRTUAL_ENV, since venv may be in parent dir
uv_run := "uv run --active"
# Repo root (parent of backend/) - clean() normalizes path (removes ..)
repo_root := clean(justfile_directory() / "..")
# Helper to load .env.local if present and set PYTHONPATH with absolute paths
# Include this at the start of bash recipes that need env vars
_load_env := 'if [ -f "../.env.local" ]; then set -a; source "../.env.local"; set +a; fi; export PYTHONPATH="' + repo_root / 'backend/src:' + repo_root / 'premium/backend/src:' + repo_root / 'enterprise/backend/src:' + repo_root / 'backend/flake8_plugins:' + repo_root / 'backend/tests:' + repo_root / 'premium/backend/tests:' + repo_root / 'enterprise/backend/tests${PYTHONPATH:+:$PYTHONPATH}"'
# Source directories
backend_source_dirs := "src/ ../premium/backend/src/ ../enterprise/backend/src/"
backend_tests_dirs := "tests/ ../premium/backend/tests/ ../enterprise/backend/tests/"
backend_tests_dirs_from_root := "backend/tests/ premium/backend/tests/ enterprise/backend/tests/"
# Django settings
django_settings := env("DJANGO_SETTINGS_MODULE", "baserow.config.settings.dev")
export DJANGO_SETTINGS_MODULE := django_settings
runserver_bind := env("RUNSERVER_BIND", "0.0.0.0:8000")
# Log files for dev servers (used by logs command)
log_file := "/tmp/baserow-backend.log"
celery_log_file := "/tmp/baserow-celery.log"
# Pytest settings
pytest_splits := env("PYTEST_SPLITS", "1")
pytest_split_group := env("PYTEST_SPLIT_GROUP", "1")
pytest_extra_args := env("PYTEST_EXTRA_ARGS", "")
# =============================================================================
# Setup & Installation
# =============================================================================
# Initialize: create Python venv with uv, lock deps, and install everything
[group('1 - setup')]
init: _setup-env _create-venv
uv lock
uv sync
@echo ""
@echo "Backend initialized successfully!"
@echo ""
@echo "To activate the virtual environment:"
@echo " source {{ venv_dir }}/bin/activate"
@echo ""
@echo "Or run commands directly with:"
@echo " just run <command>"
@echo " uv run <command>"
# Copy .env.local.example to .env.local if it doesn't exist (in project root)
_setup-env:
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f ../.env.local ] && [ -f ../.env.local.example ]; then
echo "Creating .env.local from .env.local.example..."
cp ../.env.local.example ../.env.local
echo "Please review and edit .env.local as needed."
fi
# Print the command to activate the virtual environment
[group('1 - setup')]
activate:
@echo "Run this command to activate the virtual environment:"
@echo ""
@echo " source {{ venv_dir }}/bin/activate"
# Create Python 3.11 virtual environment with uv
_create-venv:
#!/usr/bin/env bash
set -euo pipefail
if [ ! -d "{{ venv_dir }}" ]; then
echo "Creating Python {{ python_version }} virtual environment..."
uv venv --python {{ python_version }} "{{ venv_dir }}"
else
echo "Virtual environment already exists at {{ venv_dir }}"
fi
# Install dependencies (includes baserow + premium + enterprise via workspace)
[group('1 - setup')]
install: _create-venv
uv sync
@echo "Baserow installed successfully!"
# =============================================================================
# Dependency Management (uv)
# =============================================================================
# Run uv commands directly. Examples:
# just uv lock # Generate/update uv.lock
# just uv sync # Install all deps from lockfile
# just uv sync --frozen --no-dev # Install prod deps only
# just uv lock --upgrade # Upgrade all dependencies
# just uv lock --upgrade-package X # Upgrade specific package
# just uv add <package> # Add dependency
# just uv add --dev <package> # Add dev dependency
# just uv remove <package> # Remove dependency
# just uv pip list # List installed packages
# just uv pip show <package> # Show package info
# just uv tree # Show dependency tree
[group('6 - dependencies')]
uv *ARGS:
#!/usr/bin/env bash
set -euo pipefail
if [ -z "{{ ARGS }}" ]; then
echo "Usage: just uv <command> [args...]"
echo ""
echo "Examples:"
echo " just uv lock # Generate/update uv.lock"
echo " just uv sync # Install all deps from lockfile"
echo " just uv sync --frozen --no-dev # Install prod deps only"
echo " just uv lock --upgrade # Upgrade all dependencies"
echo " just uv lock --upgrade-package X # Upgrade specific package"
echo " just uv add <package> # Add dependency"
echo " just uv add --dev <package> # Add dev dependency"
echo " just uv remove <package> # Remove dependency"
echo " just uv pip list # List installed packages"
echo " just uv pip show <package> # Show package info"
echo " just uv tree # Show dependency tree"
exit 0
fi
uv {{ ARGS }}
# =============================================================================
# Code Quality & Linting
# =============================================================================
# Run all lint checks
[group('4 - code-quality')]
lint: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ uv_run }} flake8 {{ backend_source_dirs }} {{ backend_tests_dirs }}
{{ uv_run }} black {{ backend_source_dirs }} {{ backend_tests_dirs }} --check --config=pyproject.toml
{{ uv_run }} isort --check --skip generated {{ backend_source_dirs }} {{ backend_tests_dirs }}
DJANGO_SETTINGS_MODULE={{ django_settings }} {{ uv_run }} baserow makemigrations --dry-run --check
{{ uv_run }} bandit -r --exclude src/baserow/test_utils,src/baserow/config/settings/local.py {{ backend_source_dirs }}
# Format code with black
[group('4 - code-quality')]
format: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ uv_run }} black --config=pyproject.toml {{ backend_source_dirs }} {{ backend_tests_dirs }}
# Sort imports with isort
[group('4 - code-quality')]
sort: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ uv_run }} isort --skip generated --overwrite-in-place {{ backend_source_dirs }} {{ backend_tests_dirs }}
# Fix code style (sort imports + format)
[group('4 - code-quality')]
fix: sort format
# =============================================================================
# Testing
# =============================================================================
# PYTHONPATH for test fixtures across all test directories
test_pythonpath := "tests:../premium/backend/tests:../enterprise/backend/tests"
_pytest := 'PYTHONPATH="' + test_pythonpath + ':${PYTHONPATH:-}" ' + uv_run + ' pytest'
# Run tests. Pass -n=auto to run in parallel with pytest-xdist
[group('3 - testing')]
test *ARGS: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ _pytest }} {{ ARGS }}
# Run tests with coverage report
[group('3 - testing')]
test-coverage: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ _pytest }} -n 10 --cov-report term --cov-report html:reports/html --cov=src {{ backend_tests_dirs }}
# Run builder tests
[group('3 - testing')]
test-builder: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ _pytest }} tests/baserow/contrib/integrations tests/baserow/contrib/builder
# Run automation tests
[group('3 - testing')]
test-automation: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ _pytest }} tests/baserow/contrib/integrations tests/baserow/contrib/automation
# Regenerate CI test durations
[group('3 - testing')]
test-regenerate-ci-durations: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ _pytest }} {{ backend_tests_dirs }} --store-durations
# =============================================================================
# CI Commands (used by docker-entrypoint.sh in CI pipelines)
# =============================================================================
# Run tests for CI with coverage, splits, and reports
# Usage: just ci-test --splits 8 --group 1 [extra pytest args]
[group('8 - ci')]
ci-test *ARGS: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
# Parse arguments
SPLITS=1
GROUP=1
EXTRA_ARGS=""
args=({{ ARGS }})
i=0
while [[ $i -lt ${#args[@]} ]]; do
case "${args[$i]}" in
--splits) SPLITS="${args[$((i+1))]}"; ((i+=2)) ;;
--group) GROUP="${args[$((i+1))]}"; ((i+=2)) ;;
*) EXTRA_ARGS="$EXTRA_ARGS ${args[$i]}"; ((i+=1)) ;;
esac
done
mkdir -p reports/
cd ..
COVERAGE_FILE=backend/reports/.coverage.$GROUP \
{{ uv_run }} coverage run \
--rcfile=backend/.coveragerc \
--concurrency=multiprocessing \
-m pytest -vv \
-n auto \
--durations-path=backend/.test_durations \
--splits $SPLITS \
--group $GROUP \
--junitxml=backend/reports/report.xml \
$EXTRA_ARGS {{ backend_tests_dirs_from_root }}
# Check Django startup (used in CI)
[group('8 - ci')]
ci-check-startup: _check-dev
#!/usr/bin/env bash
set -euo pipefail
set -x
{{ _load_env }}
{{ uv_run }} python src/baserow/manage.py check
timeout --preserve-status 10s \
{{ uv_run }} gunicorn --workers=1 -b 0.0.0.0:8002 \
-k uvicorn.workers.UvicornWorker baserow.config.asgi:application
# Check Django startup with OSS only (used in CI)
[group('8 - ci')]
ci-check-startup-oss-only: _check-dev
#!/usr/bin/env bash
set -euo pipefail
set -x
{{ _load_env }}
BASEROW_OSS_ONLY=true {{ uv_run }} python src/baserow/manage.py check
BASEROW_OSS_ONLY=true timeout --preserve-status 10s \
{{ uv_run }} gunicorn --workers=1 -b 0.0.0.0:8002 \
-k uvicorn.workers.UvicornWorker baserow.config.asgi:application
# =============================================================================
# Translations
# =============================================================================
# Generate translation files
[group('7 - translations')]
make-translations: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
for pkg_dir in ./ ../premium/backend/ ../enterprise/backend/; do
echo "Processing $pkg_dir"
cd "$pkg_dir"
{{ uv_run }} django-admin makemessages -l en --ignore 'tests/*' || true
cd -
done
# =============================================================================
# CI Tasks
# =============================================================================
# Run CI Python tests with coverage
[group('8 - ci')]
ci-test-python: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
mkdir -p reports/
cd "{{ justfile_directory() }}/.."
COVERAGE_FILE=backend/reports/.coverage.{{ pytest_split_group }} \
{{ uv_run }} coverage run \
--rcfile=backend/.coveragerc \
--concurrency=multiprocessing \
-m pytest -vv \
-n auto \
--durations-path=backend/.test_durations \
--splits {{ pytest_splits }} \
--group {{ pytest_split_group }} \
--junitxml=backend/reports/report.xml \
{{ pytest_extra_args }} {{ backend_tests_dirs_from_root }}
# Generate CI coverage report
[group('8 - ci')]
ci-coverage-report: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
cd "{{ justfile_directory() }}/.."
cp backend/reports/.coverage.* .
export COVERAGE_RCFILE=backend/.coveragerc
{{ uv_run }} coverage combine
{{ uv_run }} coverage report
{{ uv_run }} coverage xml -o coverage.xml
# Check Python startup (full version)
[group('8 - ci')]
ci-check-startup-python: _check-dev
#!/usr/bin/env bash
set -euxo pipefail
{{ _load_env }}
DJANGO_SETTINGS_MODULE={{ django_settings }} {{ uv_run }} django-admin check
DJANGO_SETTINGS_MODULE={{ django_settings }} timeout --preserve-status 10s \
{{ uv_run }} gunicorn --workers=1 -b 0.0.0.0:8002 \
-k uvicorn.workers.UvicornWorker baserow.config.asgi:application
# Check Python startup (OSS only)
[group('8 - ci')]
ci-check-startup-python-oss-only: _check-dev
#!/usr/bin/env bash
set -euxo pipefail
{{ _load_env }}
BASEROW_OSS_ONLY=true DJANGO_SETTINGS_MODULE={{ django_settings }} {{ uv_run }} django-admin check
BASEROW_OSS_ONLY=true DJANGO_SETTINGS_MODULE={{ django_settings }} timeout --preserve-status 10s \
{{ uv_run }} gunicorn --workers=1 -b 0.0.0.0:8002 \
-k uvicorn.workers.UvicornWorker baserow.config.asgi:application
# =============================================================================
# Development
# =============================================================================
# Server settings
server_bind := env("SERVER_BIND", "0.0.0.0:8000")
gunicorn_workers := env("GUNICORN_WORKERS", "5")
# Run development server (Django)
[group('2 - development')]
run-dev-server *ARGS: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ uv_run }} baserow runserver {{ ARGS }} 2>&1 | tee {{ log_file }}
# Run production ASGI server (gunicorn + uvicorn)
[group('5 - production')]
run-asgi *ARGS: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ uv_run }} gunicorn -w {{ gunicorn_workers }} -b {{ server_bind }} -k uvicorn.workers.UvicornWorker baserow.config.asgi:application {{ ARGS }}
# Run production WSGI server (gunicorn)
[group('5 - production')]
run-wsgi *ARGS: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ uv_run }} gunicorn -w {{ gunicorn_workers }} -b {{ server_bind }} baserow.config.wsgi:application {{ ARGS }}
# Run production Celery worker (main queues)
[group('5 - production')]
run-celery: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ uv_run }} celery -A baserow worker -Q celery,automation_workflow -l INFO
# Run production Celery export worker
[group('5 - production')]
run-celery-export: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ uv_run }} celery -A baserow worker -Q export -l INFO
# Run production Celery beat scheduler
[group('5 - production')]
run-celery-beat: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ uv_run }} celery -A baserow beat -l INFO -S redbeat.RedBeatScheduler
# Celery settings
celery_log_level := env("CELERY_LOG_LEVEL", "INFO") # INFO default, override with CELERY_LOG_LEVEL=DEBUG
# Use 'solo' pool on macOS to avoid fork() issues causing SIGSEGV
# Options: solo (single-threaded), threads, prefork (default, problematic on macOS)
celery_pool := env("CELERY_POOL", "solo")
# Run all Celery workers and beat together for development
[group('2 - development')]
run-dev-celery: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
LOG_FILE="{{ celery_log_file }}"
# ANSI color codes
COLOR_WORKER=$'\033[38;5;39m' # Blue for worker
COLOR_EXPORT=$'\033[38;5;208m' # Orange for export
COLOR_BEAT=$'\033[38;5;129m' # Purple for beat
COLOR_RESET=$'\033[0m'
# Function to prefix output with colored process name and tee to log file
prefix_output() {
local prefix="$1"
local color="$2"
while IFS= read -r line; do
# Colored output to terminal, plain prefix to log file
echo "${color}[$prefix]${COLOR_RESET} $line"
echo "[$prefix] $line" >> "$LOG_FILE"
done
}
cleanup() {
echo ""
echo "Stopping all Celery processes..."
kill $WORKER_PID $EXPORT_PID $BEAT_PID 2>/dev/null || true
wait $WORKER_PID $EXPORT_PID $BEAT_PID 2>/dev/null || true
echo "All Celery processes stopped."
}
trap cleanup EXIT INT TERM
# Clear log file on start
> "$LOG_FILE"
echo "Starting Celery worker (celery,automation_workflow queues)..."
{{ uv_run }} celery -A baserow worker -Q celery,automation_workflow -n default-worker@%h -l {{ celery_log_level }} --pool {{ celery_pool }} 2>&1 | prefix_output "WORKER" "$COLOR_WORKER" &
WORKER_PID=$!
echo "Starting Celery export worker (export queue)..."
{{ uv_run }} celery -A baserow worker -Q export -n export-worker@%h -l {{ celery_log_level }} --pool {{ celery_pool }} 2>&1 | prefix_output "EXPORT" "$COLOR_EXPORT" &
EXPORT_PID=$!
echo "Starting Celery beat with redbeat scheduler..."
{{ uv_run }} celery -A baserow beat -l {{ celery_log_level }} -S redbeat.RedBeatScheduler 2>&1 | prefix_output "BEAT" "$COLOR_BEAT" &
BEAT_PID=$!
echo ""
echo "All Celery processes started (pool: {{ celery_pool }}). Press Ctrl+C to stop."
echo "Logs: $LOG_FILE"
echo ""
wait
# Run any command in the venv with `uv run *args`
[group('2 - development')]
run *args: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ uv_run }} {{ args }}
alias r := run
# Run Django manage.py commands (e.g., just b m createsuperuser)
[group('2 - development')]
manage *args: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ uv_run }} baserow {{ args }}
# Shortcut for manage
alias m := manage
# Run database migrations
[group('2 - development')]
migrate *args: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ uv_run }} baserow migrate {{ args }}
alias mg := migrate
[group('2 - development')]
makemigrations *args: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ uv_run }} baserow makemigrations {{ args }}
alias mk := makemigrations
# Open Django shell with shell_plus and SQL logging. Pass --print-sql to enable SQL query logging.
[group('2 - development')]
shell_plus: _check-dev
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
{{ uv_run }} baserow shell_plus
alias sp := shell_plus
# Show current environment info
[group('2 - development')]
env-info:
#!/usr/bin/env bash
set -euo pipefail
echo "=== Justfile Settings ==="
echo "Django settings: {{ django_settings }}"
echo "Venv directory: {{ venv_dir }}"
echo ""
ENV_FILE="../.env.local"
if [ -f "$ENV_FILE" ]; then
echo "=== Environment Variables (from .env.local) ==="
# Parse .env.local: skip comments, empty lines, and multi-line values
grep -v '^#' "$ENV_FILE" | grep -v '^$' | grep '=' | while IFS= read -r line; do
# Skip lines that look like continuations (start with whitespace)
if [[ ! "$line" =~ ^[[:space:]] ]]; then
# Extract variable name and value (handle values with =)
var_name="${line%%=*}"
var_value="${line#*=}"
# Truncate long values
if [ ${#var_value} -gt 60 ]; then
var_value="${var_value:0:57}..."
fi
printf "%-35s %s\n" "$var_name:" "$var_value"
fi
done
echo ""
echo "Source: .env.local"
else
echo "No .env.local found. Run 'just init' to create one."
echo ""
echo "Available env files:"
echo " .env.local - Local dev (auto-loaded by just commands)"
echo " .env.docker-dev - Docker dev (used by just dc-dev)"
echo " .env - Production Docker"
fi
# =============================================================================
# Internal helpers
# =============================================================================
# Check if dev environment is set up, install if not
_check-dev:
#!/usr/bin/env bash
if [ ! -f "{{ venv_dir }}/bin/python" ] || [ ! -f "uv.lock" ]; then
echo "Dev environment not found, running init..."
just init
fi
+169 -25
View File
@@ -1,21 +1,110 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "baserow"
authors = [{ name = "Bram Wiepjes (Baserow)", email = "bram@baserow.io" }]
#summary = "Baserow: open source no-code database backend."
description = """Baserow is an open source no-code database tool and Airtable \
alternative. Easily create a relational database without any \
technical expertise. Build a table and define custom fields \
like text, number, file and many more."""
# mixed license actually
license = { file = "LICENSE" }
requires-python = ">=3.11"
dynamic = ["version", "dependencies"]
license = { file = "../LICENSE" }
requires-python = "==3.11.*"
dynamic = ["version"]
classifiers = []
dependencies = [
"django==5.0.14",
"django-cors-headers==4.3.1",
"djangorestframework==3.15.1",
"djangorestframework-simplejwt==5.3.1",
"psycopg2-binary==2.9.10",
"Faker==25.0.1",
"Twisted==24.11.0",
"gunicorn==23.0.0",
"uvicorn[standard]==0.34.2",
"websockets==12.0",
"requests==2.32.5",
"itsdangerous==2.2.0",
"Pillow==10.4.0",
"drf-spectacular==0.28.0",
"asgiref==3.8.1",
"channels[daphne]==4.0.0",
"channels-redis==4.1.0",
"celery[redis]==5.5.3",
"django-redis==5.4.0",
"django-celery-email==3.0.0",
"advocate==1.0.0",
"zipp==3.19.1",
"unicodecsv==0.14.1",
"django-celery-beat==2.6.0",
"celery-redbeat==2.2.0",
"flower==2.0.1",
"service-identity==24.1.0",
"regex==2025.10.23",
"antlr4-python3-runtime==4.9.3",
"tqdm==4.66.4",
"boto3==1.40.40",
"django-storages==1.14.3",
"django-storages[azure]==1.14.3",
"django-storages[google]==1.14.3",
"django-health-check==3.18.2",
"psutil==5.9.8",
"dj-database-url==2.1.0",
"redis==5.2.1",
"pgvector==0.4.1",
"pysaml2==7.5.0",
"validators==0.28.1",
"requests-oauthlib==2.0.0",
"opentelemetry-api==1.37.0",
"opentelemetry-exporter-otlp-proto-http==1.37.0",
"opentelemetry-instrumentation==0.58b0",
"opentelemetry-instrumentation-django==0.58b0",
"opentelemetry-instrumentation-aiohttp-client==0.58b0",
"opentelemetry-instrumentation-asgi==0.58b0",
"opentelemetry-instrumentation-botocore==0.58b0",
"opentelemetry-instrumentation-celery==0.58b0",
"opentelemetry-instrumentation-dbapi==0.58b0",
"opentelemetry-instrumentation-grpc==0.58b0",
"opentelemetry-instrumentation-logging==0.58b0",
"opentelemetry-instrumentation-redis==0.58b0",
"opentelemetry-instrumentation-psycopg2==0.58b0",
"opentelemetry-instrumentation-psycopg==0.58b0",
"opentelemetry-instrumentation-requests==0.58b0",
"opentelemetry-instrumentation-wsgi==0.58b0",
"opentelemetry-proto==1.37.0",
"opentelemetry-sdk==1.37.0",
"opentelemetry-semantic-conventions==0.58b0",
"opentelemetry-util-http==0.58b0",
"Brotli==1.1.0",
"loguru==0.7.2",
"django-cachalot==2.6.2",
"celery-singleton==0.3.1",
"posthog==7.0.1",
"prosemirror @ https://github.com/fellowapp/prosemirror-py/archive/refs/tags/v0.3.5.zip",
"rich==13.7.1",
"tzdata==2025.2",
"sentry-sdk==2.29.1",
"typing_extensions>=4.14.1",
"ollama==0.1.9",
"langchain==0.3.27",
"langchain-openai==0.3.35",
"openai==2.2.0",
"anthropic==0.75.0",
"mistralai==1.1.0",
"icalendar==5.0.12",
"jira2markdown==0.3.7",
"openpyxl==3.1.5",
"zipstream-ng==1.8.0",
"mcp==1.9.4",
"django-cte==1.3.3",
"genson==1.3.0",
"pyotp==2.9.0",
"qrcode==8.2",
"udspy==0.1.8",
]
[project.urls]
Homepage = "https://baserow.io"
"Bug Tracker" = "https://github.com/baserow/baserow/issues/"
@@ -23,10 +112,66 @@ Documentation = "https://baserow.io/user-docs"
Support = "https://community.baserow.io/"
Changelog = "https://github.com/baserow/baserow/blob/develop/changelog.md"
[project.scripts]
baserow = "baserow.manage:main"
[dependency-groups]
dev = [
"flake8==7.0.0",
"pytest==8.2.0",
"pytest-django==4.8.0",
"pytest-env==1.1.3",
"pytest-asyncio==0.23.6",
"pytest-ordering==0.6",
"pytest-mock==3.14.0",
"pytest-icdiff==0.9",
"freezegun==1.5.0",
"responses==0.25.0",
"watchdog==4.0.0",
"argh==0.31.2",
"black==23.3.0",
"pyinstrument==4.6.2",
"pyfakefs==5.4.1",
"pytest-xdist==3.6.1",
"django-silk==5.1.0",
"django-extensions==3.2.3",
"snoop==0.4.3",
"openapi-spec-validator==0.7.2",
"pytest-html==4.1.1",
"coverage==7.5.1",
"pytest-split==0.8.2",
"bandit==1.7.8",
"autopep8==2.1.0",
"pytest-unordered==0.6.0",
"debugpy==1.8.1",
"backports.cached-property==1.0.2",
"httpretty==1.1.4",
"graphviz==0.20.3",
"pytest-cov==5.0.0",
"django-stubs==1.16.0",
"django-stubs-ext==0.8.0",
"mypy==1.10.0",
"mypy-extensions==1.0.0",
"isort==5.13.2",
"ipython",
"fakeredis[lua]==2.23.2",
"pytest-retry==1.7.0",
"pytest-testmon==2.1.3",
"ipdb",
"build",
"rust-just>=1.43.1",
]
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.version]
path = "src/baserow/version.py"
pattern = "VERSION = \"(?P<version>[^\"]+)\""
[tool.hatch.build.targets.wheel]
packages = ["src/baserow"]
[tool.black]
exclude = """
/(
@@ -34,26 +179,25 @@ exclude = """
| generated
)/
"""
# ensure consistent formatting for black
# see https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#required-version
# see https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#target-version
target-version = ["py311"]
required-version = "23"
[tool.setuptools]
include-package-data = true
# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
platforms = ["Linux"]
[tool.isort]
profile = "black"
skip = ["migrations", "generated"]
#[tool.setuptools.package-data]
#baserow.data.templates = ["*"]
[tool.uv]
package = true
environments = ["sys_platform == 'linux'", "sys_platform == 'darwin'"]
[tool.setuptools.packages.find]
namespaces = true
where = ["src/"]
include = ["baserow", "baserow.*"]
[tool.uv.workspace]
members = ["../premium/backend", "../enterprise/backend"]
[tool.setuptools.dynamic]
# version always from the code
version = { attr = "baserow.version.VERSION" }
dependencies = { file = ["deps/base.txt"] }
[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "baserow.config.settings.test"
python_files = ["test_*.py", "*_test.py"]
pythonpath = [
"tests",
"../premium/backend/tests",
"../enterprise/backend/tests",
]
-48
View File
@@ -1,48 +0,0 @@
# Readme
We use [pip-tools](https://github.com/jazzband/pip-tools) to manage our pip requirement
files.
## Base Requirements
`base.in` contains our non-dev requirements for our backend python environment and
`base.txt` is the corresponding pip requirements file generated by `pip-tools`:
```
pip-compile --output-file=base.txt base.in
```
We install the `base.txt` requirements into the [`baserow/backend`](../Dockerfile)
docker image. You can launch an environment using these images by running
`./dev.sh local restart --build`.
## Dev Requirements
`dev.in` contains our extra dev requirements on-top of `base.in`.
`dev.txt` is the corresponding pip requirements file generated by `pip-tools`:
```
pip-compile --output-file=dev.txt dev.in
```
We install the `dev.txt` requirements into the [`baserow/backend`](../Dockerfile)
docker image when built using the dev target (`docker build ... --target dev`). This
dev backend image is the one used when running `./dev.sh restart --build` etc.
## Common Operations
### Add a new base dependency
1. Add a line to `base.in` containing your new dependency
2. In the `backend lint` tab opened by running `./dev.sh --build`, or an active virtual
environment with `pip-tools` installed.
3. Ensure you are using python 3.9 if not using `./dev.sh --build`
4. `cd requirements`
5. Run `pip-compile --output-file=base.txt base.in`, review the changes to base.txt,
commit and push them to your MR.
### Add a new dev dependency
1. Add a line to `dev.in` containing your new dependency
2. In the `backend lint` tab opened by running `./dev.sh --build`, or an active virtual
environment with `pip-tools` installed.
3. Ensure you are using python 3.9 if not using `./dev.sh --build`
4. `cd requirements`
4. Run `pip-compile --output-file=dev.txt dev.in`, review the changes to dev.txt,
commit and push them to your MR.
### Upgrade an existing dependency
1. Change the version in the corresponding `.in` file.
2. Follow from step 2 above depending on which `.in` file you edited.
-91
View File
@@ -1,91 +0,0 @@
django==5.0.14
django-cors-headers==4.3.1
djangorestframework==3.15.1
djangorestframework-simplejwt==5.3.1
psycopg2==2.9.10
Faker==25.0.1
Twisted==24.11.0
gunicorn==23.0.0
uvicorn[standard]==0.34.2
websockets==12.0
requests==2.32.5
itsdangerous==2.2.0
Pillow==10.3.0
drf-spectacular==0.28.0
asgiref==3.8.1
channels[daphne]==4.0.0
channels-redis==4.1.0
celery[redis]==5.5.3
django-redis==5.4.0
django-celery-email==3.0.0
advocate==1.0.0
zipp==3.19.1
unicodecsv==0.14.1
django-celery-beat==2.6.0
celery-redbeat==2.2.0
flower==2.0.1
service-identity==24.1.0
regex==2025.10.23
antlr4-python3-runtime==4.9.3
tqdm==4.66.4
boto3==1.40.40
django-storages==1.14.3
django-storages[azure]==1.14.3
django-storages[google]==1.14.3
django-health-check==3.18.2
psutil==5.9.8
dj-database-url==2.1.0
redis==5.2.1
pgvector==0.4.1
pysaml2==7.5.0
validators==0.28.1
requests-oauthlib==2.0.0
opentelemetry-api==1.37.0
opentelemetry-exporter-otlp-proto-http==1.37.0
opentelemetry-instrumentation==0.58b0
opentelemetry-instrumentation-django==0.58b0
opentelemetry-instrumentation-aiohttp-client==0.58b0
opentelemetry-instrumentation-asgi==0.58b0
opentelemetry-instrumentation-botocore==0.58b0
opentelemetry-instrumentation-celery==0.58b0
opentelemetry-instrumentation-dbapi==0.58b0
opentelemetry-instrumentation-grpc==0.58b0
opentelemetry-instrumentation-logging==0.58b0
opentelemetry-instrumentation-redis==0.58b0
opentelemetry-instrumentation-psycopg2==0.58b0
opentelemetry-instrumentation-psycopg==0.58b0
opentelemetry-instrumentation-requests==0.58b0
opentelemetry-instrumentation-wsgi==0.58b0
opentelemetry-proto==1.37.0
opentelemetry-sdk==1.37.0
opentelemetry-semantic-conventions==0.58b0
opentelemetry-util-http==0.58b0
Brotli==1.1.0
loguru==0.7.2
django-cachalot==2.6.2
celery-singleton==0.3.1
posthog==7.0.1
https://github.com/fellowapp/prosemirror-py/archive/refs/tags/v0.3.5.zip
rich==13.7.1
tzdata==2025.2
sentry-sdk==2.29.1
typing_extensions==4.11.0
ollama==0.1.9
langchain==0.3.27
langchain-openai==0.3.35
openai==2.2.0
anthropic==0.37.1
mistralai==1.1.0
icalendar==5.0.12
jira2markdown==0.3.7
openpyxl==3.1.5
zipstream-ng==1.8.0
mcp==1.9.4
django-cte==1.3.3
tornado==6.5.0 # Pinned to address vulnerability.
certifi==2025.4.26 # Pinned to address vulnerability.
httpcore==1.0.9 # Pinned to address vulnerability.
genson==1.3.0
pyotp==2.9.0
qrcode==8.2
udspy==0.1.8
-736
View File
@@ -1,736 +0,0 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=base.txt base.in
#
advocate==1.0.0
# via -r base.in
amqp==5.3.1
# via kombu
annotated-types==0.7.0
# via pydantic
anthropic==0.37.1
# via -r base.in
antlr4-python3-runtime==4.9.3
# via -r base.in
anyio==4.8.0
# via
# anthropic
# httpx
# mcp
# openai
# sse-starlette
# starlette
# watchfiles
asgiref==3.8.1
# via
# -r base.in
# channels
# channels-redis
# daphne
# django
# django-cors-headers
# opentelemetry-instrumentation-asgi
async-timeout==5.0.1
# via redis
attrs==24.3.0
# via
# jsonschema
# referencing
# service-identity
# twisted
autobahn==24.4.2
# via daphne
automat==24.8.1
# via twisted
azure-core==1.32.0
# via
# azure-storage-blob
# django-storages
azure-storage-blob==12.24.0
# via django-storages
backoff==2.2.1
# via posthog
billiard==4.2.1
# via celery
boto3==1.40.40
# via -r base.in
botocore==1.40.40
# via
# boto3
# s3transfer
brotli==1.1.0
# via -r base.in
cachetools==5.5.0
# via google-auth
celery[redis]==5.5.3
# via
# -r base.in
# celery-redbeat
# celery-singleton
# django-celery-beat
# django-celery-email
# flower
celery-redbeat==2.2.0
# via -r base.in
celery-singleton==0.3.1
# via -r base.in
certifi==2025.4.26
# via
# -r base.in
# httpcore
# httpx
# requests
# sentry-sdk
cffi==1.17.1
# via cryptography
channels[daphne]==4.0.0
# via
# -r base.in
# channels-redis
channels-redis==4.1.0
# via -r base.in
charset-normalizer==3.4.1
# via requests
click==8.1.8
# via
# celery
# click-didyoumean
# click-plugins
# click-repl
# uvicorn
click-didyoumean==0.3.1
# via celery
click-plugins==1.1.1
# via celery
click-repl==0.3.0
# via celery
constantly==23.10.4
# via twisted
cron-descriptor==1.4.5
# via django-celery-beat
cryptography==44.0.0
# via
# autobahn
# azure-storage-blob
# pyopenssl
# pysaml2
# service-identity
daphne==4.1.2
# via channels
defusedxml==0.7.1
# via pysaml2
distro==1.9.0
# via
# anthropic
# openai
# posthog
dj-database-url==2.1.0
# via -r base.in
django==5.0.14
# via
# -r base.in
# channels
# dj-database-url
# django-appconf
# django-cachalot
# django-celery-beat
# django-celery-email
# django-cors-headers
# django-health-check
# django-redis
# django-storages
# django-timezone-field
# djangorestframework
# djangorestframework-simplejwt
# drf-spectacular
django-appconf==1.0.6
# via django-celery-email
django-cachalot==2.6.2
# via -r base.in
django-celery-beat==2.6.0
# via -r base.in
django-celery-email==3.0.0
# via -r base.in
django-cors-headers==4.3.1
# via -r base.in
django-cte==1.3.3
# via -r base.in
django-health-check==3.18.2
# via -r base.in
django-redis==5.4.0
# via -r base.in
django-storages[azure,google]==1.14.3
# via -r base.in
django-timezone-field==7.0
# via django-celery-beat
djangorestframework==3.15.1
# via
# -r base.in
# djangorestframework-simplejwt
# drf-spectacular
djangorestframework-simplejwt==5.3.1
# via -r base.in
drf-spectacular==0.28.0
# via -r base.in
elementpath==4.7.0
# via xmlschema
et-xmlfile==2.0.0
# via openpyxl
eval-type-backport==0.2.2
# via mistralai
faker==25.0.1
# via -r base.in
filelock==3.16.1
# via huggingface-hub
flower==2.0.1
# via -r base.in
fsspec==2024.12.0
# via huggingface-hub
genson==1.3.0
# via -r base.in
google-api-core==2.24.0
# via
# google-cloud-core
# google-cloud-storage
google-auth==2.37.0
# via
# google-api-core
# google-cloud-core
# google-cloud-storage
google-cloud-core==2.4.1
# via google-cloud-storage
google-cloud-storage==2.19.0
# via django-storages
google-crc32c==1.6.0
# via
# google-cloud-storage
# google-resumable-media
google-resumable-media==2.7.2
# via google-cloud-storage
googleapis-common-protos==1.66.0
# via
# google-api-core
# opentelemetry-exporter-otlp-proto-http
greenlet==3.2.4
# via sqlalchemy
gunicorn==23.0.0
# via -r base.in
h11==0.16.0
# via
# httpcore
# uvicorn
httpcore==1.0.9
# via
# -r base.in
# httpx
httptools==0.6.4
# via uvicorn
httpx==0.27.2
# via
# anthropic
# langsmith
# mcp
# mistralai
# ollama
# openai
httpx-sse==0.4.0
# via mcp
huggingface-hub==0.27.1
# via tokenizers
humanize==4.11.0
# via flower
hyperlink==21.0.0
# via
# autobahn
# twisted
icalendar==5.0.12
# via -r base.in
idna==3.10
# via
# anyio
# httpx
# hyperlink
# requests
# twisted
importlib-metadata==8.4.0
# via opentelemetry-api
incremental==24.7.2
# via twisted
inflection==0.5.1
# via drf-spectacular
isodate==0.7.2
# via azure-storage-blob
itsdangerous==2.2.0
# via -r base.in
jira2markdown==0.3.7
# via -r base.in
jiter==0.11.1
# via
# anthropic
# openai
# udspy
jmespath==1.0.1
# via
# boto3
# botocore
jsonpatch==1.33
# via langchain-core
jsonpath-python==1.0.6
# via mistralai
jsonpointer==3.0.0
# via jsonpatch
jsonschema==4.25.0
# via drf-spectacular
jsonschema-specifications==2025.4.1
# via jsonschema
kombu[redis]==5.5.4
# via celery
langchain==0.3.27
# via -r base.in
langchain-core==0.3.78
# via
# langchain
# langchain-openai
# langchain-text-splitters
langchain-openai==0.3.35
# via -r base.in
langchain-text-splitters==0.3.9
# via langchain
langsmith==0.4.10
# via
# langchain
# langchain-core
loguru==0.7.2
# via -r base.in
markdown-it-py==3.0.0
# via rich
mcp==1.9.4
# via -r base.in
mdurl==0.1.2
# via markdown-it-py
mistralai==1.1.0
# via -r base.in
msgpack==1.1.0
# via channels-redis
mypy-extensions==1.0.0
# via typing-inspect
ndg-httpsclient==0.5.1
# via advocate
netifaces==0.11.0
# via advocate
numpy==2.3.3
# via pgvector
oauthlib==3.2.2
# via requests-oauthlib
ollama==0.1.9
# via -r base.in
openai==2.2.0
# via
# -r base.in
# langchain-openai
# udspy
openpyxl==3.1.5
# via -r base.in
opentelemetry-api==1.37.0
# via
# -r base.in
# opentelemetry-exporter-otlp-proto-http
# opentelemetry-instrumentation
# opentelemetry-instrumentation-aiohttp-client
# opentelemetry-instrumentation-asgi
# opentelemetry-instrumentation-botocore
# opentelemetry-instrumentation-celery
# opentelemetry-instrumentation-dbapi
# opentelemetry-instrumentation-django
# opentelemetry-instrumentation-grpc
# opentelemetry-instrumentation-logging
# opentelemetry-instrumentation-psycopg
# opentelemetry-instrumentation-psycopg2
# opentelemetry-instrumentation-redis
# opentelemetry-instrumentation-requests
# opentelemetry-instrumentation-wsgi
# opentelemetry-propagator-aws-xray
# opentelemetry-sdk
# opentelemetry-semantic-conventions
opentelemetry-exporter-otlp-proto-common==1.37.0
# via opentelemetry-exporter-otlp-proto-http
opentelemetry-exporter-otlp-proto-http==1.37.0
# via -r base.in
opentelemetry-instrumentation==0.58b0
# via
# -r base.in
# opentelemetry-instrumentation-aiohttp-client
# opentelemetry-instrumentation-asgi
# opentelemetry-instrumentation-botocore
# opentelemetry-instrumentation-celery
# opentelemetry-instrumentation-dbapi
# opentelemetry-instrumentation-django
# opentelemetry-instrumentation-grpc
# opentelemetry-instrumentation-logging
# opentelemetry-instrumentation-psycopg
# opentelemetry-instrumentation-psycopg2
# opentelemetry-instrumentation-redis
# opentelemetry-instrumentation-requests
# opentelemetry-instrumentation-wsgi
opentelemetry-instrumentation-aiohttp-client==0.58b0
# via -r base.in
opentelemetry-instrumentation-asgi==0.58b0
# via -r base.in
opentelemetry-instrumentation-botocore==0.58b0
# via -r base.in
opentelemetry-instrumentation-celery==0.58b0
# via -r base.in
opentelemetry-instrumentation-dbapi==0.58b0
# via
# -r base.in
# opentelemetry-instrumentation-psycopg
# opentelemetry-instrumentation-psycopg2
opentelemetry-instrumentation-django==0.58b0
# via -r base.in
opentelemetry-instrumentation-grpc==0.58b0
# via -r base.in
opentelemetry-instrumentation-logging==0.58b0
# via -r base.in
opentelemetry-instrumentation-psycopg==0.58b0
# via -r base.in
opentelemetry-instrumentation-psycopg2==0.58b0
# via -r base.in
opentelemetry-instrumentation-redis==0.58b0
# via -r base.in
opentelemetry-instrumentation-requests==0.58b0
# via -r base.in
opentelemetry-instrumentation-wsgi==0.58b0
# via
# -r base.in
# opentelemetry-instrumentation-django
opentelemetry-propagator-aws-xray==1.0.2
# via opentelemetry-instrumentation-botocore
opentelemetry-proto==1.37.0
# via
# -r base.in
# opentelemetry-exporter-otlp-proto-common
# opentelemetry-exporter-otlp-proto-http
opentelemetry-sdk==1.37.0
# via
# -r base.in
# opentelemetry-exporter-otlp-proto-http
opentelemetry-semantic-conventions==0.58b0
# via
# -r base.in
# opentelemetry-instrumentation
# opentelemetry-instrumentation-aiohttp-client
# opentelemetry-instrumentation-asgi
# opentelemetry-instrumentation-botocore
# opentelemetry-instrumentation-celery
# opentelemetry-instrumentation-dbapi
# opentelemetry-instrumentation-django
# opentelemetry-instrumentation-grpc
# opentelemetry-instrumentation-redis
# opentelemetry-instrumentation-requests
# opentelemetry-instrumentation-wsgi
# opentelemetry-sdk
opentelemetry-util-http==0.58b0
# via
# -r base.in
# opentelemetry-instrumentation-aiohttp-client
# opentelemetry-instrumentation-asgi
# opentelemetry-instrumentation-django
# opentelemetry-instrumentation-requests
# opentelemetry-instrumentation-wsgi
orjson==3.10.13
# via langsmith
packaging==23.2
# via
# gunicorn
# huggingface-hub
# kombu
# langchain-core
# langsmith
# opentelemetry-instrumentation
pgvector==0.4.1
# via -r base.in
pillow==10.3.0
# via -r base.in
posthog==7.0.1
# via -r base.in
prometheus-client==0.21.1
# via flower
prompt-toolkit==3.0.48
# via click-repl
prosemirror @ https://github.com/fellowapp/prosemirror-py/archive/refs/tags/v0.3.5.zip
# via -r base.in
proto-plus==1.25.0
# via google-api-core
protobuf==5.29.5
# via
# google-api-core
# googleapis-common-protos
# opentelemetry-proto
# proto-plus
psutil==5.9.8
# via -r base.in
psycopg2==2.9.10
# via -r base.in
pyasn1==0.6.1
# via
# advocate
# ndg-httpsclient
# pyasn1-modules
# rsa
# service-identity
pyasn1-modules==0.4.1
# via
# google-auth
# service-identity
pycparser==2.22
# via cffi
pydantic==2.9.2
# via
# anthropic
# langchain
# langchain-core
# langsmith
# mcp
# mistralai
# openai
# pydantic-settings
# udspy
pydantic-core==2.23.4
# via pydantic
pydantic-settings==2.8.1
# via mcp
pygments==2.19.1
# via rich
pyjwt==2.10.1
# via djangorestframework-simplejwt
pyopenssl==24.3.0
# via
# advocate
# ndg-httpsclient
# pysaml2
# twisted
pyotp==2.9.0
# via -r base.in
pyparsing==3.2.1
# via jira2markdown
pysaml2==7.5.0
# via -r base.in
python-crontab==3.2.0
# via django-celery-beat
python-dateutil==2.8.2
# via
# botocore
# celery
# celery-redbeat
# faker
# icalendar
# mistralai
# posthog
# pysaml2
# python-crontab
python-dotenv==1.0.1
# via
# pydantic-settings
# uvicorn
python-multipart==0.0.20
# via mcp
pytz==2024.2
# via
# flower
# icalendar
# pysaml2
pyyaml==6.0.2
# via
# drf-spectacular
# huggingface-hub
# langchain
# langchain-core
# uvicorn
qrcode==8.2
# via -r base.in
redis==5.2.1
# via
# -r base.in
# celery-redbeat
# celery-singleton
# channels-redis
# django-redis
# kombu
referencing==0.36.2
# via
# jsonschema
# jsonschema-specifications
regex==2025.10.23
# via
# -r base.in
# tiktoken
# udspy
requests==2.32.5
# via
# -r base.in
# advocate
# azure-core
# google-api-core
# google-cloud-storage
# huggingface-hub
# langchain
# langsmith
# opentelemetry-exporter-otlp-proto-http
# posthog
# pysaml2
# requests-oauthlib
# requests-toolbelt
# tiktoken
requests-oauthlib==2.0.0
# via -r base.in
requests-toolbelt==1.0.0
# via langsmith
rich==13.7.1
# via -r base.in
rpds-py==0.26.0
# via
# jsonschema
# referencing
rsa==4.9
# via google-auth
s3transfer==0.14.0
# via boto3
sentry-sdk==2.29.1
# via -r base.in
service-identity==24.1.0
# via
# -r base.in
# twisted
six==1.17.0
# via
# advocate
# azure-core
# posthog
# python-dateutil
sniffio==1.3.1
# via
# anthropic
# anyio
# httpx
# openai
sqlalchemy==2.0.36
# via langchain
sqlparse==0.5.3
# via django
sse-starlette==2.2.1
# via mcp
starlette==0.46.1
# via
# mcp
# sse-starlette
tenacity==8.5.0
# via
# celery-redbeat
# langchain-core
# udspy
tiktoken==0.9.0
# via langchain-openai
tokenizers==0.21.0
# via anthropic
tornado==6.5
# via
# -r base.in
# flower
tqdm==4.66.4
# via
# -r base.in
# huggingface-hub
# openai
twisted[tls]==24.11.0
# via
# -r base.in
# daphne
txaio==23.1.1
# via autobahn
typing-extensions==4.11.0
# via
# -r base.in
# anthropic
# anyio
# azure-core
# azure-storage-blob
# dj-database-url
# huggingface-hub
# langchain-core
# openai
# opentelemetry-api
# opentelemetry-exporter-otlp-proto-http
# opentelemetry-sdk
# opentelemetry-semantic-conventions
# posthog
# prosemirror
# pydantic
# pydantic-core
# referencing
# sqlalchemy
# twisted
# typing-inspect
typing-inspect==0.9.0
# via mistralai
tzdata==2025.2
# via
# -r base.in
# django-celery-beat
# kombu
udspy==0.1.8
# via -r base.in
unicodecsv==0.14.1
# via -r base.in
uritemplate==4.1.1
# via drf-spectacular
urllib3==1.26.20
# via
# advocate
# botocore
# requests
# sentry-sdk
uvicorn[standard]==0.34.2
# via
# -r base.in
# mcp
uvloop==0.21.0
# via uvicorn
validators==0.28.1
# via -r base.in
vine==5.1.0
# via
# amqp
# celery
# kombu
watchfiles==1.0.3
# via uvicorn
wcwidth==0.2.13
# via prompt-toolkit
websockets==12.0
# via
# -r base.in
# uvicorn
wrapt==1.17.0
# via
# opentelemetry-instrumentation
# opentelemetry-instrumentation-aiohttp-client
# opentelemetry-instrumentation-dbapi
# opentelemetry-instrumentation-grpc
# opentelemetry-instrumentation-redis
xmlschema==2.5.1
# via pysaml2
zipp==3.19.1
# via
# -r base.in
# importlib-metadata
zipstream-ng==1.8.0
# via -r base.in
zope-interface==7.2
# via twisted
zstandard==0.23.0
# via langsmith
# The following packages are considered to be unsafe in a requirements file:
# setuptools
-47
View File
@@ -1,47 +0,0 @@
-c base.txt
flake8==7.0.0
pytest==8.2.0
pytest-django==4.8.0
pytest-env==1.1.3
pytest-asyncio==0.23.6
pytest-ordering==0.6
pytest-mock==3.14.0
pytest-icdiff==0.9
freezegun==1.5.0
responses==0.25.0
watchdog==4.0.0
argh==0.31.2
black==23.3.0
pyinstrument==4.6.2
pyfakefs==5.4.1
pytest-xdist==3.6.1
django-silk==5.1.0
django-extensions==3.2.3
snoop==0.4.3
openapi-spec-validator==0.7.2
pytest-html==4.1.1
coverage==7.5.1
pytest-split==0.8.2
bandit==1.7.8
pip-tools==7.5.2
autopep8==2.1.0
pytest-unordered==0.6.0
debugpy==1.8.1
backports.cached-property==1.0.2
httpretty==1.1.4
graphviz==0.20.3
pytest-cov==5.0.0
django-stubs==1.16.0
django-stubs-ext==0.8.0
# ignored for now because of version conflict
# djangorestframework-stubs==1.10.0
mypy==1.10.0
mypy-extensions==1.0.0
isort==5.13.2
ipython
fakeredis[lua]==2.23.2
pytest-retry==1.7.0
pytest-testmon==2.1.3
ipdb
# build is used to compile a wheel package with `python -m build .` command.
build
-353
View File
@@ -1,353 +0,0 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=dev.txt dev.in
#
argh==0.31.2
# via -r dev.in
asgiref==3.8.1
# via
# -c base.txt
# django
asttokens==3.0.0
# via
# snoop
# stack-data
async-timeout==5.0.1
# via
# -c base.txt
# redis
attrs==24.3.0
# via
# -c base.txt
# jsonschema
# referencing
autopep8==2.1.0
# via
# -r dev.in
# django-silk
backports-cached-property==1.0.2
# via -r dev.in
bandit==1.7.8
# via -r dev.in
black==23.3.0
# via -r dev.in
build==1.2.2.post1
# via
# -r dev.in
# pip-tools
certifi==2025.4.26
# via
# -c base.txt
# requests
charset-normalizer==3.4.1
# via
# -c base.txt
# requests
cheap-repr==0.5.2
# via snoop
click==8.1.8
# via
# -c base.txt
# black
# pip-tools
coverage[toml]==7.5.1
# via
# -r dev.in
# pytest-cov
# pytest-testmon
debugpy==1.8.1
# via -r dev.in
decorator==5.1.1
# via
# ipdb
# ipython
django==5.0.14
# via
# -c base.txt
# django-extensions
# django-silk
# django-stubs
# django-stubs-ext
django-extensions==3.2.3
# via -r dev.in
django-silk==5.1.0
# via -r dev.in
django-stubs==1.16.0
# via -r dev.in
django-stubs-ext==0.8.0
# via
# -r dev.in
# django-stubs
execnet==2.1.1
# via pytest-xdist
executing==2.1.0
# via
# snoop
# stack-data
fakeredis[lua]==2.23.2
# via -r dev.in
flake8==7.0.0
# via -r dev.in
freezegun==1.5.0
# via -r dev.in
gprof2dot==2024.6.6
# via django-silk
graphviz==0.20.3
# via -r dev.in
httpretty==1.1.4
# via -r dev.in
icdiff==2.0.7
# via pytest-icdiff
idna==3.10
# via
# -c base.txt
# requests
iniconfig==2.0.0
# via pytest
ipdb==0.13.13
# via -r dev.in
ipython==8.31.0
# via
# -r dev.in
# ipdb
isort==5.13.2
# via -r dev.in
jedi==0.19.2
# via ipython
jinja2==3.1.6
# via pytest-html
jsonschema==4.25.0
# via
# -c base.txt
# openapi-schema-validator
# openapi-spec-validator
jsonschema-path==0.3.4
# via openapi-spec-validator
jsonschema-specifications==2025.4.1
# via
# -c base.txt
# jsonschema
# openapi-schema-validator
lazy-object-proxy==1.10.0
# via openapi-spec-validator
lupa==2.2
# via fakeredis
markdown-it-py==3.0.0
# via
# -c base.txt
# rich
markupsafe==3.0.3
# via jinja2
matplotlib-inline==0.1.7
# via ipython
mccabe==0.7.0
# via flake8
mdurl==0.1.2
# via
# -c base.txt
# markdown-it-py
mypy==1.10.0
# via
# -r dev.in
# django-stubs
mypy-extensions==1.0.0
# via
# -c base.txt
# -r dev.in
# black
# mypy
openapi-schema-validator==0.6.3
# via openapi-spec-validator
openapi-spec-validator==0.7.2
# via -r dev.in
packaging==23.2
# via
# -c base.txt
# black
# build
# pytest
parso==0.8.4
# via jedi
pathable==0.4.3
# via jsonschema-path
pathspec==0.12.1
# via black
pbr==6.1.0
# via stevedore
pexpect==4.9.0
# via ipython
pip-tools==7.5.2
# via -r dev.in
platformdirs==4.3.6
# via black
pluggy==1.5.0
# via pytest
pprintpp==0.4.0
# via pytest-icdiff
prompt-toolkit==3.0.48
# via
# -c base.txt
# ipython
ptyprocess==0.7.0
# via pexpect
pure-eval==0.2.3
# via stack-data
pycodestyle==2.11.1
# via
# autopep8
# flake8
pyfakefs==5.4.1
# via -r dev.in
pyflakes==3.2.0
# via flake8
pygments==2.19.1
# via
# -c base.txt
# ipython
# rich
# snoop
pyinstrument==4.6.2
# via -r dev.in
pyproject-hooks==1.2.0
# via
# build
# pip-tools
pytest==8.2.0
# via
# -r dev.in
# pytest-asyncio
# pytest-cov
# pytest-django
# pytest-env
# pytest-html
# pytest-icdiff
# pytest-metadata
# pytest-mock
# pytest-ordering
# pytest-retry
# pytest-split
# pytest-testmon
# pytest-unordered
# pytest-xdist
pytest-asyncio==0.23.6
# via -r dev.in
pytest-cov==5.0.0
# via -r dev.in
pytest-django==4.8.0
# via -r dev.in
pytest-env==1.1.3
# via -r dev.in
pytest-html==4.1.1
# via -r dev.in
pytest-icdiff==0.9
# via -r dev.in
pytest-metadata==3.1.1
# via pytest-html
pytest-mock==3.14.0
# via -r dev.in
pytest-ordering==0.6
# via -r dev.in
pytest-retry==1.7.0
# via -r dev.in
pytest-split==0.8.2
# via -r dev.in
pytest-testmon==2.1.3
# via -r dev.in
pytest-unordered==0.6.0
# via -r dev.in
pytest-xdist==3.6.1
# via -r dev.in
python-dateutil==2.8.2
# via
# -c base.txt
# freezegun
pyyaml==6.0.2
# via
# -c base.txt
# bandit
# jsonschema-path
# responses
redis==5.2.1
# via
# -c base.txt
# fakeredis
referencing==0.36.2
# via
# -c base.txt
# jsonschema
# jsonschema-path
# jsonschema-specifications
requests==2.32.5
# via
# -c base.txt
# jsonschema-path
# responses
responses==0.25.0
# via -r dev.in
rfc3339-validator==0.1.4
# via openapi-schema-validator
rich==13.7.1
# via
# -c base.txt
# bandit
rpds-py==0.26.0
# via
# -c base.txt
# jsonschema
# referencing
six==1.17.0
# via
# -c base.txt
# python-dateutil
# rfc3339-validator
# snoop
snoop==0.4.3
# via -r dev.in
sortedcontainers==2.4.0
# via fakeredis
sqlparse==0.5.3
# via
# -c base.txt
# django
# django-silk
stack-data==0.6.3
# via ipython
stevedore==5.4.0
# via bandit
tomli==2.2.1
# via django-stubs
traitlets==5.14.3
# via
# ipython
# matplotlib-inline
types-pytz==2024.2.0.20241221
# via django-stubs
types-pyyaml==6.0.12.20241230
# via django-stubs
typing-extensions==4.11.0
# via
# -c base.txt
# django-stubs
# django-stubs-ext
# ipython
# mypy
# referencing
urllib3==1.26.20
# via
# -c base.txt
# requests
# responses
watchdog==4.0.0
# via -r dev.in
wcwidth==0.2.13
# via
# -c base.txt
# prompt-toolkit
wheel==0.45.1
# via pip-tools
# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
+32 -10
View File
@@ -8,23 +8,44 @@ from fakeredis import FakeConnection, FakeServer
from baserow.config.settings.utils import str_to_bool
# Create a .env.testing file in the backend directory to store different test settings and
# override the default ones. For different test settings, provide the TEST_ENV_FILE
# environment variable with the name of the file to use. Everything that starts with
# .env.testing will be ignored by git.
# Test environment configuration:
# - TEST_ENV_FILE: Optional env file for test settings (default: none)
# - DATABASE_*, REDIS_*, and MEDIA_ROOT vars can be passed via real env vars or TEST_ENV_FILE
# - All other settings are hardcoded in this file for consistency
#
# Example: DATABASE_URL=postgres://... just b test
# Example: TEST_ENV_FILE=.env.testing-local just b test
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TEST_ENV_FILE = os.getenv("TEST_ENV_FILE", ".env.testing")
TEST_ENV_VARS = dotenv_values(os.path.join(BASE_DIR, f"../../../{TEST_ENV_FILE}"))
# Load optional test env file
TEST_ENV_FILE = os.environ.get("TEST_ENV_FILE", "")
if TEST_ENV_FILE:
TEST_ENV_VARS = dotenv_values(os.path.join(BASE_DIR, f"../../../{TEST_ENV_FILE}"))
else:
TEST_ENV_VARS = {}
# Prefixes for vars that can be overridden via env vars (for DB/Redis configuration)
ALLOWED_ENV_PREFIXES = ("DATABASE_",)
def getenv_for_tests(key: str, default: str = "") -> str:
return TEST_ENV_VARS.get(key, default)
"""
Get env var for tests:
- DATABASE_* vars: check real env first, then TEST_ENV_FILE, then default
- Other vars: only use TEST_ENV_FILE or default (never real env)
"""
if key.startswith(ALLOWED_ENV_PREFIXES):
# Allow real env vars for database and redis configuration
return os.environ.get(key, TEST_ENV_VARS.get(key, default))
else:
# Block real env vars for other settings to ensure test consistency
return TEST_ENV_VARS.get(key, default)
with patch("os.getenv", getenv_for_tests) as load_dotenv:
# Avoid loading .env settings to prevent conflicts with the test settings,
# but allow custom settings to be loaded from the .env.test file in the
# backend root directory.
# Import base settings with patched os.getenv to control which env vars are used
from .base import * # noqa: F403, F401
TESTS = True
@@ -58,6 +79,7 @@ USER_THUMBNAILS = {"tiny": [21, 21]}
# Make sure that we are not using the `MEDIA_URL` environment variable because that
# could break the tests. They are expecting it to be 'http://localhost:8000/media/'
# because that is default value in `base.py`.
MEDIA_ROOT = "/tmp/media-test/" # nosec
MEDIA_URL = "http://localhost:8000/media/"
@@ -1224,7 +1224,7 @@ def test_delete_rows_action_row_history_with_undo_redo(
)
assert undone
history_entries = RowHistory.objects.order_by("row_id").values(
history_entries = RowHistory.objects.order_by("row_id", "id").values(
"user_id",
"user_name",
"table_id",
@@ -1272,7 +1272,7 @@ def test_delete_rows_action_row_history_with_undo_redo(
)
assert redone
history_entries = RowHistory.objects.order_by("row_id").values(
history_entries = RowHistory.objects.order_by("row_id", "id").values(
"user_id",
"user_name",
"table_id",
+4137
View File
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,9 @@
{
"type": "refactor",
"message": "Replace dev.sh and makefile with justfiles. Use uv to manage python in the backend.",
"issue_origin": "github",
"issue_number": null,
"domain": "core",
"bullet_points": [],
"created_at": "2025-12-11"
}
-1
View File
@@ -1,3 +1,2 @@
TEST_ENV_FILE=.env.testing-local
PYTHONPATH=backend/src:premium/backend/src:enterprise/backend/src:backend/flake8_plugins:$PYTHONPATH
DJANGO_SETTINGS_MODULE=baserow.config.settings.test
+210 -104
View File
@@ -1,133 +1,239 @@
ARG FROM_BACKEND_IMAGE=baserow_backend
ARG FROM_WEBFRONTEND_IMAGE=baserow_web-frontend
# This is pinned as version pinning is done by the CI setting FROM_IMAGE.
# syntax=docker/dockerfile:1.4
ARG UID="9999"
ARG GID="9999"
ARG BACKEND_IMAGE=baserow_backend
ARG WEBFRONTEND_IMAGE=baserow_web-frontend
# hadolint ignore=DL3006
FROM $FROM_BACKEND_IMAGE AS backend_image_base
FROM ${BACKEND_IMAGE}:latest AS backend_image
# hadolint ignore=DL3006
FROM $FROM_WEBFRONTEND_IMAGE AS web_frontend_image_base
FROM debian:bookworm-slim AS base
FROM ${BACKEND_IMAGE}:dev AS backend_image_dev
# hadolint ignore=DL3006
FROM ${WEBFRONTEND_IMAGE}:latest AS web_frontend_image
# hadolint ignore=DL3006
FROM ${WEBFRONTEND_IMAGE}:dev AS web_frontend_image_dev
# =============================================================================
# Base - system dependencies (cached independently of source images)
# =============================================================================
FROM python:3.11-slim-bookworm AS base
ARG UID
ARG GID
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG UID
ENV UID=${UID:-9999}
ARG GID
ENV GID=${GID:-9999}
ARG DOCKER_USER
ENV DOCKER_USER=${DOCKER_USER:-baserow_docker_user}
ENV DOCKER_USER=baserow_docker_user \
BASEROW_IMAGE_TYPE="all-in-one" \
DATA_DIR=/baserow/data \
POSTGRES_VERSION=15 \
POSTGRES_LOCATION=/etc/postgresql/15/main \
BASEROW_PLUGIN_DIR=/baserow/data/plugins \
UV_PROJECT_ENVIRONMENT=/baserow/venv \
PATH="/baserow/venv/bin:$PATH" \
PYTHONUNBUFFERED=1
ENV DATA_DIR=/baserow/data
ENV BASEROW_PLUGIN_DIR=$DATA_DIR/plugins
ENV POSTGRES_VERSION=15
ENV NODE_MAJOR=24
ENV POSTGRES_LOCATION=/etc/postgresql/15/main
ENV BASEROW_IMAGE_TYPE="all-in-one"
# Caddy checksums for v2.7.6
ENV CADDY_VERSION=2.7.6 \
CADDY_SHA256_AMD64=99587cf77c595f0bf62cc23c9ea101f9879fa016c7b689d498ce054904821f22 \
CADDY_SHA256_ARM64=6e6aeca09502a8f0ab0a08acd03bb765e80888052d108de22e0698a9160b7235
# ========================
# = APT-GET UPDATE/UPGRADE/INSTALL DEPS + NODE + CADDY
# ========================
# hadolint ignore=DL3013
RUN apt-get update && \
# Runtime dependencies
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install --no-install-recommends -y \
make supervisor curl gnupg2 \
supervisor curl gnupg2 ca-certificates \
psmisc \
gawk \
postgresql-client-${POSTGRES_VERSION} \
xmlsec1 \
gettext \
&& \
# Install Caddy with checksum verification
ARCH=$(dpkg --print-architecture) && \
curl -o caddy.tar.gz -sL "https://github.com/caddyserver/caddy/releases/download/v${CADDY_VERSION}/caddy_${CADDY_VERSION}_linux_${ARCH}.tar.gz" && \
if [ "$ARCH" = "amd64" ]; then echo "${CADDY_SHA256_AMD64} caddy.tar.gz" | sha256sum -c -; \
elif [ "$ARCH" = "arm64" ]; then echo "${CADDY_SHA256_ARM64} caddy.tar.gz" | sha256sum -c -; \
else echo "Unsupported architecture: $ARCH" && exit 1; fi && \
tar -xf caddy.tar.gz && mv caddy /usr/bin/ && rm caddy.tar.gz && \
# Setup user and group with fixed UID/GID for volume permission consistency
getent group $GID || groupadd --system --gid $GID ${DOCKER_USER} && \
useradd --shell /bin/bash -l -u $UID -g $GID -o -c "" -d /baserow -m ${DOCKER_USER} && \
# Setup supervisor
ln -sf /dev/stdout /var/log/supervisor/supervisord.log && \
# Create data and plugin directories with correct ownership
mkdir -p ${DATA_DIR} ${BASEROW_PLUGIN_DIR} && \
chown -R $UID:$GID ${DATA_DIR} ${BASEROW_PLUGIN_DIR}
# Copy Node.js, npm, and yarn from web-frontend image (avoids insecure curl|bash from NodeSource)
COPY --from=web_frontend_image /usr/local/bin/node /usr/local/bin/node
COPY --link --from=web_frontend_image /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --link --from=web_frontend_image /opt/yarn-v1.22.22 /opt/yarn-v1.22.22
RUN ln -s /opt/yarn-v1.22.22/bin/yarn /usr/local/bin/yarn
# Copy su-exec from backend image (already built with pinned version + SHA256 verification)
COPY --link --from=backend_image /usr/local/bin/su-exec /usr/local/bin/su-exec
COPY --link --from=backend_image /usr/bin/tini /usr/bin/tini
# =============================================================================
# Development - adds dev tools, backend dev venv, and frontend dev deps
# =============================================================================
FROM base AS dev
ARG UID
ARG GID
# Install uv and dev tools
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
ENV PYTHONPATH="/baserow/backend/src:/baserow/premium/backend/src:/baserow/enterprise/backend/src:/baserow/backend/tests:/baserow/premium/backend/tests:/baserow/enterprise/backend/tests" \
DJANGO_SETTINGS_MODULE='baserow.config.settings.dev' \
BASEROW_ALL_IN_ONE_DEV_MODE='true' \
UV_PROJECT_ENVIRONMENT='/baserow/venv' \
NUXT_CACHE_DIR='/baserow/node_modules/.cache'
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
# Add PostgreSQL repo (for pgvector) and install postgres + redis
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/keyrings/postgresql-keyring.gpg && \
echo "deb [signed-by=/usr/share/keyrings/postgresql-keyring.gpg] http://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/postgresql.list && \
apt-get update && \
apt-get install --no-install-recommends -y \
build-essential \
lsb-release \
ca-certificates \
&& \
# Postgresql repository has to be added manually to get pre-13 versions.
echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& \
# Install the correct version of postgresql and the remaining packages
python3.11-dev \
procps \
vim \
tmux \
sudo \
postgresql-${POSTGRES_VERSION} \
postgresql-${POSTGRES_VERSION}-pgvector \
redis-server && \
# Setup redis
usermod -a -G tty redis && \
sed -i 's/daemonize yes/daemonize no/g' /etc/redis/redis.conf && \
sed -i 's/daemonize no/daemonize no\nbind 127.0.0.1/g' /etc/redis/redis.conf && \
sed -i '/^logfile/d' /etc/redis/redis.conf && \
chown redis:redis /etc/redis/redis.conf
RUN echo "${DOCKER_USER} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${DOCKER_USER} && \
chmod 0440 /etc/sudoers.d/${DOCKER_USER}
# Backend venv and frontend deps
COPY --chown=$UID:$GID --from=backend_image ${UV_PROJECT_ENVIRONMENT} ${UV_PROJECT_ENVIRONMENT}
COPY --chown=$UID:$GID --from=web_frontend_image /baserow/web-frontend/node_modules /baserow/web-frontend/node_modules
COPY --chown=$UID:$GID ./LICENSE /baserow/LICENSE
COPY --chown=$UID:$GID ./backend/docker/mime.types /etc/
COPY --chown=$UID:$GID Caddyfile /baserow/caddy/Caddyfile
COPY --chown=$UID:$GID deploy/all-in-one/supervisor/ /baserow/supervisor
COPY --chown=$UID:$GID deploy/all-in-one/baserow.sh /baserow.sh
USER $UID:$GID
# Configure tmux to preserve environment variables (don't start login shell)
RUN echo 'set -g default-command "${SHELL}"' > /baserow/.tmux.conf
# Create .bashrc with environment variables for interactive shells
RUN printf '%s\n' \
'# Baserow All-in-One Development Environment' \
'export PATH="/baserow/venv/bin:/baserow/web-frontend/node_modules/.bin:$PATH"' \
'export PYTHONPATH="/baserow/backend/src:/baserow/premium/backend/src:/baserow/enterprise/backend/src:/baserow/backend/tests:/baserow/premium/backend/tests:/baserow/enterprise/backend/tests"' \
'export PYTHONUNBUFFERED=1' \
'export UV_PROJECT_ENVIRONMENT=/baserow/venv' \
'export UV_PYTHON_PREFERENCE=only-system' \
'export UV_COMPILE_BYTECODE=0' \
'export UV_CACHE_DIR=/tmp/baserow_uv_cache' \
'export DJANGO_SETTINGS_MODULE=baserow.config.settings.dev' \
'' \
'# Aliases' \
'alias j="just"' \
'alias m="python /baserow/backend/src/baserow/manage.py"' \
'alias pytest="python -m pytest"' \
'alias y="yarn"' \
'' \
'# Show a helpful message' \
'echo "Baserow all-in-one dev container"' \
'echo " j - See available commands"' \
'echo "Backend:"' \
'echo " m <cmd> - Django manage.py (e.g., m shell_plus)"' \
'echo " pytest - Run tests"' \
'echo "Frontend:"' \
'echo " y <cmd> - Run yarn commands"' \
> /baserow/.bashrc
USER root
HEALTHCHECK --interval=60s CMD ["/bin/bash", "/baserow/backend/docker/docker-entrypoint.sh", "backend-healthcheck"]
ENTRYPOINT ["/baserow.sh"]
CMD ["start"]
EXPOSE 80
# =============================================================================
# Production Lite - no embedded database/cache (use external services)
# =============================================================================
FROM base AS prod-lite
ARG UID
ARG GID
ENV DJANGO_SETTINGS_MODULE='baserow.config.settings.base' \
PYTHONPATH="/baserow/backend/src:/baserow/premium/backend/src:/baserow/enterprise/backend/src"
# Copy from pre-built images
COPY --link --from=web_frontend_image /baserow/ /baserow/
COPY --link --from=backend_image /baserow/ /baserow/
COPY --chown=$UID:$GID ./backend/docker/mime.types /etc/
COPY --chown=$UID:$GID Caddyfile /baserow/caddy/Caddyfile
COPY --chown=$UID:$GID deploy/all-in-one/supervisor/ /baserow/supervisor
COPY --chown=$UID:$GID deploy/all-in-one/baserow.sh /baserow.sh
COPY --chown=$UID:$GID deploy/plugins/*.sh /baserow/plugins/
HEALTHCHECK --interval=60s CMD ["/bin/bash", "/baserow/backend/docker/docker-entrypoint.sh", "backend-healthcheck"]
ENTRYPOINT ["/baserow.sh"]
CMD ["start"]
EXPOSE 80
# =============================================================================
# Production - adds embedded PostgreSQL + Redis
# =============================================================================
FROM base AS prod
ARG UID
ARG GID
ENV DJANGO_SETTINGS_MODULE='baserow.config.settings.base' \
PYTHONPATH="/baserow/backend/src:/baserow/premium/backend/src:/baserow/enterprise/backend/src"
# Add PostgreSQL repo (for pgvector) and install postgres + redis
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/keyrings/postgresql-keyring.gpg && \
echo "deb [signed-by=/usr/share/keyrings/postgresql-keyring.gpg] http://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/postgresql.list && \
apt-get update && \
apt-get install --no-install-recommends -y \
postgresql-$POSTGRES_VERSION \
postgresql-${POSTGRES_VERSION}-pgvector \
postgresql-client-$POSTGRES_VERSION \
libpq-dev \
redis-server \
python3 \
python3-pip \
python3-dev \
python3-venv \
tini \
psmisc \
gawk \
git \
xmlsec1 \
procps \
nodejs && \
python3 -m pip install --no-cache-dir --upgrade pip setuptools==78.1.1 --break-system-packages && \
rm -rf /usr/lib/python3/dist-packages/setuptools* /usr/lib/python3/dist-packages/pkg_resources* && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
# ========================
# Install Yarn
# ========================
npm install --global yarn@1.22.19 && \
# ========================
# Install Caddy
# ======================== \
curl -o caddy.tar.gz -sL "https://github.com/caddyserver/caddy/releases/download/v2.7.6/caddy_2.7.6_linux_$(dpkg --print-architecture).tar.gz" && \
tar -xf caddy.tar.gz && \
mv caddy /usr/bin/ && \
rm caddy.tar.gz && \
# ========================
# Setup Users
# ========================
( groupadd -g "$GID" baserow_docker_group || true ) && \
( useradd --shell /bin/bash -u $UID -g "$GID" -o -c "" -m "$DOCKER_USER" -l || true) && \
usermod -a -G tty "$DOCKER_USER" && \
# ========================
# Setup supervisor so it logs to stdout
# ========================
ln -sf /dev/stdout /var/log/supervisor/supervisord.log && \
# ========================
redis-server && \
# Setup redis
# ========================
usermod -a -G tty redis && \
# Ensure redis is not running in daemon mode as supervisor will supervise it directly
sed -i 's/daemonize yes/daemonize no/g' /etc/redis/redis.conf && \
# Ensure redis logs to stdout by removing any logfile statements
sed -i 's/daemonize no/daemonize no\nbind 127.0.0.1/g' /etc/redis/redis.conf && \
# Sedding changes the owner, change it back.
sed -i '/^logfile/d' /etc/redis/redis.conf && \
chown redis:redis /etc/redis/redis.conf
# Install su-exec as a safer alternative to gosu
RUN curl -L -o /usr/local/bin/su-exec.c https://github.com/ncopa/su-exec/raw/master/su-exec.c \
&& gcc -Wall -Werror -static -o /usr/local/bin/su-exec /usr/local/bin/su-exec.c \
&& chmod 0755 /usr/local/bin/su-exec \
&& rm /usr/local/bin/su-exec.c
COPY --link --from=web_frontend_image /baserow/ /baserow/
COPY --link --from=backend_image /baserow/ /baserow/
# In slim docker images, mime.types is removed and we need it for mimetypes guessing
COPY --chown=$UID:$GID ./backend/docker/mime.types /etc/
COPY --chown=$UID:$GID Caddyfile /baserow/caddy/Caddyfile
HEALTHCHECK --interval=60s CMD ["/bin/bash", "/baserow/backend/docker/docker-entrypoint.sh", "backend-healthcheck"]
# ========================
# = BASEROW
# ========================
# We have to explicitly copy the node modules and .nuxt build as otherwise the
# .dockerignore will exclude them.
COPY --chown=$UID:$GID --from=web_frontend_image_base /baserow/web-frontend/node_modules/ /baserow/web-frontend/node_modules/
COPY --chown=$UID:$GID --from=web_frontend_image_base /baserow/web-frontend/.nuxt/ /baserow/web-frontend/.nuxt/
COPY --chown=$UID:$GID --from=web_frontend_image_base /baserow/ /baserow/
COPY --chown=$UID:$GID --from=backend_image_base /baserow/ /baserow/
COPY --chown=$UID:$GID deploy/all-in-one/supervisor/ /baserow/supervisor
COPY --chown=$UID:$GID deploy/all-in-one/baserow.sh /baserow.sh
COPY --chown=$UID:$GID deploy/plugins/*.sh /baserow/plugins/
HEALTHCHECK --interval=60s CMD ["/bin/bash", "/baserow/backend/docker/docker-entrypoint.sh", "backend-healthcheck"]
ENTRYPOINT ["/baserow.sh"]
CMD ["start"]
EXPOSE 80
EXPOSE 80
+8 -8
View File
@@ -222,22 +222,22 @@ file_env EMAIL_SMTP_PASSWORD
if [[ -z "${DISABLE_EMBEDDED_REDIS:-}" ]]; then
mkdir -p "$DATA_DIR"/redis
chown -R redis:redis "$DATA_DIR"/redis
fi
chown -R redis:redis "$DATA_DIR"/redis
fi
if [[ -z "${DISABLE_EMBEDDED_PSQL:-}" ]]; then
mkdir -p "$DATA_DIR"/postgres
chown -R postgres:postgres "$DATA_DIR"/postgres
fi
chown -R postgres:postgres "$DATA_DIR"/postgres
fi
mkdir -p "$DATA_DIR"/caddy
chown -R "$DOCKER_USER": "$DATA_DIR"/caddy
chown -R "$DOCKER_USER": "$DATA_DIR"/caddy
mkdir -p "$DATA_DIR"/media
chown -R "$DOCKER_USER": "$DATA_DIR"/media
chown -R "$DOCKER_USER": "$DATA_DIR"/media
mkdir -p "$DATA_DIR"/env
chown -R "$DOCKER_USER": "$DATA_DIR"/env
chown -R "$DOCKER_USER": "$DATA_DIR"/env
mkdir -p "$DATA_DIR"/backups
chown -R "$DOCKER_USER": "$DATA_DIR"/backups
chown -R "$DOCKER_USER": "$DATA_DIR"/backups
# ========================
# = COMMAND LINE ARG HANDLER
-7
View File
@@ -1,7 +0,0 @@
FROM baserow
# Install dev dependencies manually.
COPY --chown=$UID:$GID ./backend/requirements/dev.txt /tmp/dev-requirements.txt
RUN . /baserow/venv/bin/activate && pip3 install -r /tmp/dev-requirements.txt
ENV BASEROW_ALL_IN_ONE_DEV_MODE='true'
+13 -8
View File
@@ -1,10 +1,10 @@
services:
# A dev compose file for quickly setting up an all in one with hot code reloading
baserow_all_in_one_dev:
image: baserow_dev
baserow_all_in_one:
build:
dockerfile: $PWD/deploy/all-in-one/dev.Dockerfile
dockerfile: $PWD/deploy/all-in-one/Dockerfile
context: $PWD
target: dev
args:
# We allow configuring the UID/GID here so you can run as the dev's actual user
# reducing the chance the containers screw up the bind mounted folders.
@@ -17,19 +17,24 @@ services:
ports:
- "80:80"
- "443:443"
- "5432:5432"
- "6379:6379"
volumes:
- baserow_all_in_one_data:/baserow/data
- baserow_all_in_one_data_dev:/baserow/data
- $PWD/deploy/all-in-one/baserow.sh:/baserow.sh
# backend
- $PWD/backend:/baserow/backend
- $PWD/premium/backend/:/baserow/premium/backend
- $PWD/enterprise/backend/:/baserow/enterprise/backend
# web-frontend
- $PWD/web-frontend:/baserow/web-frontend
- $PWD/premium/web-frontend/:/baserow/premium/web-frontend
- $PWD/enterprise/web-frontend/:/baserow/enterprise/web-frontend
- $PWD/deploy/plugins/:/baserow/plugins/
- $PWD/tests:/baserow/tests
# Override the above mounts for node_modules so we use the node_modules built
# directly into the image instead of whatever is on your local filesystem.
- /baserow/web-frontend/node_modules
- $PWD/premium/web-frontend/:/baserow/premium/web-frontend
- $PWD/enterprise/web-frontend/:/baserow/enterprise/web-frontend
stdin_open: true
tty: true
mailhog:
@@ -39,4 +44,4 @@ services:
ports:
- "8025:8025" # web ui
volumes:
baserow_all_in_one_data:
baserow_all_in_one_data_dev:
+2 -6
View File
@@ -1,15 +1,11 @@
services:
# A dev / testing /example compose file for quickly setting up an all in one
baserow_all_in_one:
image: baserow
image: baserow:${BASEROW_VERSION:-2.0.3}
build:
dockerfile: $PWD/deploy/all-in-one/Dockerfile
context: $PWD
args:
# We allow configuring the UID/GID here so you can run as the dev's actual user
# reducing the chance the containers screw up the bind mounted folders.
UID: $UID
GID: $GID
target: prod
environment:
EMAIL_SMTP: 'yes'
EMAIL_SMTP_HOST: 'mailhog'
+2 -2
View File
@@ -37,11 +37,11 @@ if [[ "$DATABASE_HOST" == "localhost" && -z "${DATABASE_URL:-}" ]]; then
# Update the postgres config to point at the DATA_DIR which must be done here as
# DATA_DIR can change at runtime.
sed -i "s;/var/lib/postgresql/$POSTGRES_VERSION/main;$DATA_DIR/postgres;g" "$POSTGRES_LOCATION"/postgresql.conf
chown postgres:postgres "$POSTGRES_LOCATION"/postgresql.conf
chown postgres:postgres "$POSTGRES_LOCATION"/postgresql.conf
# Setup an empty baserow database with the provided user and password.
POSTGRES_SETUP_SCRIPT_COMMAND=${POSTGRES_SETUP_SCRIPT_COMMAND:-setup}
./baserow/supervisor/wrapper.sh GREEN POSTGRES_INIT ./baserow/supervisor/docker-postgres-setup.sh ${POSTGRES_SETUP_SCRIPT_COMMAND}
./baserow/supervisor/wrapper.sh GREEN POSTGRES_INIT ./baserow/supervisor/docker-postgres-setup.sh ${POSTGRES_SETUP_SCRIPT_COMMAND}
# Enable the embedded postgres by moving it into the directory from which supervisor
# includes all .conf files it finds.
+1 -1
View File
@@ -7,7 +7,7 @@ services:
dockerfile: $PWD/deploy/cloudron/Dockerfile
context: $PWD
args:
- FROM_IMAGE=baserow
- FROM_IMAGE=baserow/baserow:latest
environment:
- CLOUDRON_POSTGRESQL_PASSWORD=baserow
- CLOUDRON_POSTGRESQL_DATABASE=baserow
+1 -1
View File
@@ -3,7 +3,7 @@
services:
baserow:
container_name: baserow
image: baserow/baserow:2.0.6
image: baserow/baserow:${BASEROW_VERSION:-2.0.6}
environment:
BASEROW_PUBLIC_URL: 'http://localhost'
ports:
+18
View File
@@ -0,0 +1,18 @@
# Build overrides for production images
# Usage: docker compose -f docker-compose.yml -f docker-compose.build.yml build --parallel
#
# This file only contains build directives - no runtime config.
# Use with base docker-compose.yml to build production images locally.
services:
backend:
build:
dockerfile: ./backend/Dockerfile
context: .
target: prod
web-frontend:
build:
dockerfile: ./web-frontend/Dockerfile
context: .
target: prod
+56 -75
View File
@@ -5,6 +5,10 @@ services:
ports:
- "${HOST_PUBLISH_IP:-127.0.0.1}:${POSTGRES_PORT:-5432}:5432"
command: "${POSTGRES_DEV_EXTRA_ARGS}"
volumes:
# Use a different volume in case the Major version is different from the
# production one to avoid issues.
- pgdatadev:/var/lib/postgresql/data
redis:
ports:
@@ -18,7 +22,7 @@ services:
- $PWD/Caddyfile.dev:/etc/caddy/Caddyfile
backend:
image: baserow_backend_dev:latest
image: baserow_backend:dev
environment:
- BASEROW_BACKEND_DEBUGGER_ENABLED
- BASEROW_BACKEND_DEBUGGER_PORT=${BASEROW_BACKEND_DEBUGGER_PORT:-5678}
@@ -41,7 +45,7 @@ services:
- ./backend:/baserow/backend
- ./premium/backend/:/baserow/premium/backend
- ./enterprise/backend/:/baserow/enterprise/backend
- ./deploy/plugins/install_plugin.sh:/baserow/plugins/install_plugin.sh
- ./deploy/plugins/:/baserow/plugins/
- ./tests:/baserow/tests
# Open stdin and tty so when attaching key input works as expected.
stdin_open: true
@@ -50,7 +54,7 @@ services:
- otel-collector
web-frontend:
image: baserow_web-frontend_dev:latest
image: baserow_web-frontend:dev
build:
dockerfile: ./web-frontend/Dockerfile
context: .
@@ -64,58 +68,46 @@ services:
- "${HOST_PUBLISH_IP:-127.0.0.1}:3000:3000"
volumes:
- ./web-frontend:/baserow/web-frontend
# Override the above mounts for node_modules so we use the node_modules built
# directly into the image instead of whatever is on your local filesystem.
- /baserow/web-frontend/node_modules
- ./premium/web-frontend/:/baserow/premium/web-frontend
- ./enterprise/web-frontend/:/baserow/enterprise/web-frontend
- ./tests/:/baserow/tests
- ./deploy/plugins:/baserow/plugins
# Override the above mounts for node_modules so we use the node_modules built
# directly into the image instead of whatever is on your local filesystem.
- node_modules:/baserow/web-frontend/node_modules
# Open stdin and tty so when attaching key input works as expected.
stdin_open: true
tty: true
web-frontend-storybook:
image: baserow_web-frontend_dev:latest
image: baserow_web-frontend:dev
profiles: ["optional"]
restart: unless-stopped
environment:
FEATURE_FLAGS:
networks:
local:
build:
dockerfile: ./web-frontend/Dockerfile
context: .
target: dev
args:
# We allow configuring the UID/GID here so you can run as the dev's actual user
# reducing the chance the containers screw up the bind mounted folders.
UID: $UID
GID: $GID
command: "storybook-dev"
healthcheck:
disable: true
ports:
- "${HOST_PUBLISH_IP:-127.0.0.1}:6006:6006"
volumes:
- ./web-frontend:/baserow/web-frontend
# Override the above mounts for node_modules so we use the node_modules built
# directly into the image instead of whatever is on your local filesystem.
- /baserow/web-frontend/node_modules
- ./premium/web-frontend/:/baserow/premium/web-frontend
- ./enterprise/web-frontend/:/baserow/enterprise/web-frontend
- ./tests/:/baserow/tests
- ./deploy/plugins:/baserow/plugins
# Override the above mounts for node_modules so we use the node_modules built
# directly into the image instead of whatever is on your local filesystem.
- node_modules:/baserow/web-frontend/node_modules
# Open stdin and tty so when attaching key input works as expected.
stdin_open: true
tty: true
celery:
image: baserow_backend_dev:latest
build:
dockerfile: ./backend/Dockerfile
context: .
target: dev
args:
# We allow configuring the UID/GID here so you can run as the dev's actual user
# reducing the chance the containers screw up the bind mounted folders.
UID: $UID
GID: $GID
image: baserow_backend:dev
user: "${UID}:${GID}"
command: "watch-py celery-worker"
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
@@ -124,6 +116,7 @@ services:
- ./backend:/baserow/backend
- ./premium/backend/:/baserow/premium/backend
- ./enterprise/backend/:/baserow/enterprise/backend
- ./deploy/plugins:/baserow/plugins
# Open stdin and tty so when attaching key input works as expected.
stdin_open: true
tty: true
@@ -131,24 +124,17 @@ services:
- otel-collector
celery-export-worker:
image: baserow_backend_dev:latest
image: baserow_backend:dev
user: "${UID}:${GID}"
command: "watch-py celery-exportworker"
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
- BASEROW_DANGEROUS_SILKY_ANALYZE_QUERIES
build:
dockerfile: ./backend/Dockerfile
context: .
target: dev
args:
# We allow configuring the UID/GID here so you can run as the dev's actual user
# reducing the chance the containers screw up the bind mounted folders.
UID: $UID
GID: $GID
command: "watch-py celery-exportworker"
volumes:
- ./backend:/baserow/backend
- ./premium/backend/:/baserow/premium/backend
- ./enterprise/backend/:/baserow/enterprise/backend
- ./deploy/plugins:/baserow/plugins
# Open stdin and tty so when attaching key input works as expected.
stdin_open: true
tty: true
@@ -156,40 +142,32 @@ services:
- otel-collector
celery-beat-worker:
image: baserow_backend_dev:latest
image: baserow_backend:dev
user: "${UID}:${GID}"
command: "watch-py celery-beat"
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
build:
dockerfile: ./backend/Dockerfile
context: .
target: dev
args:
# We allow configuring the UID/GID here so you can run as the dev's actual user
# reducing the chance the containers screw up the bind mounted folders.
UID: $UID
GID: $GID
command: "watch-py celery-beat"
volumes:
- ./backend:/baserow/backend
- ./premium/backend/:/baserow/premium/backend
- ./enterprise/backend/:/baserow/enterprise/backend
- ./deploy/plugins:/baserow/plugins
# Open stdin and tty so when attaching key input works as expected.
stdin_open: true
tty: true
celery-flower:
image: baserow_backend_dev:latest
build:
dockerfile: ./backend/Dockerfile
context: .
target: dev
args:
# We allow configuring the UID/GID here so you can run as the dev's actual user
# reducing the chance the containers screw up the bind mounted folders.
UID: $UID
GID: $GID
image: baserow_backend:dev
user: "${UID}:${GID}"
profiles: ["optional"]
restart: unless-stopped
stop_signal: SIGQUIT
command: "celery-flower"
healthcheck:
test: ["CMD-SHELL", "curl --fail http://localhost:5555 || exit 1"]
interval: 30s
timeout: 10s
retries: 3
environment:
REDIS_HOST:
REDIS_PORT:
@@ -197,13 +175,14 @@ services:
REDIS_URL:
REDIS_USER:
REDIS_PASSWORD: ${REDIS_PASSWORD:?}
depends_on:
- backend
volumes:
- ./backend:/baserow/backend
- ./premium/backend/:/baserow/premium/backend
- ./enterprise/backend/:/baserow/enterprise/backend
- ./deploy/plugins:/baserow/plugins
- media:/baserow/media
ports:
- "5555:5555" # web ui
command: "celery-flower"
networks:
local:
# Open stdin and tty so when attaching key input works as expected.
@@ -211,19 +190,17 @@ services:
tty: true
mjml-email-compiler:
build:
target: dev
args:
# We allow configuring the UID/GID here so you can run as the dev's actual user
# reducing the chance the containers screw up the bind mounted folders.
UID: $UID
GID: $GID
context: .
dockerfile: ./web-frontend/Dockerfile
image: baserow_web-frontend:latest
image: baserow_web-frontend:dev
depends_on:
- web-frontend
user: "${UID}:${GID}"
command: "bash -c 'cd /baserow/backend/email_compiler/ && yarn install && yarn run watch'"
healthcheck:
disable: true
volumes:
- ./backend:/baserow/backend
- ./web-frontend/docker:/baserow/web-frontend/docker
- ./deploy/plugins:/baserow/plugins
# Open stdin and tty so when attaching key input works as expected.
stdin_open: true
tty: true
@@ -242,7 +219,7 @@ services:
# environment here.
volume-permissions-fixer:
image: bash:4.4
command: chown ${UID:-1000}:${GID:-1000} -R /baserow/media
command: chown ${UID:-9999}:${GID:-9999} -R /baserow/media
volumes:
- media:/baserow/media
- caddy_config:/config
@@ -262,3 +239,7 @@ services:
local:
ports:
- "4318:4318"
volumes:
pgdatadev:
node_modules:
-369
View File
@@ -1,369 +0,0 @@
# Runs Baserow with each service in its own container and builds the Baserow images
# from this local repository instead of using the pre-built images from Dockerhub.
# Otherwise, identical to docker-compose.yml.
#
# More documentation can be found in:
# https://baserow.io/docs/installation%2Finstall-with-docker-compose
# See https://baserow.io/docs/installation%2Fconfiguration for more details on these
# backend environment variables, their defaults if left blank etc.
x-backend-variables:
&backend-variables # Most users should only need to set these first four variables.
SECRET_KEY: ${SECRET_KEY:?}
DATABASE_PASSWORD: ${DATABASE_PASSWORD:?}
REDIS_PASSWORD: ${REDIS_PASSWORD:?}
BASEROW_JWT_SIGNING_KEY: ${BASEROW_JWT_SIGNING_KEY:-}
# If you manually change this line make sure you also change the duplicate line in
# the web-frontend service.
BASEROW_PUBLIC_URL: ${BASEROW_PUBLIC_URL-http://localhost}
# Set these if you want to use an external postgres instead of the db service below.
DATABASE_USER: ${DATABASE_USER:-baserow}
DATABASE_NAME: ${DATABASE_NAME:-baserow}
DATABASE_HOST:
DATABASE_PORT:
DATABASE_OPTIONS:
DATABASE_URL:
# Set these if you want to use an external redis instead of the redis service below.
REDIS_HOST:
REDIS_PORT:
REDIS_PROTOCOL:
REDIS_URL:
REDIS_USER:
# Set these to enable Baserow to send emails.
EMAIL_SMTP:
EMAIL_SMTP_HOST:
EMAIL_SMTP_PORT:
EMAIL_SMTP_USE_TLS:
EMAIL_SMTP_USE_SSL:
EMAIL_SMTP_USER:
EMAIL_SMTP_PASSWORD:
EMAIL_SMTP_SSL_CERTFILE_PATH:
EMAIL_SMTP_SSL_KEYFILE_PATH:
FROM_EMAIL:
# Set these to use AWS S3 bucket to store user files.
AWS_ACCESS_KEY_ID:
AWS_SECRET_ACCESS_KEY:
AWS_STORAGE_BUCKET_NAME:
AWS_S3_REGION_NAME:
AWS_S3_ENDPOINT_URL:
AWS_S3_CUSTOM_DOMAIN:
# Misc settings see https://baserow.io/docs/installation%2Fconfiguration for info
BASEROW_AMOUNT_OF_WORKERS:
BASEROW_ROW_PAGE_SIZE_LIMIT:
BATCH_ROWS_SIZE_LIMIT:
INITIAL_TABLE_DATA_LIMIT:
BASEROW_FILE_UPLOAD_SIZE_LIMIT_MB:
BASEROW_OPENAI_UPLOADED_FILE_SIZE_LIMIT_MB:
BASEROW_UNIQUE_ROW_VALUES_SIZE_LIMIT:
BASEROW_AUTOMATION_HISTORY_PAGE_SIZE_LIMIT:
BASEROW_AUTOMATION_WORKFLOW_RATE_LIMIT_MAX_RUNS:
BASEROW_AUTOMATION_WORKFLOW_RATE_LIMIT_CACHE_EXPIRY_SECONDS:
BASEROW_AUTOMATION_WORKFLOW_MAX_CONSECUTIVE_ERRORS:
BASEROW_EXTRA_ALLOWED_HOSTS:
ADDITIONAL_APPS:
BASEROW_PLUGIN_GIT_REPOS:
BASEROW_PLUGIN_URLS:
BASEROW_ENABLE_SECURE_PROXY_SSL_HEADER:
MIGRATE_ON_STARTUP: ${MIGRATE_ON_STARTUP:-true}
SYNC_TEMPLATES_ON_STARTUP: ${SYNC_TEMPLATES_ON_STARTUP:-true}
BASEROW_SYNC_TEMPLATES_PATTERN:
DONT_UPDATE_FORMULAS_AFTER_MIGRATION:
BASEROW_TRIGGER_SYNC_TEMPLATES_AFTER_MIGRATION:
BASEROW_SYNC_TEMPLATES_TIME_LIMIT:
BASEROW_BACKEND_DEBUG:
BASEROW_BACKEND_LOG_LEVEL:
FEATURE_FLAGS:
BASEROW_ENABLE_OTEL:
BASEROW_DEPLOYMENT_ENV:
OTEL_EXPORTER_OTLP_ENDPOINT:
OTEL_RESOURCE_ATTRIBUTES:
POSTHOG_PROJECT_API_KEY:
POSTHOG_HOST:
PRIVATE_BACKEND_URL: http://backend:8000
PUBLIC_BACKEND_URL:
PUBLIC_WEB_FRONTEND_URL:
BASEROW_EMBEDDED_SHARE_URL:
MEDIA_URL:
MEDIA_ROOT:
BASEROW_AIRTABLE_IMPORT_SOFT_TIME_LIMIT:
HOURS_UNTIL_TRASH_PERMANENTLY_DELETED:
OLD_ACTION_CLEANUP_INTERVAL_MINUTES:
MINUTES_UNTIL_ACTION_CLEANED_UP:
BASEROW_GROUP_STORAGE_USAGE_QUEUE:
DISABLE_ANONYMOUS_PUBLIC_VIEW_WS_CONNECTIONS:
BASEROW_WAIT_INSTEAD_OF_409_CONFLICT_ERROR:
BASEROW_DISABLE_MODEL_CACHE:
BASEROW_PLUGIN_DIR:
BASEROW_JOB_EXPIRATION_TIME_LIMIT:
BASEROW_JOB_CLEANUP_INTERVAL_MINUTES:
BASEROW_ROW_HISTORY_CLEANUP_INTERVAL_MINUTES:
BASEROW_ROW_HISTORY_RETENTION_DAYS:
BASEROW_USER_LOG_ENTRY_CLEANUP_INTERVAL_MINUTES:
BASEROW_USER_LOG_ENTRY_RETENTION_DAYS:
BASEROW_IMPORT_EXPORT_RESOURCE_CLEANUP_INTERVAL_MINUTES:
BASEROW_IMPORT_EXPORT_RESOURCE_REMOVAL_AFTER_DAYS:
BASEROW_IMPORT_EXPORT_TABLE_ROWS_COUNT_LIMIT:
BASEROW_MAX_ROW_REPORT_ERROR_COUNT:
BASEROW_JOB_SOFT_TIME_LIMIT:
BASEROW_FRONTEND_JOBS_POLLING_TIMEOUT_MS:
BASEROW_INITIAL_CREATE_SYNC_TABLE_DATA_LIMIT:
BASEROW_WEBHOOKS_ALLOW_PRIVATE_ADDRESS:
BASEROW_WEBHOOKS_IP_BLACKLIST:
BASEROW_WEBHOOKS_IP_WHITELIST:
BASEROW_WEBHOOKS_URL_REGEX_BLACKLIST:
BASEROW_WEBHOOKS_URL_CHECK_TIMEOUT_SECS:
BASEROW_WEBHOOKS_MAX_CONSECUTIVE_TRIGGER_FAILURES:
BASEROW_WEBHOOKS_MAX_RETRIES_PER_CALL:
BASEROW_WEBHOOKS_MAX_PER_TABLE:
BASEROW_WEBHOOKS_MAX_CALL_LOG_ENTRIES:
BASEROW_WEBHOOKS_REQUEST_TIMEOUT_SECONDS:
BASEROW_INTEGRATIONS_ALLOW_PRIVATE_ADDRESS:
BASEROW_INTEGRATIONS_PERIODIC_MINUTE_MIN:
BASEROW_ENTERPRISE_AUDIT_LOG_CLEANUP_INTERVAL_MINUTES:
BASEROW_ENTERPRISE_AUDIT_LOG_RETENTION_DAYS:
BASEROW_ALLOW_MULTIPLE_SSO_PROVIDERS_FOR_SAME_ACCOUNT:
BASEROW_SEAT_USAGE_JOB_CRONTAB:
BASEROW_PERIODIC_FIELD_UPDATE_CRONTAB:
BASEROW_PERIODIC_FIELD_UPDATE_UNUSED_WORKSPACE_INTERVAL_MIN:
BASEROW_PERIODIC_FIELD_UPDATE_TIMEOUT_MINUTES:
BASEROW_PERIODIC_FIELD_UPDATE_QUEUE_NAME:
BASEROW_MAX_CONCURRENT_USER_REQUESTS:
BASEROW_CONCURRENT_USER_REQUESTS_THROTTLE_TIMEOUT:
BASEROW_SEND_VERIFY_EMAIL_RATE_LIMIT:
BASEROW_LOGIN_ACTION_LOG_LIMIT:
BASEROW_OSS_ONLY:
OTEL_TRACES_SAMPLER:
OTEL_TRACES_SAMPLER_ARG:
OTEL_PER_MODULE_SAMPLER_OVERRIDES:
BASEROW_CACHALOT_ENABLED:
BASEROW_CACHALOT_MODE:
BASEROW_CACHALOT_ONLY_CACHABLE_TABLES:
BASEROW_CACHALOT_UNCACHABLE_TABLES:
BASEROW_CACHALOT_TIMEOUT:
BASEROW_BUILDER_PUBLICLY_USED_PROPERTIES_CACHE_TTL_SECONDS:
BASEROW_BUILDER_DISPATCH_ACTION_CACHE_TTL_SECONDS:
BASEROW_AUTO_INDEX_VIEW_ENABLED:
BASEROW_PERSONAL_VIEW_LOWEST_ROLE_ALLOWED:
BASEROW_DISABLE_LOCKED_MIGRATIONS:
BASEROW_USE_PG_FULLTEXT_SEARCH:
BASEROW_PG_FULLTEXT_SEARCH_UPDATE_DATA_THROTTLE_SECONDS:
BASEROW_BUILDER_DOMAINS:
BASEROW_FRONTEND_SAME_SITE_COOKIE:
BASEROW_ICAL_VIEW_MAX_EVENTS: ${BASEROW_ICAL_VIEW_MAX_EVENTS:-}
BASEROW_WEBHOOK_ROWS_ENTER_VIEW_BATCH_SIZE:
BASEROW_DEADLOCK_INITIAL_BACKOFF:
BASEROW_DEADLOCK_MAX_RETRIES:
BASEROW_PREMIUM_GROUPED_AGGREGATE_SERVICE_MAX_SERIES:
BASEROW_PREMIUM_GROUPED_AGGREGATE_SERVICE_MAX_AGG_BUCKETS:
BASEROW_ENTERPRISE_ASSISTANT_LLM_MODEL:
BASEROW_ENTERPRISE_ASSISTANT_LLM_TEMPERATURE:
BASEROW_EMBEDDINGS_API_URL:
services:
# A caddy reverse proxy sitting in-front of all the services. Responsible for routing
# requests to either the backend or web-frontend and also serving user uploaded files
# from the media volume.
caddy:
image: caddy:2
restart: unless-stopped
environment:
# Controls what port the Caddy server binds to inside its container.
BASEROW_CADDY_ADDRESSES: ${BASEROW_CADDY_ADDRESSES:-:80}
PRIVATE_WEB_FRONTEND_URL: ${PRIVATE_WEB_FRONTEND_URL:-http://web-frontend:3000}
PRIVATE_BACKEND_URL: ${PRIVATE_BACKEND_URL:-http://backend:8000}
BASEROW_PUBLIC_URL: ${BASEROW_PUBLIC_URL:-}
ports:
- "${HOST_PUBLISH_IP:-0.0.0.0}:${WEB_FRONTEND_PORT:-80}:80"
- "${HOST_PUBLISH_IP:-0.0.0.0}:${WEB_FRONTEND_SSL_PORT:-443}:443"
volumes:
- $PWD/Caddyfile:/etc/caddy/Caddyfile
- media:/baserow/media
- caddy_config:/config
- caddy_data:/data
networks:
local:
backend:
image: baserow_backend:latest
build:
dockerfile: ./backend/Dockerfile
context: .
restart: unless-stopped
environment:
<<: *backend-variables
depends_on:
- db
- redis
volumes:
- media:/baserow/media
networks:
local:
web-frontend:
image: baserow_web-frontend:latest
build:
dockerfile: ./web-frontend/Dockerfile
context: .
restart: unless-stopped
environment:
BASEROW_PUBLIC_URL: ${BASEROW_PUBLIC_URL-http://localhost}
PRIVATE_BACKEND_URL: ${PRIVATE_BACKEND_URL:-http://backend:8000}
PUBLIC_BACKEND_URL:
PUBLIC_WEB_FRONTEND_URL:
BASEROW_EMBEDDED_SHARE_URL:
BASEROW_DISABLE_PUBLIC_URL_CHECK:
INITIAL_TABLE_DATA_LIMIT:
DOWNLOAD_FILE_VIA_XHR:
BASEROW_DISABLE_GOOGLE_DOCS_FILE_PREVIEW:
BASEROW_DISABLE_SUPPORT:
HOURS_UNTIL_TRASH_PERMANENTLY_DELETED:
DISABLE_ANONYMOUS_PUBLIC_VIEW_WS_CONNECTIONS:
FEATURE_FLAGS:
ADDITIONAL_MODULES:
BASEROW_MAX_IMPORT_FILE_SIZE_MB:
BASEROW_MAX_SNAPSHOTS_PER_GROUP:
BASEROW_ENABLE_OTEL:
BASEROW_DEPLOYMENT_ENV:
BASEROW_OSS_ONLY:
BASEROW_USE_PG_FULLTEXT_SEARCH:
BASEROW_PG_FULLTEXT_SEARCH_UPDATE_DATA_THROTTLE_SECONDS:
BASEROW_UNIQUE_ROW_VALUES_SIZE_LIMIT:
BASEROW_ROW_PAGE_SIZE_LIMIT:
BASEROW_BUILDER_DOMAINS:
BASEROW_FRONTEND_SAME_SITE_COOKIE:
BASEROW_AUTOMATION_HISTORY_PAGE_SIZE_LIMIT:
BASEROW_AUTOMATION_WORKFLOW_RATE_LIMIT_MAX_RUNS:
BASEROW_AUTOMATION_WORKFLOW_RATE_LIMIT_CACHE_EXPIRY_SECONDS:
BASEROW_AUTOMATION_WORKFLOW_MAX_CONSECUTIVE_ERRORS:
BASEROW_INTEGRATIONS_PERIODIC_MINUTE_MIN:
depends_on:
- backend
networks:
local:
celery:
image: baserow_backend:latest
build:
dockerfile: ./backend/Dockerfile
context: .
restart: unless-stopped
environment:
<<: *backend-variables
command: celery-worker
# The backend image's baked in healthcheck defaults to the django healthcheck
# override it to the celery one here.
healthcheck:
test:
[
"CMD-SHELL",
"/baserow/backend/docker/docker-entrypoint.sh celery-worker-healthcheck",
]
depends_on:
- backend
volumes:
- media:/baserow/media
networks:
local:
celery-export-worker:
image: baserow_backend:latest
build:
dockerfile: ./backend/Dockerfile
context: .
restart: unless-stopped
command: celery-exportworker
environment:
<<: *backend-variables
# The backend image's baked in healthcheck defaults to the django healthcheck
# override it to the celery one here.
healthcheck:
test:
[
"CMD-SHELL",
"/baserow/backend/docker/docker-entrypoint.sh celery-exportworker-healthcheck",
]
depends_on:
- backend
volumes:
- media:/baserow/media
networks:
local:
celery-beat-worker:
image: baserow_backend:latest
build:
dockerfile: ./backend/Dockerfile
context: .
restart: unless-stopped
command: celery-beat
environment:
<<: *backend-variables
# See https://github.com/sibson/redbeat/issues/129#issuecomment-1057478237
stop_signal: SIGQUIT
depends_on:
- backend
volumes:
- media:/baserow/media
networks:
local:
db:
image: pgvector/pgvector:pg15
restart: unless-stopped
environment:
- POSTGRES_USER=${DATABASE_USER:-baserow}
- POSTGRES_PASSWORD=${DATABASE_PASSWORD:?}
- POSTGRES_DB=${DATABASE_NAME:-baserow}
healthcheck:
test:
[
"CMD-SHELL",
'su postgres -c "pg_isready -U ${DATABASE_USER:-baserow}"',
]
interval: 10s
timeout: 5s
retries: 5
networks:
local:
volumes:
- pgdata:/var/lib/postgresql/data
redis:
image: redis:6
restart: unless-stopped
command: redis-server --requirepass ${REDIS_PASSWORD:?}
healthcheck:
test: ["CMD", "redis-cli", "ping"]
networks:
local:
# By default, the media volume will be owned by root on startup. Ensure it is owned by
# the same user that django is running as, so it can write user files.
volume-permissions-fixer:
image: bash:4.4
command: chown 9999:9999 -R /baserow/media
volumes:
- media:/baserow/media
networks:
local:
volumes:
pgdata:
media:
caddy_data:
caddy_config:
networks:
local:
driver: bridge
+14 -5
View File
@@ -266,7 +266,7 @@ services:
local:
backend:
image: baserow/backend:2.0.6
image: baserow/backend:${BASEROW_VERSION:-2.0.6}
restart: unless-stopped
environment:
@@ -280,7 +280,7 @@ services:
local:
web-frontend:
image: baserow/web-frontend:2.0.6
image: baserow/web-frontend:${BASEROW_VERSION:-2.0.6}
restart: unless-stopped
environment:
BASEROW_PUBLIC_URL: ${BASEROW_PUBLIC_URL-http://localhost}
@@ -326,7 +326,7 @@ services:
local:
celery:
image: baserow/backend:2.0.6
image: baserow/backend:${BASEROW_VERSION:-2.0.6}
restart: unless-stopped
environment:
<<: *backend-variables
@@ -347,7 +347,7 @@ services:
local:
celery-export-worker:
image: baserow/backend:2.0.6
image: baserow/backend:${BASEROW_VERSION:-2.0.6}
restart: unless-stopped
command: celery-exportworker
environment:
@@ -368,9 +368,18 @@ services:
local:
celery-beat-worker:
image: baserow/backend:2.0.6
image: baserow/backend:${BASEROW_VERSION:-2.0.6}
restart: unless-stopped
command: celery-beat
healthcheck:
test:
[
"CMD-SHELL",
"/baserow/backend/docker/docker-entrypoint.sh celery-beat-healthcheck"
]
interval: 30s
timeout: 10s
retries: 3
environment:
<<: *backend-variables
# See https://github.com/sibson/redbeat/issues/129#issuecomment-1057478237
@@ -0,0 +1,389 @@
# Building and Running Production Images
This guide covers building Baserow's production Docker images locally and running them for testing or deployment preparation.
## Overview
Baserow provides several image types for different deployment scenarios:
| Image | Use Case | Command |
|-------|----------|---------|
| `backend` | Backend API server (separate deployment) | `just build backend` |
| `web-frontend` | Nuxt frontend (separate deployment) | `just build web-frontend` |
| `all-in-one` | Single container with embedded PostgreSQL/Redis | `just build all-in-one` |
| `all-in-one-lite` | Single container without PostgreSQL/Redis | `just build all-in-one-lite` |
| `heroku` | Heroku platform | `just build heroku` |
| `cloudron` | Cloudron marketplace | `just build cloudron` |
| `render` | Render.com platform | `just build render` |
## Quick Start
### Build and Run All-in-One
The simplest way to test production images locally:
```bash
# Build the all-in-one image
just build all-in-one
# Run it
just dc-deploy all-in-one up -d
# View logs
just dc-deploy all-in-one logs -f
# Access at http://localhost
```
### Build and Run Separate Services
For testing the production multi-container setup:
```bash
# Build production images
just dc-prod build --parallel
# Run production stack
just dc-prod up -d
# View logs
just dc-prod logs -f
# Access at http://localhost:3000 (frontend) and http://localhost:8000 (API)
```
## Building Images
### The `just build` Command
Build individual deployment images:
```bash
# Build with default tag (:latest)
just build backend
just build web-frontend
just build all-in-one
# Build with custom tag
just build backend 2.0.0
just build all-in-one 2.0.0
# Build with additional Docker arguments
just build backend latest --no-cache
just build all-in-one 2.0.0 --progress=plain
```
### Available Build Targets
```bash
just build
# Shows:
# backend - Backend API server
# web-frontend - Nuxt web frontend
# all-in-one - Single container (production)
# all-in-one-lite - Single container without postgres/redis
# all-in-one-dev - Single container (development)
# heroku - Heroku platform
# cloudron - Cloudron marketplace
# render - Render.com platform
# apache - Apache reverse proxy
# apache-no-caddy - Apache reverse proxy (no Caddy)
```
### Building with `dc-prod`
The `just dc-prod build` command builds production images using Docker Compose:
```bash
# Build all services
just dc-prod build --parallel
# Build specific service
just dc-prod build backend
# Build without cache
just dc-prod build --no-cache --parallel
```
This uses `docker-compose.yml` + `docker-compose.build.yml` to build the `prod` target from each Dockerfile.
### Image Tagging
| Command | Resulting Tag |
|---------|---------------|
| `just build backend` | `baserow/backend:latest` |
| `just build backend 2.0.0` | `baserow/backend:2.0.0` |
| `just build all-in-one` | `baserow/baserow:latest` |
| `just build all-in-one 2.0.0` | `baserow/baserow:2.0.0` |
| `just build all-in-one-lite` | `baserow/baserow:lite-latest` |
## Running Production Images
### Using `dc-prod`
Run the full production stack (backend, frontend, celery workers, database, redis):
```bash
# Start production stack (builds if needed)
just dc-prod up -d
# View logs
just dc-prod logs -f
# Stop
just dc-prod down
```
By default, `dc-prod` builds images locally. To use pre-built images from a registry:
```bash
# Pull and run a specific version
BASEROW_VERSION=2.0.5 just dc-prod up -d
# This pulls from the registry instead of building
```
### Using `dc-deploy`
Run specific deployment configurations:
```bash
just dc-deploy
# Shows available deployments:
# all-in-one - All-in-one container (production)
# all-in-one-dev - All-in-one container (development)
# cloudron - Cloudron deployment
# heroku - Heroku deployment
# traefik - Traefik reverse proxy
# nginx - Nginx reverse proxy
# apache - Apache reverse proxy
# local-testing - Local testing setup
```
#### All-in-One Container
The all-in-one image includes everything: backend, frontend, celery, PostgreSQL, and Redis.
```bash
# Build the all-in-one image
just build all-in-one
# Run it
just dc-deploy all-in-one up -d
# View logs
just dc-deploy all-in-one logs -f
# Stop
just dc-deploy all-in-one down
# Stop and remove data
just dc-deploy all-in-one down -v
```
Access at http://localhost (port 80).
#### All-in-One Lite
For when you have external PostgreSQL and Redis:
```bash
# Build
just build all-in-one-lite
# Run with external database
docker run -d \
-e DATABASE_URL=postgres://user:pass@host:5432/baserow \
-e REDIS_URL=redis://host:6379 \
-e BASEROW_PUBLIC_URL=https://baserow.example.com \
-p 80:80 \
baserow/baserow:lite-latest
```
#### Platform-Specific Deployments
```bash
# Heroku
just build heroku
just dc-deploy heroku up -d
# Cloudron
just build cloudron
just dc-deploy cloudron up -d
# With reverse proxies
just dc-deploy traefik up -d
just dc-deploy nginx up -d
just dc-deploy apache up -d
```
### Local Testing Setup
For quick local testing of production images:
```bash
just dc-deploy local-testing up -d
just dc-deploy local-testing logs -f
```
## Environment Configuration
### Production Environment Variables
Key variables for production:
| Variable | Description | Example |
|----------|-------------|---------|
| `BASEROW_PUBLIC_URL` | Public URL for Baserow | `https://baserow.example.com` |
| `SECRET_KEY` | Django secret key | (generate a secure random string) |
| `DATABASE_URL` | PostgreSQL connection | `postgres://user:pass@host:5432/db` |
| `REDIS_URL` | Redis connection | `redis://host:6379` |
| `EMAIL_SMTP` | Enable SMTP | `yes` |
| `EMAIL_SMTP_HOST` | SMTP server | `smtp.example.com` |
| `FROM_EMAIL` | Sender email | `noreply@example.com` |
### Using .env Files
Create a `.env` file for production settings:
```bash
# Copy example
cp .env.example .env
# Edit with your settings
vim .env
# Run with env file
docker compose --env-file .env -f docker-compose.yml up -d
```
## Multi-Architecture Builds
Build images for multiple architectures (e.g., AMD64 and ARM64):
```bash
# Create a builder for multi-arch
docker buildx create --name multiarch --use
# Build and push multi-arch images
docker buildx build \
--platform linux/amd64,linux/arm64 \
-f backend/Dockerfile \
--target prod \
-t baserow/backend:latest \
--push \
.
```
## Image Sizes
Typical production image sizes:
| Image | Approximate Size |
|-------|------------------|
| `baserow/backend:latest` | ~500MB |
| `baserow/web-frontend:latest` | ~400MB |
| `baserow/baserow:latest` (all-in-one) | ~1.5GB |
| `baserow/baserow:lite-latest` | ~1GB |
## Dockerfile Targets
Each Dockerfile has multiple build targets:
### Backend Dockerfile
| Target | Purpose |
|--------|---------|
| `prod` | Production image (minimal, no dev deps) |
| `dev` | Development image (includes dev deps, tools) |
| `ci` | CI image (includes test deps) |
### Web-Frontend Dockerfile
| Target | Purpose |
|--------|---------|
| `prod` | Production image (built assets, production deps only) |
| `dev` | Development image (all deps, hot reload support) |
| `ci` | CI image (includes test deps) |
### All-in-One Dockerfile
| Target | Purpose |
|--------|---------|
| `prod` | Full all-in-one with PostgreSQL/Redis |
| `prod-lite` | All-in-one without PostgreSQL/Redis |
| `dev` | Development all-in-one |
## Troubleshooting
### Build Failures
```bash
# Clear Docker builder cache
# WARNING: This clears ALL Docker builder cache, not just Baserow!
just prune
# Build without cache
just build backend latest --no-cache
# Build with verbose output
just build backend latest --progress=plain
```
### Container Won't Start
```bash
# Check logs
just dc-prod logs backend
just dc-deploy all-in-one logs
# Check container status
just dc-prod ps
docker ps -a
# Run with interactive shell to debug
docker run -it --entrypoint bash baserow/backend:latest
```
### Database Connection Issues
```bash
# For all-in-one, check internal PostgreSQL
just dc-deploy all-in-one exec baserow_all_in_one psql -U baserow
# For separate deployment
just dc-prod exec db psql -U baserow
```
### Image Too Large
If images are unexpectedly large:
```bash
# Check image layers
docker history baserow/backend:latest
# Inspect image
docker inspect baserow/backend:latest
# Check what's inside
docker run --rm -it baserow/backend:latest du -sh /*
```
## Exporting Images
To transfer images without a registry:
```bash
# Save to tar.gz
docker save baserow/backend:latest | gzip > baserow-backend.tar.gz
# Load on another machine
docker load < baserow-backend.tar.gz
```
## Further Reading
- [install-with-docker.md](../installation/install-with-docker.md) - Production installation guide
- [running-the-dev-env-with-docker.md](running-the-dev-env-with-docker.md) - Development environment
- [justfile.md](justfile.md) - Complete command reference
+40 -28
View File
@@ -1,53 +1,65 @@
# Code quality
The quality of the code is very important. That is why we have linters, unit tests, API
docs, in-code docs, developer docs, modular code, and have put a lot of thought into the
docs, in-code docs, developer docs, modular code, and have put a lot of thought into the
underlying architecture of both the backend and the web-frontend.
## Running linters and tests
If you have the [development environment](./development-environment.md) up and running
you can easily run the linters. Both the backend and the web-frontend have `make` files
to help.
If you have the [development environment](./running-the-dev-env-locally.md) up and running
you can easily run the linters using [just](./justfile.md) commands.
* `make format` (backend): auto format all python code using black.
* `make lint` (backend): all the python code will be checked with flake8 and black.
* `make eslint` (web-frontend): all the javascript code will be checked with eslint.
* `make stylelint` (web-frontend): all the scss code will be checked with stylelint.
**Backend (from project root or `backend/` directory):**
* `just b format`: auto format all Python code using black.
* `just b sort`: sort imports using isort.
* `just b fix`: run both format and sort.
* `just b lint`: check Python code with flake8, black, isort, and bandit.
**Frontend (from project root or `web-frontend/` directory):**
* `just f lint`: check JavaScript with eslint and SCSS with stylelint.
* `just f fix`: auto-fix code style issues.
## Running tests
There are also commands to easily run the tests.
* `make test` (backend): all the backend python code will be tested with pytest.
* `make jest` (web-frontend): all the web frontend code will be tested with jest.
* `just b test` (backend): run all backend Python tests with pytest.
* `just b test -n=auto` (backend): run tests in parallel for faster execution.
* `just f test` (frontend): run all frontend tests with Jest.
## Continuous integration
To make sure nothing was missed during development we also have a continuous
integration pipeline that runs every time a branch is pushed. All the commands explained
To make sure nothing was missed during development we also have a continuous
integration pipeline that runs every time a branch is pushed. All the commands explained
above will execute in an isolated environment. In order to improve speed
they are separated by lint and test stages. It is not allowed to merge a branch if
they are separated by lint and test stages. It is not allowed to merge a branch if
one of these jobs fails.
The pipeline also has a build job. During this job
[plugin boilerplate](../plugins/boilerplate.md) Baserow will be installed as a
[plugin boilerplate](../plugins/boilerplate.md) Baserow will be installed as a
dependency to ensure that this still works.
### Run the GitLab runners locally
### Running CI locally
If you want to check if your job would succeed before pushing your branch then you can
also run them locally. Make sure that you have installed the GitLab runner by following
the steps on https://docs.gitlab.com/runner/install/. After that you should be able to
run the `gitlab-runner --help` command in your terminal. The jobs can be executed by
running the commands below.
You can run the same checks locally before pushing:
> Make sure that you are in the root of the Baserow repository and that all changes
> have been committed because the runner checks out the current branch.
```bash
# Run all linters
just lint
* `gitlab-runner exec docker web-frontend-eslint`
* `gitlab-runner exec docker web-frontend-stylelint`
* `gitlab-runner exec docker web-frontend-test`
* `gitlab-runner exec docker backend-flake8`
* `gitlab-runner exec docker backend-pytest`
* `gitlab-runner exec docker backend-setup`
# Run all tests
just test
# Or run backend/frontend separately
just b lint && just b test
just f lint && just f test
```
For Docker-based CI testing (matches the CI environment more closely):
```bash
just ci build # Build CI images
just ci lint # Run linters in containers
just ci test # Run tests in containers
just ci run # Full CI pipeline
```
+5
View File
@@ -1,5 +1,10 @@
# ./dev.sh
> **Deprecated:** `dev.sh` is deprecated and will be removed in a future release.
> Please use `just` commands instead. See [justfile.md](justfile.md) and
> [development-environment.md](development-environment.md) for the new workflow
>
`dev.sh` is a helper bash script which makes working with baserow's development
environment a breeze.
+46 -16
View File
@@ -1,24 +1,54 @@
# Baserow's dev environment
# Baserow's Dev Environment
The dev environment runs Baserow services with source code hot reloading enabled. It
also runs the backend django server and web-frontend nuxt server in debug and
development modes. It is recommended that you use [dev.sh](../development/dev_sh.md)
found in the root of the Baserow repo.
development modes.
## Further reading
## Getting Started
- See [running the dev environment](running-the-dev-environment.md) for a
step-by-step guide on how to set-up the dev env.
- See [baserow docker api](../installation/install-with-docker.md) for more detail on how
Baserow's docker setup can be used and configured.
- See [dev.sh](dev_sh.md) for further detail on the CLI tool for managing
the dev environment.
- See [intellij setup](intellij-setup.md) for how to configure Intellij
to work well with Baserow for development purposes.
- See [feature flags](feature-flags.md) for how Baserow uses basic feature flags for
optionally enabling unfinished or unready features.
- See [vscode setup](vscode-setup.md) for how to configure Visual Studio Code
to work well with Baserow for development purposes.
Baserow offers two development approaches. Choose based on your priorities:
| Approach | Guide |
|----------|-------|
| **Docker** | [Running with Docker](running-the-dev-env-with-docker.md) |
| **Local** | [Running Locally](running-the-dev-env-locally.md) |
## Which Should I Use?
### Use Docker if you want:
- **Quick start** - Only requires Docker and `just`, no language runtimes to install
- **Consistency** - Identical environment across all machines and OSes
- **Isolation** - Dependencies contained in images, won't conflict with other projects
- **Security** - Code runs in sandboxed containers
### Use Local development if you want:
- **Speed** - Faster startup, instant hot reload, no container overhead
- **Lower resources** - No Docker daemon or container memory overhead
- **Better debugging** - Direct IDE integration, native breakpoints, no remote debugging setup
- **Simpler tooling** - Standard Python/Node workflows you already know
Both approaches use the same `just` commands and can be switched between freely.
## Quick Start
- **Docker development**: `just dc-dev up -d` - runs all services in Docker containers
- **Local development**: `just dev` - runs services natively with Docker only for db/redis
## Further Reading
- [Running with Docker](running-the-dev-env-with-docker.md) - Complete Docker setup and commands
- [Running Locally](running-the-dev-env-locally.md) - Complete local development setup
- [justfile reference](justfile.md) - All available `just` commands
- [Running tests](running-tests.md) - Testing guide
- [IntelliJ setup](intellij-setup.md) - Configure IntelliJ for Baserow development
- [VS Code setup](vscode-setup.md) - Configure VS Code for Baserow development
- [Feature flags](feature-flags.md) - Optionally enabling unfinished features
- [Baserow Docker API](../installation/install-with-docker.md) - Docker setup configuration
> **Note**: The older `dev.sh` script is deprecated. See [dev.sh](dev_sh.md) for
> documentation on the legacy script if needed.
## Fixing git blame
+28 -31
View File
@@ -1,11 +1,11 @@
# Directory structure
One of the things you will notice it that all the files and directories are in the
One of the things you will notice it that all the files and directories are in the
same repository. This makes it easier to setup a demo and development environment and
all the changes can be put in a single merge request.
In the root you will find three folders `backend`, `docs` and `web-frontend`. You will
also notice some files that are related to the whole project like an editor config
also notice some files that are related to the whole project like an editor config
file, continuous integration config, changelog, docker-compose yaml files and a readme.
In the following topics we will zoom in on the directories.
@@ -14,56 +14,53 @@ In the following topics we will zoom in on the directories.
In the backend directory you will find some files that are related only to the backend.
This whole directory is also added to the backend container.
* `requirements/base.txt`: file containing the Python packages that are needed to run
Baserow.
* `requirements/dev.txt`: file containing the Python packages that are needed for
Baserow development.
* `pyproject.toml`: Python project configuration including dependencies managed by uv.
* `uv.lock`: lockfile for reproducible dependency installation.
* `.flake8`: contains the flake8 linter configuration.
* `baserow`: is actually a python file, that just calls the management.py file in the
source directory. This file is registered as a command via the `setup.py`. When
* `baserow`: is actually a python file, that just calls the management.py file in the
source directory. This file is registered as a command via the `pyproject.toml`. When
someone adds Baserow as a dependency they can use the command `baserow migrate` which
is the same as `python src/baserow/manage.py migrate`.
* `Dockerfile`: Builds an image containing just the backend service, build with
* `Dockerfile`: Builds an image containing just the backend service, build with
`--target dev` to instead get a dev ready image.
* `Makefile`: contains a few commands to install the dependencies, run the linter and
run the tests.
* `justfile`: contains commands to install dependencies, run the linter, run tests,
and start development servers.
* `pytest.ini`: pytest configuration when running the tests.
* `setup.py`: setuptools file to install Baserow as a dependency.
### src
The src directory contains the full source code of the Baserow backend module.
* `api`: is a Django app that exposes Baserow via a REST API. Even though it is an
* `api`: is a Django app that exposes Baserow via a REST API. Even though it is an
optional app it is installed by default. It's highly recommended to use this package.
It contains several directories each with their urls, views, serializers, and errors
related to a specific part. For example, the workspaces and application both have their
own directory. There are also several modules that contain some generic classes,
It contains several directories each with their urls, views, serializers, and errors
related to a specific part. For example, the workspaces and application both have their
own directory. There are also several modules that contain some generic classes,
functions, and decorators that are reused throughout the code. The `urls.py` module
is included by the root url config under the namespace `api`.
* `config`: is a module that contains base settings and some settings that are for
specific environments. It also contains the root url config that includes the api
specific environments. It also contains the root url config that includes the api
under the namespace `api`. There is
also a wsgi.py file which can be used to expose the applications.
* `contrib`: contains extra apps that can be installed. For now it only contains the
backend part of the database plugin. This app is installed by default, but it is
optional.
* `core`: is a required app that is installed by default. It contains some abstract
concepts that are reused throughout the backend. It also contains the code for the
concepts that are reused throughout the backend. It also contains the code for the
workspace and application concepts that are at the core of Baserow. Of course there are
also helper classes, functions, and decorators that can be reused.
* `manage.py`: the Django manage.py file to execute management commands.
### tests
The tests folder contains a baserow folder which matches the directory structure of
the `src/baserow` folder. Instead of it containing the source files it contains
The tests folder contains a baserow folder which matches the directory structure of
the `src/baserow` folder. Instead of it containing the source files it contains
the tests. The files always start with `test_` to ensure they are picked up by
pytest. They always end with the name of the related file in the source directory.
There is also a fixtures directory which contains modules with classes that have small
helpers to create data. For example if you quickly want to write a test related to a
database table text field you can quickly create one by doing something like in your
database table text field you can quickly create one by doing something like in your
test.
```python
@@ -75,7 +72,7 @@ def test_something_important(data_fixture):
## web-frontend
In the web-frontend directory you will find some files that are related only to the
In the web-frontend directory you will find some files that are related only to the
web frontend. This whole directory is also added to the web-frontend container.
* `.babelrc`: contains the configuration for the babel compiler.
@@ -88,14 +85,14 @@ web frontend. This whole directory is also added to the web-frontend container.
* `intellij-idea.webpack.config.js` a webpack config file that can be used by Intellij
iDEA. It adds the correct aliases for the editor.
* `jest.config.js`: config file for running the tests with JEST.
* `Makefile`: contains a few commands to install the dependencies, run the linter, and run
* `justfile`: contains commands to install dependencies, run the linter, and run
the tests.
* `nuxt.config.js`: base Nuxt config for the development environment.
* `package.json`: main package config including all the dependencies for the
* `package.json`: main package config including all the dependencies for the
web-frontend.
* `yarn.lock`: auto generated file containing a list of the dependencies installed via
* `yarn.lock`: auto generated file containing a list of the dependencies installed via
yarn.
### config
The config directory contains some base Nuxt settings and some settings for specific
@@ -104,20 +101,20 @@ webpack.
### modules
All the modules follow the common directory structure of Nuxt. More information can be
found in the
All the modules follow the common directory structure of Nuxt. More information can be
found in the
[Nuxt documentation about the directory structure](https://nuxtjs.org/guide/directory-structure/).
### tests
At the moment there are only a few tests related to the web-frontend. Because the tests
aren't maintained at this point, the directory structure is off. The specs should be in
aren't maintained at this point, the directory structure is off. The specs should be in
the matching modules directory.
## docs
The docs folder contains markdown files with the full developer documentation of
Baserow. The contents of these files are automatically placed on
The docs folder contains markdown files with the full developer documentation of
Baserow. The contents of these files are automatically placed on
https://baserow.io/docs.
## plugin-boilerplate
+206 -37
View File
@@ -1,52 +1,221 @@
# End-to-end testing
# End-to-End Testing
Baserow comes with end-to-end test suite in the `e2e-tests` folder. The test suite
uses [Playwright](https://playwright.dev/) testing tool to run UI tests against a
running Baserow instance using one or multiple browsers.
Baserow includes an end-to-end test suite in the `e2e-tests` folder using [Playwright](https://playwright.dev/) to run UI tests against a running Baserow instance.
## When and what to e2e test
## Prerequisites
As of February 2023 the e2e test suite is brand new, we recommend you add any e2e
tests you think make sense. Some ideas on what to test:
1. Complicated multiservice UX flows like duplicating a database
2. Complicated frontend code that is hard to test with unit tests
3. The serialization boundary between the frontend client and backend api
4. Critical features that often accidentally break or features that often break in
other browsers, and we don't notice.
- **Docker** - For running the E2E environment
- **Node.js** - For running Playwright tests
- **Yarn** - Package manager
- **just** - Command runner
## Installation and running locally
See [supported.md](../installation/supported.md) for minimum version requirements.
You'll need Node.js to run the end-to-end test suite locally. Using [nvm](https://github.com/nvm-sh/nvm),
it can be installed with:
```bash
nvm install v<version>
# Verify installation
docker --version
node -v
yarn -v
just --version
```
Replace `<version>` with a supported Node.js version listed in
`baserow/docs/installation/supported.md`.
## Quick Start
To run the end-to-end tests:
```bash
# Startup your local env which will be tested
$ ./dev.sh
$ cd e2e-tests
# The below script installs the e2e test package, waits for your dev env to be healthy
# and then runs the tests.
$ ./run-e2e-tests-locally.sh
# After which you can manually re-run the tests with various manual commands:
yarn test # headless
yarn test-headed
yarn test-ui # starts the UI mode. Best way to debug you tests.
yarn codegen # Helps to generate tests directly in a browsers. Use it as inspiration;
# the skeleton can be used, but some of its generated code is bad.
# Tweak it yourself after use.
# Full E2E cycle: build images, start environment, run tests, stop
just e2e run
# Or step by step:
just e2e build # Build CI images
just e2e up # Start E2E environment
just e2e test # Run tests
just e2e down # Stop and cleanup
```
`yarn test` and `yarn test-*` will run all tests in Chrome.
Access during testing:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
## Commands Reference
| Command | Description |
|---------|-------------|
| `just e2e build` | Build backend and frontend CI images |
| `just e2e up` | Start E2E environment (db, redis, backend, frontend) |
| `just e2e down` | Stop and remove all E2E containers |
| `just e2e test` | Run all E2E tests |
| `just e2e test <args>` | Run tests with Playwright arguments |
| `just e2e run` | Full cycle: build, up, test, down |
| `just e2e logs` | View all container logs |
| `just e2e logs <service>` | View logs for specific service |
| `just e2e db-dump` | Generate fresh database dump |
| `just e2e db-restore <container>` | Restore dump to a container |
## Examples
### Running Specific Tests
```bash
# Run a specific test file
just e2e test tests/auth/login.spec.ts
just e2e test tests/database/search.spec.ts
# Run all tests in a directory
just e2e test tests/database/
just e2e test tests/builder/
# Run tests matching a pattern
just e2e test --grep "login"
# Run in headed mode (see the browser)
just e2e test --headed
# Run in UI mode (interactive debugging)
just e2e test --ui
# Run only in Chrome
just e2e test --project=chromium
```
### Viewing Logs
```bash
# All logs
just e2e logs
# Specific service
just e2e logs backend
just e2e logs frontend
just e2e logs db
just e2e logs celery
```
### Debugging Failed Tests
```bash
# Start environment without running tests
just e2e up
# Run tests in UI mode for debugging
just e2e test --ui
# Or run specific failing test with trace
just e2e test tests/mytest.spec.ts --trace on
# Keep environment running for manual inspection
# Access http://localhost:3000 in your browser
```
### Regenerating Database Dump
When migrations change, regenerate the E2E database dump:
```bash
# Generate new dump with latest migrations
just e2e db-dump
# Commit the updated dump
git add e2e-tests/fixtures/e2e-db.dump
git commit -m "Update E2E database dump"
```
## How It Works
The E2E environment uses:
1. **Pre-built CI images** - Backend and frontend built with test dependencies
2. **Database dump** - Pre-migrated database restored on startup (fast)
3. **tmpfs storage** - PostgreSQL and Redis run in-memory for speed
4. **Isolated network** - All containers on `baserow-e2e` network
### Container Architecture
```
┌─────────────────────────────────────────────────────────┐
│ baserow-e2e network │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌─────────┐ │
│ │ e2e-db │ │e2e-redis │ │e2e-backend│ │e2e-celery│ │
│ │ (tmpfs) │ │ (tmpfs) │ │ :8000 │ │ │ │
│ └──────────┘ └──────────┘ └──────────┘ └─────────┘ │
│ │ │
│ ┌──────────────┐ │
│ │ e2e-frontend │ │
│ │ :3000 │ │
│ └──────────────┘ │
└─────────────────────────────────────────────────────────┘
│
Playwright tests
```
## When to Write E2E Tests
Consider adding E2E tests for:
1. **Multi-service UX flows** - Like duplicating a database
2. **Complex frontend interactions** - Hard to test with unit tests
3. **API serialization boundaries** - Frontend-backend integration
4. **Critical features** - Features that often break across browsers
5. **Cross-browser issues** - Browser-specific bugs
## Configuration
Besides Playwright configuration defined in `e2e-tests/playwright.config.ts` you can set
environment variables to target a Baserow instance on any URL
with `PUBLIC_WEB_FRONTEND_URL` and `PUBLIC_BACKEND_URL`. You can also
use `e2e-tests/.env` file to do so, see `e2e-tests/.env-example`.
### Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| `PUBLIC_WEB_FRONTEND_URL` | Frontend URL for tests | `http://localhost:3000` |
| `PUBLIC_BACKEND_URL` | Backend API URL for tests | `http://localhost:8000` |
You can set these in `e2e-tests/.env` (see `.env-example`).
### Playwright Configuration
See `e2e-tests/playwright.config.ts` for:
- Browser configuration
- Test timeouts
- Retry settings
- Reporter configuration
## Writing Tests
### Test Generation
Playwright can help generate test skeletons:
```bash
cd e2e-tests
yarn codegen
```
This opens a browser where your actions are recorded as test code. Use it as a starting point, but clean up the generated code.
### Best Practices
1. Use page object patterns for reusable components
2. Wait for elements explicitly rather than using timeouts
3. Use data-testid attributes for reliable selectors
4. Clean up test data after tests when possible
---
## Deprecated: Old Workflow
> **Note:** The commands below are deprecated. Use `just e2e` commands instead.
### Old Installation
```bash
# Using dev.sh (deprecated)
./dev.sh
cd e2e-tests
./run-e2e-tests-locally.sh
# Manual yarn commands still work if environment is running:
yarn test # headless
yarn test-headed # see browser
yarn test-ui # interactive debugging
yarn codegen # generate test code
```
These still work but require manually managing the dev environment. The new `just e2e` commands handle everything automatically.
+5 -5
View File
@@ -10,14 +10,14 @@ Add/remove features flags to the list below:
## Enabling feature flags
To enable specific feature flags set the environment variable
`FEATURE_FLAGS=feature1,feature2,feature3`. Using `dev.sh` this would look like:
`FEATURE_FLAGS=feature1,feature2,feature3`. Using `just` this would look like:
```bash
FEATURE_FLAGS=feature1,feature2,feature3 ./dev.sh xyz
FEATURE_FLAGS=feature1,feature2,feature3 just dc-dev up -d
```
You could also use a docker-compose `.env` file and set the FEATURE_FLAGS variable in
there.
You could also add the variable to your `.env.docker-dev` file (for Docker development)
or `.env.local` file (for local development).
## Enabling all feature flags
@@ -25,7 +25,7 @@ Use the `*` feature flag to enable every single feature flag without having to s
each one.
```bash
FEATURE_FLAGS=* ./dev.sh xyz
FEATURE_FLAGS=* just dc-dev up -d
```
## Naming convention
+32 -35
View File
@@ -7,6 +7,14 @@ automatic style fixers to make your life as easy as possible.
> This guide assumes you have a basic understanding of git, python, virtualenvs,
> postgres and command line tools.
## Prerequisites
Install the following tools:
- [just](https://github.com/casey/just) - command runner
- [uv](https://github.com/astral-sh/uv) - Python package manager
## Setup Steps
1. First checkout a fresh copy of Baserow: `git clone git@github.com:baserow/baserow.git`
1. `cd baserow`
1. `./config/intellij/apply_standard_baserow_intellij_config.sh`
@@ -15,56 +23,45 @@ automatic style fixers to make your life as easy as possible.
and open the baserow folder you cloned above.
1. Make sure you have installed / enabled the
[Python IntelliJ plugin](https://plugins.jetbrains.com/plugin/631-python).
1. Now we will create python virtualenv and configure IntelliJ to use it to run tests
1. Now we will create a Python virtual environment and configure IntelliJ to use it to run tests
and linters:
1. Choose a location for your virtualenv, it is recommended to store it separately
from the baserow source-code folder so IntelliJ does not search nor index it.
2. Create the virtualenv: `python3 -m venv venv` or `virtualenv -p python venv`
3. Activate the virtualenv: `source venv/bin/activate` (will differ depending on
your shell)
4. Run `which pip` and ensure the output of this command is now pointing into the
bin in your new virtualenv
5. Change to the Baserow source directory: `cd path/to/your/baserow`
6. Install all the Baserow python requirements into your virtualenv:
1. Initialize the backend (creates venv and installs dependencies):
```bash
pip install -r backend/requirements/dev.txt
pip install -r backend/requirements/base.txt
just b init
```
7. Now back in Intellij, press F4 or right-click on the top level baserow folder and
This creates a virtualenv at `.venv/` in the project root.
2. Now back in Intellij, press F4 or right-click on the top level baserow folder and
select `module settings`:
1. Make sure the `backend` module SDK is set to the python virtualenv you just
made.
1. There will most likely be an existing `Python 3.8 (baserow)` virtualenv SDK
made (`.venv/bin/python`).
1. There will most likely be an existing `Python 3.11 (baserow)` virtualenv SDK
which is red. Delete this first.
1. Then you will most likely need to add it as a new SDK by navigating to
1. F4 → SDK
1. click +
1. Add New Python SDK
1. Existing Interpreter
1. Find and select your virtualenvs `bin/python` executable
1. call this new SDK `Python 3.8 (baserow)` so you don't make an accidental
the `backend.iml` file:
1. Find and select your virtualenvs `bin/python` executable (`.venv/bin/python`)
1. call this new SDK `Python 3.11 (baserow)` so you don't make an accidental
change to the `backend.iml` file:
1. Install and get a postgresql database running locally:
1. [https://www.postgresql.org/docs/11/tutorial-install.html](https://www.postgresql.org/docs/11/tutorial-install.html)
2. Change the default postgres port otherwise it will clash when running with
Baserow (the default IntelliJ config in the repo assumes your testing db is
running on 5430)
1. [https://stackoverflow.com/questions/187438/change-pgsql-port](https://stackoverflow.com/questions/187438/change-pgsql-port)
3. Create a baserow user called `baserow` with the password `baserow` and give them
permission to create databases
1. [https://medium.com/coding-blocks/creating-user-database-and-adding-access-on-postgresql-8bfcd2f4a91e](https://medium.com/coding-blocks/creating-user-database-and-adding-access-on-postgresql-8bfcd2f4a91e)
```sql
CREATE USER baserow WITH ENCRYPTED PASSWORD 'baserow';
ALTER USER baserow CREATEDB;
```
4. You might also have to `pip install psycopg2-binary` or
`sudo apt install postgresql-devel`
1. The easiest way is to use Docker:
```bash
just dc-dev up -d db redis
```
2. Or install PostgreSQL locally:
[https://www.postgresql.org/docs/11/tutorial-install.html](https://www.postgresql.org/docs/11/tutorial-install.html)
3. If running PostgreSQL locally, create a baserow user:
```sql
CREATE USER baserow WITH ENCRYPTED PASSWORD 'baserow';
ALTER USER baserow CREATEDB;
```
1. Now you should be able to run the backend python tests, try
run `backend/tests/baserow/core/test_core_models.py` for instance.
1. Now lets set up your frontend dev by changing directory to `baserow/web-frontend`
1. Now run `yarn install` (if you do not have yarn available check out and install a
node version manager like [nvm](https://github.com/nvm-sh/nvm) and follow the
1. Now run `just f install` (or `yarn install` directly). If you do not have yarn available
check out and install a node version manager like [nvm](https://github.com/nvm-sh/nvm) or
[fnm](https://github.com/Schniz/fnm) and follow the
[Yarn installation instructions](https://yarnpkg.com/getting-started/install)).
See `baserow/docs/installation/supported.md` to determine the supported version of
Node.js to use.
+126
View File
@@ -0,0 +1,126 @@
# Justfile Command Reference
Baserow uses [just](https://github.com/casey/just) as a command runner. Commands are organized in three justfiles:
- **Root** (`/justfile`) - Docker Compose and orchestration commands
- **Backend** (`/backend/justfile`) - Python/Django commands using [uv](https://github.com/astral-sh/uv)
- **Frontend** (`/web-frontend/justfile`) - Node/Nuxt commands using yarn
## Discovering Commands
Use `just` built-in help to explore all available recipes:
```bash
# List all commands (grouped by category)
just --list
# Show getting started guide
just help
# List backend commands
just b --list
# or
cd backend && just --list
# List frontend commands
just f --list
```
Each recipe includes a description. Use `just --list` frequently to discover new commands.
## Installation
```bash
# macOS
brew install just uv
# Linux
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/.local/bin
curl -LsSf https://astral.sh/uv/install.sh | sh
```
## Essential Commands
### First Time Setup
```bash
just init # Install backend + frontend dependencies, create .env.local
```
### Local Development
```bash
just dev up # Start everything (db, redis, backend, celery, frontend)
just dev up -d # Start in background
just dev stop # Stop all services
just dev logs # View logs
just dev ps # Show the running processes + containers (db, redis)
```
### Docker Development
```bash
just dc-dev up -d # Start dev containers
just dcd logs -f # Follow logs (dcd as alias of dc-dev)
just dcd exec backend bash # Shell into container
just dcd down # Stop containers
just dcd ps # SHow running containers
```
### Running Commands
```bash
# Backend (from root)
just b test # Run backend tests
just b lint # Lint backend
just b shell # Django shell
just b migrate # Run migrations
just b manage <cmd> # Any manage.py command
# Frontend (from root)
just f test # Run frontend tests
just f lint # Lint frontend
```
### Code Quality
```bash
just lint # Lint all (backend + frontend)
just fix # Auto-fix style issues
just test # Run all tests
```
### Testing with Ramdisk Database
For faster tests, use an in-memory PostgreSQL:
```bash
just test-db up # Start ramdisk db on port 5433
DATABASE_URL=postgres://baserow:baserow@localhost:5433/baserow just b test -n=auto
just test-db down # Stop ramdisk db
just test-db ps # Check status
```
## Environment Files
| File | Purpose |
|------|---------|
| `.env` | Production setup (created from `.env.example`) |
| `.env.local` | Local development (created by `just init`) |
| `.env.docker-dev` | Docker development (created by `just dc-dev`) |
## Personal Recipes
Create `local.just` for your own shortcuts (gitignored):
```bash
cp local.just.example local.just
```
Your recipes will appear in `just --list` alongside standard recipes.
## Further Reading
- [Running with Docker](running-the-dev-env-with-docker.md)
- [Running Locally](running-the-dev-env-locally.md)
- [Running Tests](running-tests.md)
+4 -1
View File
@@ -25,7 +25,10 @@ HONEYCOMB_API_KEY=YOUR_KEY
BASEROW_ENABLE_OTEL=true
```
6. `./dev.sh restart`
6. Restart the dev environment:
```bash
just dc-dev restart
```
7. Go to your honeycomb environment and you should start seeing new datasets being
created!
+109 -46
View File
@@ -2,68 +2,131 @@
## Backend
To run backend tests, start and attach to the backend container as described in
[running-the-dev-environment.md](running-the-dev-environment.md). Once inside
the container, execute `make test` or `make test-parallel` to run the tests.
### Quick Start
The tests use the `config.settings.tests` configuration, which sets base
variables and ignores environment variables in the `.env` file. The `.env` file
is intended for production or development mode.
```bash
# From project root
just b test # Run all tests
just b test -n=auto # Run tests in parallel
just b test tests/path/ # Run specific tests
### Customize Test Settings
You can customize test settings by creating a `.env.testing` file in the
backend directory. For example:
```env
# backend/.env.testing
BASEROW_MAX_FIELD_LIMIT=1
# With ramdisk database (2-5x faster)
just test-db start # Start PostgreSQL with tmpfs
DATABASE_URL=postgres://baserow:baserow@localhost:5433/baserow just b test -n=auto
```
### Migrations and database setup
### Test Settings
By default, `BASEROW_TESTS_SETUP_DB_FIXTURE` is considered `on` in the
`config.settings.tests` configuration. This means that the database will be
set up without running the migrations, but only installing the database
formulas needed for the tests. This is done to speed up the test setup
process.
Test settings (`baserow/config/settings/test.py`) are designed for consistency and portability:
If you want to run the migrations, you can run
`BASEROW_TESTS_SETUP_DB_FIXTURE=off pytest` to run them all. This is useful
when you want to test the migrations and you don't care about the speed of
the test setup.
- **DATABASE_\* and REDIS_\*** vars can be passed via environment variables
- **All other settings** are hardcoded in test.py to ensure consistent test behavior
- **Optional TEST_ENV_FILE** can load settings from a file
If you want to install the custom formula pgSQL functions only once and then
reuse the database between tests, you can run
`BASEROW_TESTS_SETUP_DB_FIXTURE=off pytest --no-migrations --reuse-db`.
This allows tests to run identically inside Docker and locally.
You can even omit `--no-migrations` to apply any new migrations coming from
the current branch to avoid recreating the database from scratch.
### Docker vs Local Development
All backend justfile commands (`just test`, `just lint`, etc.) work identically inside and outside Docker containers. The test settings are designed to be portable.
### Running Tests Outside the Backend Container
| Command | Host | Container | Notes |
|---------|:----:|:---------:|-------|
| `just b test` | ✓ | ✓ | Works in both environments |
| `just b lint` | ✓ | ✓ | Works in both environments |
| `just test-db start` | ✓ | ✗ | Host only (starts a Docker container) |
| `just test-db stop` | ✓ | ✗ | Host only |
To run tests outside the backend container, follow these steps:
**Note:** The `just test-db start` command starts a separate PostgreSQL container with tmpfs storage. This can only be run from the host machine, not from inside a container. When running tests inside the backend container, use the existing `db` service instead.
1. Create a Python virtual environment. See [supported](../installation/supported.md)
to determine the supported version of Python.
2. From the backend directory, install the required packages with
`pip install requirements/base.txt` and `pip install requirements/dev.txt`.
3. Set environment variables to connect to the database. Create a
`.env.testing-local` file in the backend directory. At a minimum, set
`DATABASE_HOST` to `localhost` since the default value of `db` is only valid
inside the docker network.
#### Running Tests Locally
```env
# backend/.env.testing-local
Pass database connection via environment variable:
```bash
# Using DATABASE_URL
DATABASE_URL=postgres://baserow:baserow@localhost:5432/baserow just b test
# Or individual variables
DATABASE_HOST=localhost DATABASE_PORT=5432 just b test
```
#### Running Tests in Docker
Inside the container, the default settings work out of the box:
```bash
just dcd up -d db backend
just dcd exec backend bash
j test
# Or directly
just dcd up -d db backend && just dcd exec backend "just test -n auto"
```
#### Using an Environment File
For complex configurations, use a file:
```bash
# Create .env.testing-local (gitignored)
cat > .env.testing-local << 'EOF'
DATABASE_HOST=localhost
DATABASE_PORT=5432
REDIS_HOST=localhost
# Any other env var customization here
EOF
# Run tests with file
TEST_ENV_FILE=.env.testing-local just b test
```
4. Export the `TEST_ENV_FILE` variable to specify the environment file:
### Ramdisk Database for Fast Tests
```sh
export TEST_ENV_FILE='.env.testing-local'
Use a PostgreSQL container with tmpfs (in-memory storage) for 2-5x faster tests:
```bash
# Start ramdisk database on port 5433
just test-db up
# Run tests against it
DATABASE_URL=postgres://baserow:baserow@localhost:5433/baserow just b test -n=auto
# Stop when done
just test-db down
# Check status
just test-db ps
```
5. Run `make test` or `make test-parallel` from your shell outside the
containers in the backend directory.
**Configuration**: Set `TEST_DB_PORT` environment variable to use a different port (default: 5433).
The ramdisk database (`baserow-test-db` container using `pgvector/pgvector:pg13`) runs with optimized settings:
- **tmpfs storage**: All data in RAM (8GB allocated)
- **Large shared_buffers**: 512MB for better caching
- **Disabled fsync/WAL**: No durability overhead
- **Disabled autovacuum**: No background maintenance
### Migrations and Database Setup
By default, `BASEROW_TESTS_SETUP_DB_FIXTURE=on` skips migrations and only installs required pgSQL functions. This speeds up test setup significantly.
```bash
# Run with full migrations (slower, useful for testing migrations)
BASEROW_TESTS_SETUP_DB_FIXTURE=off just b test
# Reuse database between test runs (fastest for iterative development)
just b test --reuse-db
# Apply new migrations to existing test database
BASEROW_TESTS_SETUP_DB_FIXTURE=off just b test --no-migrations --reuse-db
```
### Test Commands Reference
| Command | Description |
|---------|-------------|
| `just b test` | Run all tests |
| `just b test -n=auto` | Run tests in parallel |
| `just b test tests/path/` | Run specific tests |
| `just b test-coverage` | Run tests with coverage report |
| `just b test-builder` | Run builder-specific tests |
| `just b test-automation` | Run automation-specific tests |
@@ -0,0 +1,433 @@
# 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
1. **Docker** - For running PostgreSQL, Redis, and other services
- Install from https://docs.docker.com/desktop/
2. **just** - Command runner
```bash
# macOS
brew install just
# Linux
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/.local/bin
```
3. **Python 3.11** - For the backend
```bash
# macOS
brew install python@3.11
# Linux (Ubuntu/Debian)
sudo apt install python3.11 python3.11-dev
```
4. **uv** - Fast Python package manager
```bash
# macOS
brew install uv
# Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
```
5. **Node.js 24** - For the frontend
```bash
# 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@24
```
6. **Yarn** - Frontend package manager
```bash
npm install -g yarn
```
7. **Git** - Install from https://git-scm.com/downloads
See [supported.md](../installation/supported.md) for minimum version requirements.
### Verify Installation
```bash
docker -v
just --version
python3 --version
uv --version
node -v
yarn -v
git --version
```
## Quick Start
```bash
# 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:
```bash
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:
1. **Docker services**: PostgreSQL, Redis, Mailhog, OpenTelemetry collector
2. **Database migrations**: Applied automatically
3. **Backend server**: Django development server on port 8000
4. **Celery workers**: Background task processing (main, export, beat scheduler)
5. **Frontend server**: Nuxt development server on port 3000
```
just dev up
├── Docker: db, redis, mailhog, otel-collector
├── Backend: Django dev server (port 8000)
├── Celery: main worker + export worker + beat scheduler
└── 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.example`:
```bash
# 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](../installation/configuration.md) 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/`:
```bash
# 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
```bash
# From project root (just f is shorthand for just frontend)
just f lint # Run ESLint + Stylelint
just f test # Run Jest 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:
```bash
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
```bash
# 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
```bash
just dc-dev up -d db redis mailhog
```
### 2. Initialize Backend
```bash
cd backend
just init # Creates venv, installs deps
just migrate # Apply migrations
```
### 3. Run Backend Server
```bash
cd backend
just run-dev-server
```
### 4. Run Celery Workers (separate terminal)
```bash
cd backend
just run-dev-celery
```
### 5. Initialize and Run Frontend (separate terminal)
```bash
cd web-frontend
just install # Install node_modules
just run-dev-server # Start Nuxt dev server
```
## Running Tests
### Backend Tests
```bash
# 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:
```bash
# 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
```bash
just f test # Run Jest tests
just f test --watch # Watch mode
```
## Database Operations
### Running Migrations
```bash
just b migrate
# or
just b m migrate
```
### Creating Migrations
```bash
just b m makemigrations
just b m makemigrations core # Specific app
```
### Creating a Superuser
```bash
just b m createsuperuser
```
### Syncing Templates
Templates (example databases, forms, etc.) are not synced by default for faster startup:
```bash
just b m sync_templates
```
### Accessing the Database
```bash
# Django database shell
just b m dbshell
# Direct PostgreSQL (via Docker)
just dc-dev exec db psql -U baserow
```
### Resetting the Database
```bash
# 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:
```python
# Add breakpoint in your code
breakpoint() # or: import pdb; pdb.set_trace()
```
For VS Code, add to `.vscode/launch.json`:
```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
```bash
# Run with debug logging
CELERY_LOG_LEVEL=DEBUG just b run-dev-celery
```
## Troubleshooting
### "Module not found" Errors
```bash
just b uv sync
just f yarn
```
### Database Connection Errors
```bash
# 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
```bash
# 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 Crashes on macOS
The justfile defaults to `solo` pool on macOS to avoid fork() issues:
```bash
# Force a different pool if needed
CELERY_POOL=threads just b run-dev-celery
```
### Frontend Build Errors
```bash
# 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](justfile.md) - Complete command reference
- [running-tests.md](running-tests.md) - Detailed testing guide
- [running-the-dev-env-with-docker.md](running-the-dev-env-with-docker.md) - Alternative: Docker development
- [vscode-setup.md](vscode-setup.md) - VS Code configuration
- [intellij-setup.md](intellij-setup.md) - IntelliJ/PyCharm configuration
@@ -0,0 +1,320 @@
# Running the Dev Environment with Docker
This guide covers running the Baserow development environment using Docker. This is the recommended approach for most developers as it requires minimal local setup and ensures a consistent environment.
## Prerequisites
### Required Tools
1. **Docker** - Install from https://docs.docker.com/desktop/ or similar alternatives. Allocate at least 4GB RAM (8GB recommended).
2. **Git** - Install from https://git-scm.com/downloads
3. **just** - Command runner
```bash
# macOS
brew install just
# Linux
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/.local/bin
```
See [supported.md](../installation/supported.md) for minimum version requirements.
### Verify Installation
```bash
docker -v
docker compose version
git --version
just --version
```
## Quick Start
```bash
# Clone the repository
git clone --branch develop https://github.com/baserow/baserow.git
cd baserow
# Build and start the dev environment
just dc-dev up -d
# View logs (Ctrl+C to stop following)
just dc-dev logs -f
```
Once started, access:
- **Frontend**: http://localhost:3000
- **Backend API**: http://localhost:8000
- **API Docs**: http://localhost:8000/api/redoc/
## How It Works
The Docker dev environment runs these services:
| Service | Description | Port |
|---------|-------------|------|
| `web-frontend` | Nuxt.js frontend with hot reload | 3000 |
| `backend` | Django API server with hot reload | 8000 |
| `celery` | Background task worker | - |
| `celery-export-worker` | Export-specific worker | - |
| `celery-beat-worker` | Scheduled task runner | - |
| `db` | PostgreSQL database | 5432 |
| `redis` | Redis cache and message broker | 6379 |
| `caddy` | Reverse proxy for media files | 4000 |
| `mailhog` | Email testing UI | 8025 |
| `mjml-email-compiler` | MJML to HTML email compiler | 28101 |
| `otel-collector` | OpenTelemetry metrics | 4317 |
| `volume-permissions-fixer` | Fixes media file permissions on startup | - |
| `web-frontend-storybook` | Component development UI | 6006 |
| `celery-flower` | Celery task monitoring | 5555 |
### Docker Compose Files
- `docker-compose.yml` - Base configuration (production-like)
- `docker-compose.dev.yml` - Development overrides (hot reload, volume mounts, dev settings)
The `just dc-dev` command combines both files automatically.
## Common Commands
Shortcuts: `dcd` = `dc-dev`, `a` = `dc-attach`, `dct` = `dc-dev tabs`
### Starting and Stopping
```bash
# Start all services (detached)
just dc-dev up -d # or: just dcd up -d
# Stop all services (preserves data)
just dc-dev stop
# Stop and remove containers (preserves volumes)
just dc-dev down
# Stop and remove everything including volumes (clean slate)
just dc-dev down -v
```
### Viewing Logs
```bash
# All logs
just dc-dev logs
# Follow logs in real-time
just dc-dev logs -f
# Specific services
just dc-dev logs backend
just dc-dev logs web-frontend
just dc-dev logs celery
# Last 100 lines of backend
just dc-dev logs -n 100 backend
```
### Running Commands in Containers
```bash
# Open a shell in a container
just a # Interactive container picker
just a backend # Direct shell into backend
just a celery # Interactive container picker, filtered
just dc-dev exec backend bash # Alternative
# Run Django management commands
just dc-dev exec backend python manage.py migrate
just dc-dev exec backend python manage.py createsuperuser
just dc-dev exec backend python manage.py shell_plus
# Run tests inside the container
just dc-dev exec backend just test
just dc-dev exec web-frontend yarn test
```
### Terminal Tabs and Tmux
```bash
# Open terminal tabs for each service (like the old dev.sh)
just dc-dev tabs # or: just dct
# Start a tmux session with all services
just dc-dev tmux
```
### Building Images
```bash
# Build all images
just dc-dev build --parallel
# Build specific service
just dc-dev build backend
# Build without cache (when things go wrong)
just dc-dev build --no-cache --parallel
# Clear Docker builder cache completely
# WARNING: This clears ALL Docker builder cache, not just Baserow!
just prune
```
### Restarting Services
```bash
# Restart a specific service
just dc-dev restart backend
# Rebuild and restart (after Dockerfile changes)
just dc-dev up -d --build backend
# Force recreate containers
just dc-dev up -d --force-recreate
```
## Optional Services
By default, all services including optional ones are started:
| Service | Description | Port |
|---------|-------------|------|
| `web-frontend-storybook` | Component development UI | 6006 |
| `celery-flower` | Celery task monitoring | 5555 |
This is controlled by the `COMPOSE_PROFILES` variable in `.env.docker-dev`:
```bash
# Default: start all services including optional ones
COMPOSE_PROFILES=optional
# To disable optional services (save resources), set to empty:
COMPOSE_PROFILES=
```
After changing this setting, restart the services:
```bash
just dc-dev down
just dc-dev up -d
```
## Hot Reloading
Both frontend and backend support hot reloading:
- **Frontend**: Changes to `.vue`, `.js`, `.scss` files trigger automatic browser refresh
- **Backend**: Changes to `.py` files trigger automatic server restart
You don't need to restart containers when editing code.
### When to Rebuild
You need to rebuild images when:
- `Dockerfile` changes
- `package.json` or `yarn.lock` changes (frontend)
- `pyproject.toml` or `uv.lock` changes (backend)
```bash
just dc-dev build --parallel
just dc-dev up -d
```
## Database Operations
### Running Migrations
```bash
just dc-dev exec backend python manage.py migrate
```
### Creating a Superuser
```bash
just dc-dev exec backend python manage.py createsuperuser
```
### Accessing the Database
```bash
# PostgreSQL shell
just dc-dev exec db psql -U baserow
# From backend container
just dc-dev exec backend python manage.py dbshell
```
### Resetting the Database
```bash
# Stop services, remove volumes, restart
just dc-dev down -v
just dc-dev up -d
```
## Environment Configuration
### Environment Files
The `just dc-dev` command uses `.env.docker-dev` to define the environment variables used by the `dev` containers.
This file is automatically created from `.env.docker-dev.example` if it doesn't exist.
### Customizing Settings
Look at [Configuration](../installation/configuration.md) to customize your `.env.docker-dev`.
### UID/GID for File Permissions
The dev containers run as your host user to avoid permission issues with mounted files:
```bash
# These are set automatically by just dc-dev
UID=$(id -u)
GID=$(id -g)
```
## Troubleshooting
### Container Won't Start
```bash
# Check container status
just dc-dev ps
# View logs for failing service
just dc-dev logs backend
# Rebuild from scratch
just dc-dev down -v
just prune
just dc-dev build --no-cache --parallel
just dc-dev up -d
```
### Slow Performance on macOS
Docker on macOS can be slow with volume mounts. Try:
1. Increase Docker Desktop resources (CPU, RAM)
2. Use Docker's VirtioFS file sharing (Docker Desktop settings)
3. Consider [local development](running-the-dev-env-locally.md) for faster iteration
### Database Connection Errors
```bash
# Ensure db is running and healthy
just dc-dev ps db
# Wait for database to be ready
just dc-dev exec db pg_isready -U baserow
# Check database logs
just dc-dev logs db
```
## Further Reading
- [justfile.md](justfile.md) - Complete command reference
- [running-tests.md](running-tests.md) - Running tests in Docker
- [running-the-dev-env-locally.md](running-the-dev-env-locally.md) - Alternative: local development
- [vscode-setup.md](vscode-setup.md) - VS Code configuration
- [intellij-setup.md](intellij-setup.md) - IntelliJ/PyCharm configuration
@@ -1,154 +0,0 @@
# Running the dev environment
If you want to contribute to Baserow you need to setup the development environment on
your local computer. The best way to do this is via `docker-compose` so that you can
start the app with the least amount of hassle.
### Quickstart
If you are familiar with git and docker-compose run these commands to launch Baserow's
dev environment locally, otherwise please start from the Installing Requirements section
below.
```bash
$ git clone --branch develop git@github.com:baserow/baserow.git
# Our supplied ./dev.sh script wraps docker-compose setting the correct env vars for
# you to get hot code reloading working well.
$ ./dev.sh
# Run ./dev.sh help for further details.
$ ./dev.sh help
```
## Installing requirements
If you haven't already installed docker and docker-compose on your computer you can do
so by following the instructions on https://docs.docker.com/desktop/ and
https://docs.docker.com/compose/install/.
> Docker version 19.03 is the minimum required to build Baserow. It is strongly
> advised however that you install the latest version of Docker available.
> Please check that your docker is up to date by running `docker -v`.
You will also need git installed which you can do by following the instructions on
https://www.linode.com/docs/development/version-control/how-to-install-git-on-linux-mac-and-windows/
.
Once you have finished installing all the required software you should be able to run
the following commands in your terminal.
```bash
$ docker -v
Docker version 20.10.6, build 370c289
$ docker-compose -v
docker-compose version 1.26.2, build eefe0d31
$ git --version
git version 2.24.3 (Apple Git-128)
```
If all commands return something similar as described in the example, then you are ready
to proceed!
## Starting the dev environment
> If you run into any issues starting your development environment feel free to contact
> us via the form on https://baserow.io/contact.
For example purposes I have created a directory in my home folder named `baserow`. You
can of course follow the steps in any directory, but in this tutorial I will assume the
working directory is `~/baserow`.
First we have to clone the repository. Execute the following commands to clone the
master branch. If you are not familiar with git clone, this will download a copy of
Baserow's code to your computer.
```
$ cd ~/baserow
$ git clone --branch master https://github.com/baserow/baserow.git
Cloning into 'baserow'...
...
$ cd baserow
```
Now that we have our copy of the repo and have changed directories to the newly
created `baserow`, we can bring up the containers. You just have to execute the
docker-compose command using the `docker-compose.yml` file. It might take a while for
the command to finish, this is because the images have to be built from scratch.
```
$ ./dev.sh
Building backend
...
Starting db ... done
Starting redis ... done
Starting backend ... done
Starting web-frontend ... done
```
Your dev environment is now running, the database has been automatically migrated for
you and the baserow templates have been synced. You can now visit http://localhost:3000
to sign up and login to your Baserow.
## Looking at the web api
Baserow's backend container exposes a rest API. Find the API spec for your local version
of Baserow at http://localhost:8000/api/redoc/ . To check that it is working correctly
when you visit http://localhost:8000/api/workspaces/ in a browser you should see the error
"Authentication credentials were not provided." as no JWT was provided.
## Attaching to the dev environment
The dev environment consists of a number of docker containers, see:
If you use `./dev.sh` by default it will attempt to open tabs in your terminal and
attach to the running baserow containers. Otherwise you can do so manually by running
the following commands:
```bash
$ # Run the commands below to connect to the various different parts of Baserow
$ docker attach backend
$ docker attach celery
$ docker attach web-frontend
```
When attached you can press CTRL-C to end the current containers main process. However
unlike normal docker containers this one will not exit immediately but instead present
you with a bash terminal. In this terminal you can then run any admin commands you wish
or inspect the state of the containers. Simply press up and go through the containers
bash history to get the original command to restart the containers main process.
## Other useful commands
Below is a quick example of some of the more common useful operations and commands:
```bash
$ # View the logs
$ docker-compose logs
$ # Migrate
$ ./dev.sh run backend manage migrate
$ # Restart and Build
$ ./dev.sh restart --build
```
## Keep the servers running
Both the web-frontend and backend containers need to keep running while you are
developing. They also monitor file changes and update automatically, so you don't need
to worry about reloading. Go and make some changes yourself. You should see the result
right away.
## Working with Docker and Django
For further reading on how to work with docker containers and django check out:
- [django's getting started tutorial](https://docs.djangoproject.com/en/3.1/intro/tutorial01/)
- [docker's getting started tutorial](https://docs.docker.com/get-started/)
- [docker's cli reference](https://docs.docker.com/engine/reference/run/)
- [docker composes reference](https://docs.docker.com/compose/)
## Baserow further reading
- See [introduction](../technical/introduction.md) for more details on Baserow's
architecture.
- See [baserow docker api](../installation/install-with-docker.md) for more detail on how
Baserow's docker setup can be used and configured.
- See [dev.sh](dev_sh.md) for further detail on what dev.sh does and why
+30 -25
View File
@@ -29,11 +29,12 @@ https://www.django-rest-framework.org/
We use pytest to easily and automatically test all the python code. Most of the backend
code is covered with tests and we like to keep it that way! The code is also tested
in the [continuous integration pipeline](./code-quality.md). It can also be tested
manually in the development environment. Make sure that you are in the `backend`
container and execute the following command.
manually in the development environment:
```
$ make test
```bash
just b test # Run all tests
just b test -n=auto # Run tests in parallel
just b test tests/path/ # Run specific tests
```
https://docs.pytest.org/en/latest/contents.html
@@ -41,13 +42,13 @@ https://docs.pytest.org/en/latest/contents.html
### Flake8
Flake8 makes it easy to enforce our python code style. The code is checked in the
continuous integration pipeline. It can also be checked manually in the development
environment. Make sure that you are in the `backend` container and execute the
following command. If all the code meets the standards you should not see any output.
continuous integration pipeline. It can also be checked manually:
```bash
just b lint
```
$ make lint
```
If all the code meets the standards you should not see any output.
https://flake8.pycqa.org/en/latest/
@@ -59,8 +60,8 @@ writing and reviewing code.
https://black.readthedocs.io/en/stable/index.html
```
make format
```bash
just b format
```
### Internationalization
@@ -69,13 +70,14 @@ For internationalization (i18n), we leverage Django's built-in support. Django's
To use Django's internationalization features, we wrap our text with a special function called `gettext` or `gettext_lazy`.
For more information, refer to the [Django Internationalization and Localization documentation](https://docs.djangoproject.com/en/3.2/topics/i18n/).
Then, we created a Makefile command to collect or update all these strings into a message file.
```
make translations
To collect or update all translation strings into a message file:
```bash
just b make-translations
```
This will call the Django's `makemessages` command for the English language of all the installed applications. The creation of the messages for the other languages and the step to compile all these messages, will be automatically handled by `Weblate` before each release.
This will call Django's `makemessages` command for the English language of all the installed applications. The creation of the messages for the other languages and the step to compile all these messages, will be automatically handled by `Weblate` before each release.
### ItsDangerous
@@ -120,17 +122,21 @@ https://nuxtjs.org/
### Stylelint
The tool Stylelint is used to make sure all the SCSS code is in the correct format. It
is used when the `make stylelint` is called and live in the development environment via
prettier.
The tool Stylelint is used to make sure all the SCSS code is in the correct format:
```bash
just f lint
```
https://stylelint.io/
### ESLint
ESLint is used to make sure all the JavaScript code is in the correct format. It is
used when the `make eslint` is called and it runs live in the development environment
via prettier.
ESLint is used to make sure all the JavaScript code is in the correct format:
```bash
just f lint
```
https://eslint.org/
@@ -153,11 +159,10 @@ https://sass-lang.com/
Because of its simplicity and compatibility with Vue and Nuxt we have chosen to include
JEST as the framework for the web frontend tests. Almost no code is covered yet so we
can definitely improve on that. The code is also tested in the continuous integration
pipeline. It can also be tested manually in the development environment. Make sure
that you are in the `web-frontend` container and execute the following command.
pipeline. It can also be tested manually:
```
$ make jest
```bash
just f test
```
https://jestjs.io/
+30 -32
View File
@@ -7,6 +7,14 @@ automatic style fixers to make your life as easy as possible.
> This guide assumes you have a basic understanding of git, python, virtualenvs,
> postgres and command line tools.
## Prerequisites
Install the following tools:
- [just](https://github.com/casey/just) - command runner
- [uv](https://github.com/astral-sh/uv) - Python package manager
## Setup Steps
1. First checkout a fresh copy of Baserow: `git clone git@github.com:baserow/baserow.git`
(or your personal fork of the project)
1. `cd baserow`
@@ -15,53 +23,43 @@ automatic style fixers to make your life as easy as possible.
1. Open VSCode and on the "Welcome to VSCode" screen click the "Open" button
and open the baserow folder you cloned above.
1. Make sure you have installed / enabled the Python VSCode plugin.
1. Now we will create python virtualenv and configure VSCode to use it to run tests
1. Now we will create a Python virtual environment and configure VSCode to use it to run tests
and linters:
1. Choose a location for your virtualenv, it is recommended to store it separately
from the baserow source-code folder so VSCode does not search nor index it.
2. Create the virtualenv: `mkdir $HOME/.virtualenvs; python3 -m venv $HOME/.virtualenvs/baserow` or
`$HOME/.virtualenvs; virtualenv -p python $HOME/.virtualenvs/baserow`
3. Activate the virtualenv: `source $HOME/.virtualenvs/baserow/bin/activate`
(could differ depending on your shell)
4. Run `which pip` and ensure the output of this command is now pointing into the
bin in your new virtualenv
5. Change to the Baserow source directory: `cd path/to/your/baserow`
6. Install all the Baserow python requirements into your virtualenv:
`pip install -r backend/requirements/dev.txt -r backend/requirements/base.txt`
7. Then you will most likely need to select it as default interpreter for the project:
1. Initialize the backend (creates venv and installs dependencies):
```bash
just b init
```
This creates a virtualenv at `.venv/` in the project root.
2. Then you will most likely need to select it as default interpreter for the project:
1. Type: Ctrl + Shift + P or open the command palette
1. Type: Python: select interpreter
1. Find and select your virtualenvs `bin/python` executable
8. If do not see the python tests in the testing menu:
1. Find and select your virtualenvs `bin/python` executable (`.venv/bin/python`)
3. If do not see the python tests in the testing menu:
1. Type: Ctrl + Shift + P or open the command palette
1. Type: Python: Configure Tests
1. Install and get a postgresql database running locally:
1. [https://www.postgresql.org/docs/11/tutorial-install.html](https://www.postgresql.org/docs/11/tutorial-install.html)
2. Change the default postgres port otherwise it will clash when running with
Baserow (the default VSCode config in the repo assumes your testing db is
running on 5430)
1. [https://stackoverflow.com/questions/187438/change-pgsql-port](https://stackoverflow.com/questions/187438/change-pgsql-port)
3. Create a baserow user called `baserow` with the password `baserow` and give them
permission to create databases
1. [https://medium.com/coding-blocks/creating-user-database-and-adding-access-on-postgresql-8bfcd2f4a91e](https://medium.com/coding-blocks/creating-user-database-and-adding-access-on-postgresql-8bfcd2f4a91e)
```sql
CREATE USER baserow WITH ENCRYPTED PASSWORD 'baserow';
ALTER USER baserow CREATEDB;
```
4. You might also have to `pip install psycopg2-binary` or
`sudo apt install libpq-dev`
1. The easiest way is to use Docker:
```bash
just dc-dev up -d db redis
```
2. Or install PostgreSQL locally:
[https://www.postgresql.org/docs/11/tutorial-install.html](https://www.postgresql.org/docs/11/tutorial-install.html)
3. If running PostgreSQL locally, create a baserow user:
```sql
CREATE USER baserow WITH ENCRYPTED PASSWORD 'baserow';
ALTER USER baserow CREATEDB;
```
1. Now you should be able to run the backend python tests from the testing menu, try
run `backend/tests/baserow/core/test_core_models.py` for instance.
1. Now lets set up your frontend dev by changing directory to `baserow/web-frontend`
1. Use [nvm](https://github.com/nvm-sh/nvm) to install the correct version of `node`.
1. Use [nvm](https://github.com/nvm-sh/nvm) or [fnm](https://github.com/Schniz/fnm) to install the correct version of `node`.
To determine the version of Node.js to use, see the `runtimeVersion` inside the
`launch.json` file. E.g. if the version is `v16.15.0`, you can install it with:
`nvm install v16.15.0` and then enable it with `nvm use v16.15.0`. Alternatively,
see `baserow/docs/installation/supported.md` to determine the supported version
of Node.js to use.
1. Install `yarn` globally: `npm install -g yarn`
1. Now run `yarn install` to install dependencies.
1. Now run `just f install` to install dependencies (or `yarn install` directly).
1. Select "Trust Project" if you see an VSCode popup after running yarn install
1. If you do not see Jest tests in the testing menu:
1. Type: Ctrl + Shift + P or open the command palette
+4 -2
View File
@@ -104,8 +104,10 @@ Everything related to contributing and developing for Baserow.
* [Debugging](./development/debugging.md): Debugging tools and how to use them.
* [Create a template](./development/create-a-template.md): Create a template that can be
previewed and installed by others.
* [dev.sh](./development/dev_sh.md): Further details on how to use Baserow's `./dev.sh`
helper script.
* [Justfile reference](./development/justfile.md): Complete reference for all `just` commands
available for development.
* [dev.sh](./development/dev_sh.md): **(Deprecated)** Legacy `./dev.sh` helper script.
Use `just` commands instead.
* [IntelliJ setup](./development/intellij-setup.md): How to configure Intellij to work
well with Baserow for development purposes.
* [Feature flags](./development/feature-flags.md): How Baserow uses basic feature flags for optionally
+1 -2
View File
@@ -34,8 +34,7 @@ Follow this option if you are using:
* The all-in-one Baserow image `baserow/baserow:2.0.6`
* Any of the example compose files found in the root of our git
repository `docker-compose.yml`/`docker-compose.local-build.yml`
/`docker-compose.all-in-one.yml`
repository `docker-compose.yml`/`docker-compose.all-in-one.yml`
### Prerequisites
+1 -2
View File
@@ -34,8 +34,7 @@ Follow this option if you are using:
* The all-in-one Baserow image `baserow/baserow:2.0.6`
* Any of the example compose files found in the root of our git
repository `docker-compose.yml`/`docker-compose.local-build.yml`
/`docker-compose.all-in-one.yml`
repository `docker-compose.yml`/`docker-compose.all-in-one.yml`
### Prerequisites
@@ -270,8 +270,8 @@ BASEROW_TRIGGER_SYNC_TEMPLATES_AFTER_MIGRATION=false docker-compose up -d
```bash
mkdir ~/baserow_backups
# The folder must be the same UID:GID as the user running inside the container, which
# for the local env is 9999:9999, for the dev env it is 1000:1000 or your own UID:GID
# when using ./dev.sh
# for the local env is 9999:9999, for the dev env it is your own UID:GID
# when using `just dc-dev`
sudo chown 9999:9999 ~/baserow_backups/
docker-compose run -v ~/baserow_backups:/baserow/backups backend backup -f /baserow/backups/baserow_backup.tar.gz
# backups/ now contains your Baserow backup.
+12 -2
View File
@@ -28,7 +28,7 @@ The template will look something like this:
</mj-section>
```
If you are using the Baserow docker compose development environment started by `./dev.sh` script, the new template should be automatically compiled into its HTML version, resulting in a new file. If that's not the case, follow the instructions in `backend/email_compiler` to compile the template manually.
If you are using the Baserow Docker Compose development environment (`just dc-dev up -d`), the new template should be automatically compiled into its HTML version, resulting in a new file. If that's not the case, follow the instructions in `backend/email_compiler` to compile the template manually.
### Do
@@ -51,4 +51,14 @@ Subclass `BaseEmailMessage` to define an email message with the correct template
## Testing
The Baserow dev environment (using the `./dev.sh` script) automatically starts an instance of [MailHog](https://github.com/mailhog/MailHog) at [http://localhost:8025/](http://localhost:8025/). You can verify that the emails are formatted and sent correctly there.
The Baserow dev environment automatically starts an instance of [MailHog](https://github.com/mailhog/MailHog) at [http://localhost:8025/](http://localhost:8025/). You can verify that the emails are formatted and sent correctly there.
**Docker development:**
```bash
just dc-dev up -d # MailHog is included
```
**Local development:**
```bash
just dev up # MailHog runs via Docker
```
+1 -1
View File
@@ -1,4 +1,4 @@
# Creating A Plugin
# Creating A Plugin [Outdated]
> Check out our [Plugin community sub-forum](https://community.baserow.io/c/plugins/17)
> for community made plugins and further discussion.
View File
Whitespace-only changes.
Binary file not shown.
+386
View File
@@ -0,0 +1,386 @@
# E2E Tests Justfile
# All E2E testing utilities: build, run, test, database dump/restore
# =============================================================================
# Configuration
# =============================================================================
# Docker settings
network := "baserow-e2e"
# Use same image names as `just build backend ci` and `just build web-frontend ci`
backend_image := "baserow/backend:ci"
frontend_image := "baserow/web-frontend:ci"
db_image := "pgvector/pgvector:pg${POSTGRES_IMAGE_VERSION:-13}"
redis_image := "redis:6"
# Database dump settings
dump_file := "fixtures/e2e-db.dump"
dump_network := "e2e-dump-net"
dump_db := "e2e-dump-db"
# Default: show help
default:
@just --list
# =============================================================================
# Build
# =============================================================================
# Build CI images for E2E testing (delegates to root justfile)
[doc("Build backend and frontend CI images for E2E tests")]
build *ARGS:
#!/usr/bin/env bash
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
echo "Building backend and frontend CI images..."
echo ""
# Use root justfile build commands
just build backend ci {{ ARGS }} &
BACKEND_PID=$!
just build web-frontend ci {{ ARGS }} &
FRONTEND_PID=$!
# Wait for both to complete
BACKEND_EXIT=0
FRONTEND_EXIT=0
wait $BACKEND_PID || BACKEND_EXIT=$?
wait $FRONTEND_PID || FRONTEND_EXIT=$?
echo ""
if [ $BACKEND_EXIT -ne 0 ]; then
echo "ERROR: Backend build failed (exit code: $BACKEND_EXIT)"
fi
if [ $FRONTEND_EXIT -ne 0 ]; then
echo "ERROR: Frontend build failed (exit code: $FRONTEND_EXIT)"
fi
if [ $BACKEND_EXIT -ne 0 ] || [ $FRONTEND_EXIT -ne 0 ]; then
exit 1
fi
echo "Images built:"
echo " {{ backend_image }}"
echo " {{ frontend_image }}"
# Check if CI images exist, build them if not
[private]
_ensure-images:
#!/usr/bin/env bash
set -euo pipefail
NEED_BUILD=false
if ! docker image inspect {{ backend_image }} > /dev/null 2>&1; then
echo "Backend CI image not found: {{ backend_image }}"
NEED_BUILD=true
fi
if ! docker image inspect {{ frontend_image }} > /dev/null 2>&1; then
echo "Frontend CI image not found: {{ frontend_image }}"
NEED_BUILD=true
fi
if [ "$NEED_BUILD" = true ]; then
echo ""
echo "Building missing CI images..."
just build
fi
# =============================================================================
# Run Environment
# =============================================================================
# Start E2E environment (DB, Redis, backend, frontend)
# Uses pre-generated database dump for fast startup
[doc("Start E2E environment containers")]
up: _ensure-images
#!/usr/bin/env bash
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
DUMP_FILE="e2e-tests/{{ dump_file }}"
# Check if dump file exists
if [ ! -f "$DUMP_FILE" ]; then
echo "Error: Database dump not found at $DUMP_FILE"
echo "Run 'just e2e db-dump' to generate it first."
exit 1
fi
# Clean up any stopped containers from previous runs
docker rm -f e2e-frontend e2e-backend e2e-celery e2e-redis e2e-db 2>/dev/null || true
docker volume rm e2e-media 2>/dev/null || true
# Create network if it doesn't exist
docker network create {{ network }} 2>/dev/null || true
# Start PostgreSQL
if ! docker ps --format '{{ '{{.Names}}' }}' | grep -q "^e2e-db$"; then
echo "Starting PostgreSQL..."
docker run -d --network={{ network }} --name e2e-db \
-e POSTGRES_USER=baserow \
-e POSTGRES_PASSWORD=baserow \
-e POSTGRES_DB=baserow \
--tmpfs /var/lib/postgresql/data:size=2G \
{{ db_image }}
fi
# Start Redis
if ! docker ps --format '{{ '{{.Names}}' }}' | grep -q "^e2e-redis$"; then
echo "Starting Redis..."
docker run -d --network={{ network }} --name e2e-redis \
--tmpfs /data:size=256m \
{{ redis_image }}
fi
# Create shared tmpfs volume for user files (backend + celery)
# Use a named volume with tmpfs driver for speed and proper permissions
docker volume rm e2e-media 2>/dev/null || true
docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=512m,uid=9999,gid=9999 e2e-media
# Wait for PostgreSQL to be ready
echo "Waiting for PostgreSQL..."
for i in {1..30}; do
if docker exec e2e-db pg_isready -U baserow > /dev/null 2>&1; then
break
fi
sleep 1
done
# Restore database from dump (fast - migrations pre-applied)
echo "Restoring database from dump..."
docker exec e2e-db psql -U baserow -d postgres -c "DROP DATABASE IF EXISTS baserow;" > /dev/null
docker exec e2e-db psql -U baserow -d postgres -c "CREATE DATABASE baserow;" > /dev/null
docker exec -i e2e-db pg_restore -U baserow -d baserow --no-owner --no-acl < "$DUMP_FILE" 2>/dev/null || true
echo "Database restored."
# Start backend (migrations run on startup to apply any new ones + sync templates)
if ! docker ps --format '{{ '{{.Names}}' }}' | grep -q "^e2e-backend$"; then
echo "Starting backend..."
docker run -d --network={{ network }} --name e2e-backend \
-v e2e-media:/baserow/media \
-e DATABASE_HOST=e2e-db \
-e DATABASE_NAME=baserow \
-e DATABASE_USER=baserow \
-e DATABASE_PASSWORD=baserow \
-e REDIS_URL=redis://e2e-redis:6379 \
-e SECRET_KEY=test \
-e DJANGO_SETTINGS_MODULE=baserow.config.settings.e2e \
-e MIGRATE_ON_STARTUP=true \
-e FEATURE_FLAGS="*" \
-e PRIVATE_BACKEND_URL=http://e2e-backend:8000 \
-p 8000:8000 \
{{ backend_image }} gunicorn
fi
# Start celery worker (shares media volume with backend)
if ! docker ps --format '{{ '{{.Names}}' }}' | grep -q "^e2e-celery$"; then
echo "Starting celery worker..."
docker run -d --network={{ network }} --name e2e-celery \
-v e2e-media:/baserow/media \
-e DATABASE_HOST=e2e-db \
-e DATABASE_NAME=baserow \
-e DATABASE_USER=baserow \
-e DATABASE_PASSWORD=baserow \
-e REDIS_URL=redis://e2e-redis:6379 \
-e SECRET_KEY=test \
-e DJANGO_SETTINGS_MODULE=baserow.config.settings.e2e \
-e FEATURE_FLAGS="*" \
-e BASEROW_RUN_MINIMAL=yes \
-e BASEROW_AMOUNT_OF_WORKERS=1 \
{{ backend_image }} celery-worker
fi
# Start frontend
if ! docker ps --format '{{ '{{.Names}}' }}' | grep -q "^e2e-frontend$"; then
echo "Starting frontend..."
docker run -d --network={{ network }} --name e2e-frontend \
-e PUBLIC_BACKEND_URL=http://localhost:8000 \
-e PUBLIC_WEB_FRONTEND_URL=http://localhost:3000 \
-e PRIVATE_BACKEND_URL=http://e2e-backend:8000 \
-e FEATURE_FLAGS="*" \
-p 3000:3000 \
{{ frontend_image }} nuxt-local
fi
echo ""
echo "E2E environment started. Containers:"
docker ps --filter "name=e2e-" --format "table {{ '{{.Names}}\t{{.Status}}\t{{.Ports}}' }}"
echo ""
echo "View logs: just e2e logs"
echo "Run tests: just e2e test"
echo "Stop: just e2e down"
# Stop and remove E2E containers
[doc("Stop E2E environment")]
down:
#!/usr/bin/env bash
echo "Stopping E2E containers..."
docker rm -f e2e-frontend e2e-backend e2e-celery e2e-redis e2e-db e2e-s3mock 2>/dev/null || true
docker volume rm e2e-media 2>/dev/null || true
docker network rm {{ network }} 2>/dev/null || true
echo "E2E environment stopped."
# View E2E container logs
[doc("View E2E logs: just e2e logs [backend|frontend|db|redis]")]
logs *SERVICE:
#!/usr/bin/env bash
if [ -z "{{ SERVICE }}" ]; then
# Show all logs interleaved
docker logs e2e-backend 2>&1 | sed 's/^/[backend] /' &
docker logs e2e-frontend 2>&1 | sed 's/^/[frontend] /' &
wait
else
docker logs -f "e2e-{{ SERVICE }}"
fi
# =============================================================================
# Test
# =============================================================================
# Run E2E tests (tears down containers when done)
[doc("Run E2E tests (tears down containers when done)")]
test *ARGS:
#!/usr/bin/env bash
set -euo pipefail
cd "$(git rev-parse --show-toplevel)/e2e-tests"
# Check if containers are running
if ! docker ps --format '{{ '{{.Names}}' }}' | grep -q "^e2e-backend$"; then
echo "E2E environment not running. Start with: just e2e up"
exit 1
fi
# Ensure cleanup on exit (success or failure)
cleanup() {
echo ""
echo "Tearing down E2E environment..."
just down
}
trap cleanup EXIT
export PUBLIC_BACKEND_URL=http://localhost:8000
export PUBLIC_WEB_FRONTEND_URL=http://localhost:3000
# Install dependencies if needed
echo "Installing dependencies..."
yarn install
yarn playwright install
echo "Waiting for services to be ready..."
./wait-for-services.sh
echo "Running E2E tests..."
if [ -z "{{ ARGS }}" ]; then
yarn run test
else
yarn playwright test {{ ARGS }}
fi
# Full E2E cycle: build, start, test, stop
[doc("Full E2E cycle: build, up, test, down")]
run: build up test down
# =============================================================================
# Database Dump
# =============================================================================
# Generate a fresh database dump with migrations applied (no templates)
# Templates are synced on E2E startup via post_migrate signal
[doc("Generate database dump with migrations only")]
db-dump:
#!/usr/bin/env bash
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
echo "=== Creating fresh database dump for E2E tests ==="
# Cleanup any existing containers
docker rm -f {{ dump_db }} e2e-dump-backend e2e-dump-redis 2>/dev/null || true
docker network rm {{ dump_network }} 2>/dev/null || true
# Create network
docker network create {{ dump_network }}
# Start PostgreSQL with pgvector
echo "Starting PostgreSQL..."
docker run -d --network={{ dump_network }} --name {{ dump_db }} \
-e POSTGRES_USER=baserow \
-e POSTGRES_PASSWORD=baserow \
-e POSTGRES_DB=baserow \
{{ db_image }}
# Wait for PostgreSQL
echo "Waiting for PostgreSQL to be ready..."
for i in {1..30}; do
if docker exec {{ dump_db }} pg_isready -U baserow > /dev/null 2>&1; then
break
fi
sleep 1
done
# Build backend image if needed
if ! docker image inspect {{ backend_image }} > /dev/null 2>&1; then
echo "Building backend CI image..."
just build backend ci
fi
# Start Redis (needed for Django)
echo "Starting Redis..."
docker run -d --network={{ dump_network }} --name e2e-dump-redis {{ redis_image }}
sleep 2
# Run migrations only (use test settings which doesn't sync templates)
echo "Running migrations..."
docker run --rm --network={{ dump_network }} --name e2e-dump-backend \
-e DATABASE_HOST={{ dump_db }} \
-e DATABASE_NAME=baserow \
-e DATABASE_USER=baserow \
-e DATABASE_PASSWORD=baserow \
-e REDIS_URL=redis://e2e-dump-redis:6379 \
-e SECRET_KEY=dump-generation \
-e DJANGO_SETTINGS_MODULE=baserow.config.settings.test \
{{ backend_image }} bash -c "python /baserow/backend/src/baserow/manage.py migrate --noinput"
# Create the dump
echo "Creating database dump..."
mkdir -p e2e-tests/fixtures
docker exec {{ dump_db }} pg_dump -U baserow -Fc baserow > e2e-tests/{{ dump_file }}
# Show dump info
DUMP_SIZE=$(ls -lh e2e-tests/{{ dump_file }} | awk '{print $5}')
echo ""
echo "=== Database dump created successfully ==="
echo "File: e2e-tests/{{ dump_file }}"
echo "Size: $DUMP_SIZE"
echo ""
# Cleanup
echo "Cleaning up..."
docker rm -f {{ dump_db }} e2e-dump-redis 2>/dev/null || true
docker network rm {{ dump_network }} 2>/dev/null || true
echo "Done! Commit the dump file to the repository."
# Restore database from dump file to a container
[doc("Restore database dump to a PostgreSQL container")]
db-restore container:
#!/usr/bin/env bash
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
DUMP_PATH="e2e-tests/{{ dump_file }}"
if [ ! -f "$DUMP_PATH" ]; then
echo "Error: Dump file not found at $DUMP_PATH"
echo "Run 'just e2e db-dump' to generate it first."
exit 1
fi
echo "Restoring database from dump..."
docker exec {{ container }} psql -U baserow -d postgres -c "DROP DATABASE IF EXISTS baserow;"
docker exec {{ container }} psql -U baserow -d postgres -c "CREATE DATABASE baserow;"
docker exec -i {{ container }} pg_restore -U baserow -d baserow --no-owner --no-acl < "$DUMP_PATH" || true
echo "Database restored successfully!"
+9 -18
View File
@@ -1,17 +1,17 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "baserow-enterprise"
authors = [{ name = "Bram Wiepjes (Baserow)", email="bram@baserow.io" }]
description="""Baserow is an open source no-code database tool and Airtable \
authors = [{ name = "Bram Wiepjes (Baserow)", email = "bram@baserow.io" }]
description = """Baserow is an open source no-code database tool and Airtable \
alternative. Easily create a relational database without any \
technical expertise. Build a table and define custom fields \
like text, number, file and many more."""
# mixed license
license={file="LICENSE"}
requires-python=">=3.11"
license = { file = "../LICENSE" }
requires-python = "==3.11.*"
version = "2.0.6"
classifiers = []
@@ -22,6 +22,9 @@ Documentation = "https://baserow.io/user-docs"
Support = "https://community.baserow.io/"
Changelog = "https://github.com/baserow/baserow/blob/develop/changelog.md"
[tool.hatch.build.targets.wheel]
packages = ["src/baserow_enterprise"]
[tool.black]
exclude = '''
/(
@@ -29,15 +32,3 @@ exclude = '''
| generated
)/
'''
[tool.setuptools]
include-package-data = true
# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
platforms = ["Linux"]
[tool.setuptools.packages.find]
where = ["src/"]
include = ["baserow_enterprise", "baserow_enterprise.*"]
+1386
View File
File diff suppressed because it is too large. Load diff
+31
View File
@@ -0,0 +1,31 @@
# Personal Justfile Recipes
# ========================
# Copy this file to `local.just` to add your own custom recipes.
# The file is gitignored, so your personal recipes won't be committed.
#
# You can also create local.just in backend/ or web-frontend/ for
# component-specific personal recipes.
# Example: Quick test for a specific module
my-test:
just b test tests/baserow/core/
# Example: Start only what you need (services + backend, no frontend)
my-dev:
#!/usr/bin/env bash
just dc-dev up -d redis db mailhog
just b run-dev-server
# Example: Custom database reset
my-db-reset:
just dc-dev exec db psql -U baserow -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public;"
just b migrate
# Example: Open shell with custom imports
my-shell:
just b manage shell_plus --print-sql
# Example: Run your favorite linter combination
my-lint:
just b lint
just f lint
+7 -14
View File
@@ -1,6 +1,6 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "baserow-premium"
@@ -10,8 +10,8 @@ description = """Baserow is an open source no-code database tool and Airtable \
technical expertise. Build a table and define custom fields \
like text, number, file and many more."""
# mixed license
license={file="LICENSE"}
requires-python=">=3.11"
license = { file = "../LICENSE" }
requires-python = "==3.11.*"
version = "2.0.6"
classifiers = []
@@ -22,6 +22,9 @@ Documentation = "https://baserow.io/user-docs"
Support = "https://community.baserow.io/"
Changelog = "https://github.com/baserow/baserow/blob/develop/changelog.md"
[tool.hatch.build.targets.wheel]
packages = ["src/baserow_premium"]
[tool.black]
exclude = '''
/(
@@ -29,13 +32,3 @@ exclude = '''
| generated
)/
'''
[tool.setuptools]
include-package-data = true
# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
platforms = ["Linux"]
[tool.setuptools.packages.find]
where = ["src/"]
include = ["baserow_premium", "baserow_premium.*"]
@@ -1,6 +1,9 @@
import os
from io import BytesIO
from unittest.mock import Mock
from django.conf import settings
import pytest
from baserow_premium.generative_ai.managers import AIFileManager
@@ -47,7 +50,7 @@ def test_upload_files_from_file_field(premium_data_fixture, django_assert_num_qu
assert len(generative_ai_model_type._files) == 1
assert generative_ai_model_type._files[file_ids[0]]["file_name"].endswith(
f"/baserow/media/user_files/{user_file_1.name}"
os.path.join(settings.MEDIA_ROOT, f"user_files/{user_file_1.name}")
)
+2
View File
@@ -41,6 +41,8 @@ module.exports = {
'return',
'extend',
'for',
'use',
'forward',
],
},
],
+254 -69
View File
@@ -1,90 +1,275 @@
FROM node:24-bookworm AS base
# syntax=docker/dockerfile:1.4
ARG UID="9999"
ARG GID="9999"
# =============================================================================
# Builder for su-exec (replaces gosu, smaller footprint)
# Pinned to v0.2 (commit 212b75144bbc) with SHA256 verification
# =============================================================================
FROM debian:bookworm-slim AS tool-builder
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV SU_EXEC_VERSION=212b75144bbc06722fbd7661f651390dc47a43d1 \
SU_EXEC_SHA256=d6c40440609a23483f12eb6295b5191e94baf08298a856bab6e15b10c3b82891
# hadolint ignore=DL3008
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl build-essential dos2unix tini && \
curl -fsSL -o /usr/local/bin/su-exec.c "https://github.com/ncopa/su-exec/raw/${SU_EXEC_VERSION}/su-exec.c" && \
echo "${SU_EXEC_SHA256} /usr/local/bin/su-exec.c" | sha256sum -c - && \
gcc -Wall -Werror -static -o /usr/local/bin/su-exec /usr/local/bin/su-exec.c && \
chmod 0755 /usr/local/bin/su-exec
# =============================================================================
# CI builder stage
# =============================================================================
FROM node:24-bookworm-slim AS builder-ci
ARG UID
ENV UID=${UID:-9999}
ARG GID
ENV GID=${GID:-9999}
ENV NODE_OPTIONS=--openssl-legacy-provider
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Perform all OS package installation and cleanup in one single command to reduce the
# size of the created layer.
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
build-essential \
curl \
gnupg2 \
dos2unix \
tini \
git \
&& apt-get autoclean \
&& apt-get clean \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/*
ENV YARN_CACHE_FOLDER=/tmp/.yarn-cache
# Install su-exec as a safer alternative to gosu
RUN curl -L -o /usr/local/bin/su-exec.c https://github.com/ncopa/su-exec/raw/master/su-exec.c \
&& gcc -Wall -Werror -static -o /usr/local/bin/su-exec /usr/local/bin/su-exec.c \
&& chmod 0755 /usr/local/bin/su-exec \
&& rm /usr/local/bin/su-exec.c
# The node image already creates a non-root user to run as, update its ids so they
# match the provided UID and GID we wish to build and run this image with.
# If GID or UID already exist that's OK no need to stop the build.
RUN groupmod -g ${GID} node || exit 0
RUN usermod -u ${UID} -g ${GID} node || exit 0
ENV DOCKER_USER=node
ENV BASEROW_IMAGE_TYPE="web-frontend"
RUN mkdir -p /baserow/web-frontend /baserow/premium/web-frontend /baserow/enterprise/web-frontend && \
chown -R $UID:$GID /baserow
USER $UID:$GID
# Create and install the dependencies in separate COPY commands
COPY --chown=$UID:$GID ./web-frontend/package.json ./web-frontend/yarn.lock /baserow/web-frontend/
WORKDIR /baserow/web-frontend
# Install dependencies (including dev)
RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,uid=$UID,gid=$GID,sharing=locked \
--mount=type=bind,source=web-frontend/package.json,target=/baserow/web-frontend/package.json \
--mount=type=bind,source=web-frontend/yarn.lock,target=/baserow/web-frontend/yarn.lock \
yarn install --pure-lockfile --cache-folder $YARN_CACHE_FOLDER
# =============================================================================
# Production builder stage
# =============================================================================
FROM node:24-bookworm-slim AS builder-prod
ARG UID
ARG GID
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV YARN_CACHE_FOLDER=/tmp/.yarn-cache \
NUXT_TELEMETRY_DISABLED=1 \
NODE_OPTIONS="--max-old-space-size=4096" \
NODE_ENV=production
RUN mkdir -p /baserow/web-frontend /baserow/premium/web-frontend /baserow/enterprise/web-frontend && \
chown -R $UID:$GID /baserow/
# Copy source code
COPY --chown=$UID:$GID ./web-frontend /baserow/web-frontend/
COPY --chown=$UID:$GID ./premium/web-frontend /baserow/premium/web-frontend/
COPY --chown=$UID:$GID ./enterprise/web-frontend /baserow/enterprise/web-frontend/
COPY --chown=$UID:$GID ./deploy/plugins/*.sh /baserow/plugins/
RUN dos2unix /baserow/web-frontend/docker/docker-entrypoint.sh && \
chmod a+x /baserow/web-frontend/docker/docker-entrypoint.sh
# Copy all dependencies so we can build the production files
COPY --chown=$UID:$GID --from=builder-ci /baserow/web-frontend/node_modules /baserow/web-frontend/node_modules
# tini installed above protects us from zombie processes and ensures the default signal
# handlers work, see https://github.com/krallin/tini.
ENTRYPOINT ["/usr/bin/tini", "--", "/bin/bash", "/baserow/web-frontend/docker/docker-entrypoint.sh"]
HEALTHCHECK --interval=60s CMD ["curl", "-f", "http://localhost:3000/_health/"]
EXPOSE 3000
FROM base AS dev
COPY --link --from=tool-builder /usr/bin/dos2unix /usr/local/bin/dos2unix
RUN dos2unix /baserow/web-frontend/docker/docker-entrypoint.sh \
&& chmod a+x /baserow/web-frontend/docker/docker-entrypoint.sh \
&& chown $UID:$GID /baserow/web-frontend/docker/docker-entrypoint.sh
USER $UID:$GID
WORKDIR /baserow/web-frontend
# Install dev dependencies for running nuxt dev + tests.
RUN yarn install && yarn cache clean
COPY --chown=$UID:$GID ./tests /baserow/tests/
# Create symlinks for jest tests
RUN ln -s /baserow/web-frontend/node_modules/ /baserow/premium/web-frontend/node_modules \
&& ln -s /baserow/web-frontend/node_modules/ /baserow/enterprise/web-frontend/node_modules
# We don't bother running build-local in dev mode as it pre-compiles nuxt which won't
# be used when running the nuxt dev server.
CMD ["nuxt-dev"]
FROM base AS local
# Run the nuxt build and then remove all dev dependencies as we don't need them after.
RUN yarn install \
&& yarn run build-local \
&& rm -rf node_modules \
&& yarn install --production \
&& yarn cache clean \
&& find node_modules -type f \( -name "*.o" -o -name "*.a" \) -delete \
&& find node_modules -type d \( -name "test" -o -name "tests" -o -name "__tests__" -o -name "example" -o -name "examples" -o -name "doc" -o -name "docs" \) -prune -exec rm -rf '{}' + \
# Build, then clean reinstall production only
RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,uid=$UID,gid=$GID,sharing=locked \
yarn run build-local \
&& find .nuxt -type f -name "*.map" -delete
# =============================================================================
# CI target - used in CI pipelines
# =============================================================================
FROM node:24-bookworm-slim AS ci
ARG UID
ARG GID
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DOCKER_USER=baserow_docker_user \
BASEROW_IMAGE_TYPE="web-frontend"
RUN groupadd --system --gid $GID ${DOCKER_USER} && \
useradd --shell /bin/bash -u $UID -g $GID -o -c "" -d /baserow -m ${DOCKER_USER}
COPY --link --from=tool-builder /usr/local/bin/su-exec /usr/local/bin/su-exec
COPY --link --from=tool-builder /usr/bin/tini /usr/bin/tini
COPY --from=busybox:musl /bin/wget /usr/local/bin/wget
RUN mkdir -p /baserow/web-frontend/.cache /baserow/reports /baserow/.cache /baserow/.yarn /baserow/web-frontend/reports/coverage && \
chown -R $UID:$GID /baserow
# Copy dependencies and source code
COPY --chown=$UID:$GID web-frontend /baserow/web-frontend
COPY --chown=$UID:$GID premium/web-frontend /baserow/premium/web-frontend
COPY --chown=$UID:$GID enterprise/web-frontend /baserow/enterprise/web-frontend/
COPY --link --from=builder-ci /baserow/web-frontend/node_modules /baserow/web-frontend/node_modules
COPY --link --from=builder-prod /baserow/web-frontend/.nuxt /baserow/web-frontend/.nuxt
COPY --chown=$UID:$GID tests /baserow/tests
COPY --chown=$UID:$GID deploy/plugins/*.sh /baserow/plugins/
USER $UID:$GID
WORKDIR /baserow/web-frontend
ENTRYPOINT ["/usr/bin/tini", "--", "/bin/bash", "/baserow/web-frontend/docker/docker-entrypoint.sh"]
HEALTHCHECK --interval=60s CMD wget -q -O /dev/null http://localhost:3000/_health/ || exit 1
CMD ["nuxt-local"]
# =============================================================================
# Development target - used for local development with live reload
# =============================================================================
FROM node:24-bookworm-slim AS dev
ARG UID
ARG GID
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# hadolint ignore=DL3008
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
ca-certificates \
python3 \
python3-pip \
build-essential \
curl \
wget \
tmux \
vim \
sudo
ENV DOCKER_USER=baserow_docker_user \
BASEROW_IMAGE_TYPE="web-frontend" \
PATH="/baserow/web-frontend/node_modules/.bin:$PATH" \
YARN_CACHE_FOLDER=/tmp/.yarn-dev-cache
# Install rust-just for running justfiles
RUN pip3 install --break-system-packages rust-just
COPY --link --from=tool-builder /usr/local/bin/su-exec /usr/local/bin/su-exec
COPY --link --from=tool-builder /usr/bin/tini /usr/bin/tini
COPY --link --from=tool-builder /usr/bin/dos2unix /usr/local/bin/dos2unix
RUN getent group $GID || groupadd --system --gid $GID ${DOCKER_USER} && \
useradd --shell /bin/bash -l -u $UID -g $GID -o -c "" -d /baserow -m ${DOCKER_USER} && \
echo "${DOCKER_USER} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${DOCKER_USER} && \
chmod 0440 /etc/sudoers.d/${DOCKER_USER}
RUN mkdir -p /baserow/web-frontend /baserow/premium/web-frontend /baserow/enterprise/web-frontend && \
chown -R $UID:$GID /baserow
USER $UID:$GID
WORKDIR /baserow/web-frontend
# Configure tmux to preserve environment variables (don't start login shell)
RUN echo 'set -g default-command "${SHELL}"' > /baserow/.tmux.conf
# Create .bashrc with environment variables for interactive shells
RUN printf '%s\n' \
'# Aliases' \
'alias j="just"' \
'alias y="yarn"' \
'' \
'# Show a helpful message' \
'echo "Baserow frontend dev container"' \
'echo " y <cmd> - Run yarn commands"' \
'echo " j - See available commands"' \
> /baserow/.bashrc
COPY --chown=$UID:$GID web-frontend/docker/docker-entrypoint.sh /baserow/web-frontend/docker/docker-entrypoint.sh
RUN dos2unix /baserow/web-frontend/docker/docker-entrypoint.sh \
&& chmod a+x /baserow/web-frontend/docker/docker-entrypoint.sh
COPY --chown=$UID:$GID web-frontend/package.json /baserow/web-frontend/package.json
COPY --chown=$UID:$GID web-frontend/yarn.lock /baserow/web-frontend/yarn.lock
# Install dependencies (including dev)
RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,uid=$UID,gid=$GID,sharing=locked \
yarn install --pure-lockfile --cache-folder $YARN_CACHE_FOLDER
ENTRYPOINT ["/usr/bin/tini", "--", "/bin/bash", "/baserow/web-frontend/docker/docker-entrypoint.sh"]
HEALTHCHECK --interval=60s CMD wget -q -O /dev/null http://localhost:3000/_health/ || exit 1
CMD ["nuxt-dev"]
# =============================================================================
# Production target - minimal image with only runtime requirements
# =============================================================================
FROM node:24-bookworm-slim AS local-base
ARG UID
ARG GID
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DOCKER_USER=baserow_docker_user \
BASEROW_IMAGE_TYPE="web-frontend" \
NODE_ENV=production \
YARN_CACHE_FOLDER=/tmp/.yarn-cache
COPY --link --from=tool-builder /usr/bin/dos2unix /usr/local/bin/dos2unix
COPY --link --from=tool-builder /usr/local/bin/su-exec /usr/local/bin/su-exec
COPY --link --from=tool-builder /usr/bin/tini /usr/bin/tini
COPY --from=busybox:musl /bin/wget /usr/local/bin/wget
RUN groupadd --system --gid $GID ${DOCKER_USER} && \
useradd --shell /bin/bash -u $UID -g $GID -o -c "" -d /baserow -m ${DOCKER_USER}
USER $UID:$GID
RUN mkdir -p /baserow/web-frontend
WORKDIR /baserow/web-frontend
# Install dependencies first (cached unless package.json/yarn.lock change)
RUN --mount=type=cache,target=$YARN_CACHE_FOLDER,uid=$UID,gid=$GID,sharing=locked \
--mount=type=bind,source=web-frontend/package.json,target=/baserow/web-frontend/package.json \
--mount=type=bind,source=web-frontend/yarn.lock,target=/baserow/web-frontend/yarn.lock \
yarn install --production --pure-lockfile --cache-folder $YARN_CACHE_FOLDER \
# Clean up unnecessary files to reduce image size
&& find node_modules -type f -name "*.map" -delete \
&& find node_modules -type f \( \
-name "*.md" -o -name "*.markdown" \
-o -name "*.ts" -o -name "*.d.ts" \
-o -name "LICENSE*" -o -name "license*" -o -name "License*" \
-o -name "CHANGELOG*" -o -name "HISTORY*" \
-o -name ".npmignore" -o -name ".gitignore" -o -name ".eslintrc*" \
\) -delete \
&& find node_modules -type d \( \
-name "test" -o -name "tests" -o -name "__tests__" \
-o -name "example" -o -name "examples" \
-o -name "doc" -o -name "docs" \
-o -name ".github" \
\) -prune -exec rm -rf {} +
COPY --chown=$UID:$GID web-frontend /baserow/web-frontend
COPY --chown=$UID:$GID premium/web-frontend /baserow/premium/web-frontend
COPY --chown=$UID:$GID enterprise/web-frontend /baserow/enterprise/web-frontend/
COPY --chown=$UID:$GID ./deploy/plugins/*.sh /baserow/plugins/
HEALTHCHECK --interval=60s CMD wget -q -O /dev/null http://localhost:3000/_health/ || exit 1
ENTRYPOINT ["/usr/bin/tini", "--", "/bin/bash", "/baserow/web-frontend/docker/docker-entrypoint.sh"]
FROM local-base AS local
COPY --link --from=builder-prod /baserow/web-frontend/.nuxt /baserow/web-frontend/.nuxt
CMD ["nuxt-local"]
FROM local AS prod
CMD ["nuxt-local"]
+17
View File
@@ -52,7 +52,23 @@ export default function (
logErrors: true,
},
},
buildDir: process.env.NUXT_BUILD_DIR || '.nuxt',
build: {
cache: true,
cacheDirectory: process.env.NUXT_CACHE_DIR || 'node_modules/.cache',
loaders: {
scss: {
sassOptions: {
silenceDeprecations: [
'legacy-js-api',
'import',
'global-builtin',
'slash-div',
],
quietDeps: true,
},
},
},
extend(config, ctx) {
config.node = { fs: 'empty' }
config.module.rules.push({
@@ -79,6 +95,7 @@ export default function (
'vue-chartjs',
'chart.js',
'@vue2-flow/core',
'pathe',
],
},
}
+5 -5
View File
@@ -101,22 +101,22 @@ case "$1" in
exec yarn run storybook
;;
lint)
exec make lint-javascript
exec yarn lint
;;
lint-fix)
attachable_exec yarn run eslint --fix
;;
eslint)
exec make eslint
exec yarn eslint
;;
stylelint)
exec make eslint
exec yarn stylelint
;;
test)
exec make jest
exec yarn test
;;
ci-test)
exec make ci-test-javascript
exec yarn test-coverage
;;
bash)
exec /bin/bash -c "${@:2}"
+151
View File
@@ -0,0 +1,151 @@
# Baserow Web-Frontend Justfile
# NOTE: All recipes here must work the same inside Docker and on local dev setups
# without requiring any changes. Please make sure to not add docker-specific
# commands or assumptions here.
# Uses yarn for Node.js package management
# Import personal recipes if they exist (not tracked in git)
import? 'local.just'
# Note: just doesn't support dynamic dotenv-filename, so we handle env loading in recipes
_load_env := 'if [ -f "../.env.local" ]; then set -a; source "../.env.local"; set +a; fi'
# Default recipe - show help
default:
@just --list
# Show documentation links for each command group
[group('0 - help')]
help:
@echo "Baserow Web-Frontend - Documentation Links"
@echo "==========================================="
@echo ""
@echo "Setup & Development:"
@echo " docs/development/running-the-dev-env-locally.md - Local development setup"
@echo " docs/development/running-the-dev-env-with-docker.md - Docker development setup"
@echo " docs/development/directory-structure.md - Project structure"
@echo ""
@echo "Testing:"
@echo " docs/development/running-tests.md - Running frontend tests"
@echo " docs/development/e2e-testing.md - End-to-end testing"
@echo ""
@echo "Code Quality:"
@echo " docs/development/code-quality.md - Linting and formatting"
@echo ""
@echo "Build & Production:"
@echo " docs/development/building-and-running-production-images.md - Production images"
@echo ""
@echo "IDE Setup:"
@echo " docs/development/vscode-setup.md - VS Code configuration"
@echo ""
@echo "Other:"
@echo " docs/development/justfile.md - Just command reference"
@echo ""
@echo "Quick shortcuts: l=lint, t=test, dev=run-dev-server"
# Allow `just frontend <cmd>` or `just f <cmd>` to work (for consistency with root justfile)
frontend *ARGS:
@just {{ ARGS }}
alias f := frontend
# Common shortcuts
alias l := lint
alias t := test
alias dev := run-dev-server
alias serve := run-dev-server
# Pass-through to yarn
[group('7 - passthrough')]
yarn *ARGS:
yarn {{ ARGS }}
# Pass-through to npm
[group('7 - passthrough')]
npm *ARGS:
npm {{ ARGS }}
# =============================================================================
# Setup & Installation
# =============================================================================
# Install dependencies
[group('1 - setup')]
install:
yarn install
# =============================================================================
# Code Quality & Linting
# =============================================================================
# Run all linters (eslint + stylelint)
[group('4 - code-quality')]
lint:
yarn run eslint
yarn run stylelint
yarn run prettier --check 'modules/**/*.scss'
# Fix code style issues
[group('4 - code-quality')]
fix:
yarn run fix
# Format SCSS files with Prettier
[group('4 - code-quality')]
format-scss:
yarn run prettier --write 'modules/**/*.scss'
# =============================================================================
# Testing
# =============================================================================
# Run tests
[group('3 - testing')]
test *ARGS:
yarn test {{ ARGS }}
# Run tests with coverage (for CI)
[group('3 - testing')]
ci-test:
yarn test-coverage
# Update Jest snapshots
[group('3 - testing')]
update-snapshots:
yarn run jest --updateSnapshot
# =============================================================================
# Development
# =============================================================================
# Run development server
[group('2 - development')]
run-dev-server:
#!/usr/bin/env bash
set -euo pipefail
{{ _load_env }}
yarn run dev
# Run Storybook
[group('2 - development')]
storybook:
yarn run storybook
# Build Nuxt for production
[group('5 - build')]
build-nuxt:
yarn run build-local
# =============================================================================
# Cleanup
# =============================================================================
# Clean Nuxt build artifacts
[group('6 - cleanup')]
clean-nuxt:
rm -rf .nuxt/ dist/
# Clean all (Nuxt build artifacts + node_modules)
[group('6 - cleanup')]
clean-all: clean-nuxt
rm -rf node_modules/
@@ -1,3 +1,5 @@
@use 'sass:string';
$white: #fff;
$black: #000;
@@ -247,6 +249,6 @@ $colors: (
// const color = styles["darker-gray"]
:export {
@each $color, $value in $colors {
#{unquote($color)}: $value;
#{string.unquote($color)}: $value;
}
}
@@ -1,3 +1,5 @@
@use 'sass:math';
.row {
box-sizing: border-box;
display: flex;
@@ -16,11 +18,11 @@
@for $i from 1 through $grid-columns {
.col-#{$i} {
flex-basis: 100% / $grid-columns * $i;
max-width: 100% / $grid-columns * $i;
flex-basis: math.div(100%, $grid-columns) * $i;
max-width: math.div(100%, $grid-columns) * $i;
}
.col-offset-#{$i} {
margin-left: 100% / $grid-columns * $i;
margin-left: math.div(100%, $grid-columns) * $i;
}
}
@@ -7,7 +7,7 @@
/* prettier-ignore */
%icon {
/* stylelint-disable-next-line scss/at-extend-no-missing-placeholder, scss/operator-no-unspaced */
@extend *[class^="iconoir-"];
@extend *, [class^=iconoir-];
}
/* prettier-ignore */
+6 -5
View File
@@ -16,7 +16,7 @@
"eslint": "eslint -c .eslintrc.js --cache --cache-location=.cache/eslint --ext .js,.vue . ../premium/web-frontend ../enterprise/web-frontend",
"lint": "yarn eslint && yarn stylelint",
"fix": "yarn prettier **/*.js **/*.vue **/*.scss --cache --cache-location=.cache/prettier -w && yarn eslint --fix && yarn stylelint --fix",
"stylelint": "stylelint **/*.scss ../premium/web-frontend/modules/**/*.scss ../enterprise/web-frontend/modules/**/*.scss",
"stylelint": "stylelint --cache --cache-location=.cache/stylelint **/*.scss ../premium/web-frontend/modules/**/*.scss ../enterprise/web-frontend/modules/**/*.scss",
"test-core": "TZ=UTC jest --verbose false --config jest.config.js",
"test-premium": "TZ=UTC jest --verbose false --config ../premium/web-frontend/jest.config.js",
"test-enterprise": "TZ=UTC jest --verbose false --config ../enterprise/web-frontend/jest.config.js",
@@ -32,7 +32,6 @@
"@nuxtjs/composition-api": "^0.34.0",
"@nuxtjs/i18n": "7.3.1",
"@nuxtjs/sentry": "7.5.0",
"@storybook/core-client": "6.5.9",
"@tiptap/core": "^2.14.0",
"@tiptap/extension-blockquote": "^2.14.0",
"@tiptap/extension-bold": "^2.14.0",
@@ -81,8 +80,10 @@
"chart.js": "3.9.1",
"chartjs-adapter-moment": "1.0.1",
"cookie-universal-nuxt": "2.2.2",
"core-js": "^3.34.0",
"cross-env": "^7.0.2",
"flush-promises": "^1.0.2",
"form-data": "4.0.4",
"highlight.js": "^11.11.1",
"iconoir": "^6.11.0",
"jwt-decode": "^3.1.2",
@@ -94,7 +95,6 @@
"moment": "^2.30.1",
"moment-guess": "^1.2.4",
"moment-timezone": "0.5.43",
"node-sass": "9.0.0",
"normalize-scss": "^7.0.1",
"nuxt": "2.18.1",
"papaparse": "5.4.1",
@@ -109,8 +109,7 @@
"uuid": "9.0.0",
"vue-chartjs": "^5.3.2",
"vue2-smooth-scroll": "^1.6.0",
"vuejs-datepicker": "1.6.2",
"form-data": "4.0.4"
"vuejs-datepicker": "1.6.2"
},
"resolutions": {
"elliptic": "^6.6.1",
@@ -135,6 +134,7 @@
"@nuxtjs/stylelint-module": "^4.2.2",
"@nuxtjs/svg": "^0.4.1",
"@storybook/addon-coverage": "^0.0.8",
"@storybook/core-client": "6.5.9",
"@storybook/test-runner": "^0.11.0",
"@vue/test-utils": "1.3.4",
"@vue/vue2-jest": "29.2.3",
@@ -163,6 +163,7 @@
"nodemon": "2.0.22",
"postcss": "8",
"prettier": "2.8.7",
"sass": "^1.94.2",
"storybook-addon-designs": "^6.3.1",
"storybook-addon-pseudo-states": "1.15.5",
"stylelint": "^16.3.1",
+160 -581
View File
File diff suppressed because it is too large. Load diff