11## Local Sandbox: Full Setup Guide
22
3+ Follow these steps to configure your local environment, build custom extensions, and migrate the database.
4+
35### 1. Build Community Nodes
46
5- This prepares the custom extensions that n8n will load.
7+ Before launching the stack, you must compile the custom extensions n8n will load.
68
79- ** Directory:** ` community-nodes `
810- ** Commands:**
@@ -13,37 +15,42 @@ pnpm build
1315
1416```
1517
16- ### 2. .env file
18+ ### 2. Configure Environment Variables
19+
20+ Initialize your environment settings by cloning the template.
1721
18- Please copy ` .env.example ` in the directory ` docker-compose ` to ` .env ` .
22+ - ** Action: ** In the ` docker-compose ` directory, copy ` .env.example ` to a new file named ` .env ` .
1923
2024### 3. Selective Database Migration
2125
22- We will spin up ** only ** the PostgreSQL container to allow the migration script to run against it via ` localhost ` .
26+ To run migrations, we spin up the PostgreSQL container individually so the migration script can access it via ` localhost ` .
2327
24- - ** Step A: Start Postgres**
25- In the ` docker-compose ` directory:
28+ ** Step A: Start Postgres**
29+ Navigate to the ` docker-compose ` directory and run :
2630
2731``` bash
28- docker compose up -d postgres
32+ docker compose up postgres
2933
3034```
3135
32- - ** Step B: Run Migration**
33- In the ` external-hooks ` directory:
36+ ** Step B: Execute Migration**
37+ In another terminal, navigate to the ` external-hooks ` directory and run :
3438
3539``` bash
3640pnpm install
3741pnpm bundle
3842cp -r drizzle dist/
3943
44+ # Run the migration script against the local container
4045CUSTOM_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/n8n_custom node dist/migrate.cjs # pragma: allowlist secret
4146
4247```
4348
4449### 4. Launch the Full Stack
4550
46- Now that the database is migrated and the nodes are built, bring up the rest of the services.
51+ Once the database is migrated and nodes are built, you can initialize the entire environment.
52+
53+ > If you have an existing Postgres service running in the other terminal, please exist first.
4754
4855- ** Directory:** ` docker-compose `
4956- ** Command:**
0 commit comments