Merge pull request #704 from AnishSarkar22/feat/replace-logs

fix: update electric-sql docs
This commit is contained in:
Rohan Verma 2026-01-16 14:09:36 -08:00 committed by GitHub
commit cf53338119
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -100,18 +100,26 @@ Follow the steps below based on your PostgreSQL setup.
### Step 1: Configure Environment Variables ### Step 1: Configure Environment Variables
Add the following variables to your root `.env` file: Ensure your environment files are configured. If you haven't set up SurfSense yet, follow the [Manual Installation Guide](/docs/manual-installation) first.
For Electric SQL, verify these variables are set:
**Root `.env`:**
```bash ```bash
ELECTRIC_PORT=5133 ELECTRIC_PORT=5133
POSTGRES_DB=surfsense POSTGRES_HOST=host.docker.internal # Use 'db' for Docker PostgreSQL instance
POSTGRES_HOST=db
ELECTRIC_DB_USER=electric ELECTRIC_DB_USER=electric
ELECTRIC_DB_PASSWORD=electric_password ELECTRIC_DB_PASSWORD=electric_password
NEXT_PUBLIC_ELECTRIC_URL=http://localhost:5133 NEXT_PUBLIC_ELECTRIC_URL=http://localhost:5133
``` ```
> **Note:** Set `POSTGRES_HOST=db` for Docker PostgreSQL, or `POSTGRES_HOST=host.docker.internal` for local PostgreSQL. **Frontend `.env` (`surfsense_web/.env`):**
```bash
NEXT_PUBLIC_ELECTRIC_URL=http://localhost:5133
NEXT_PUBLIC_ELECTRIC_AUTH_MODE=insecure
```
--- ---
@ -119,20 +127,28 @@ NEXT_PUBLIC_ELECTRIC_URL=http://localhost:5133
If you're using the Docker-managed PostgreSQL instance, follow these steps: If you're using the Docker-managed PostgreSQL instance, follow these steps:
**1. Start PostgreSQL and Electric SQL:** **1. Update environment variable:**
In your root `.env` file, set:
```bash
POSTGRES_HOST=db
```
**2. Start PostgreSQL and Electric SQL:**
```bash ```bash
docker-compose up -d db electric docker-compose up -d db electric
``` ```
**2. Run database migration:** **3. Run database migration:**
```bash ```bash
cd surfsense_backend cd surfsense_backend
uv run alembic upgrade head uv run alembic upgrade head
``` ```
**3. Start the backend:** **4. Start the backend:**
```bash ```bash
uv run main.py uv run main.py
@ -203,11 +219,12 @@ Electric SQL is now configured and connected to your local PostgreSQL database.
| Variable | Location | Description | Default | | Variable | Location | Description | Default |
|----------|----------|-------------|---------| |----------|----------|-------------|---------|
| `ELECTRIC_PORT` | docker-compose | Port to expose Electric SQL | `5133` | | `ELECTRIC_PORT` | Root `.env` | Port to expose Electric SQL | `5133` |
| `ELECTRIC_DB_USER` | Backend | Database user for Electric | `electric` | | `POSTGRES_HOST` | Root `.env` | PostgreSQL host (`db` for Docker, `host.docker.internal` for local) | `host.docker.internal` |
| `ELECTRIC_DB_PASSWORD` | Backend | Database password for Electric | `electric_password` | | `ELECTRIC_DB_USER` | Root `.env` | Database user for Electric | `electric` |
| `NEXT_PUBLIC_ELECTRIC_URL` | Frontend | Electric SQL server URL (PGlite connects to this) | `http://localhost:5133` | | `ELECTRIC_DB_PASSWORD` | Root `.env` | Database password for Electric | `electric_password` |
| `NEXT_PUBLIC_ELECTRIC_URL` | Frontend `.env` | Electric SQL server URL (PGlite connects to this) | `http://localhost:5133` |
| `NEXT_PUBLIC_ELECTRIC_AUTH_MODE` | Frontend `.env` | Authentication mode (`insecure` for dev, `secure` for production) | `insecure` |
## Verify Setup ## Verify Setup
To verify Electric SQL is running correctly: To verify Electric SQL is running correctly:
@ -216,7 +233,11 @@ To verify Electric SQL is running correctly:
curl http://localhost:5133/v1/health curl http://localhost:5133/v1/health
``` ```
You should receive a healthy response. You should receive:
```json
{"status":"active"}
```
## Troubleshooting ## Troubleshooting