diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..cffda42f08 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,7 @@ +FROM n8nio/base:20 + +RUN apk add --no-cache --update openssh sudo shadow bash +RUN echo node ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/node && chmod 0440 /etc/sudoers.d/node +RUN mkdir /workspaces && chown node:node /workspaces +USER node +RUN mkdir -p ~/.pnpm-store && pnpm config set store-dir ~/.pnpm-store --global diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..c81220d1b4 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,19 @@ +{ + "name": "n8n", + "dockerComposeFile": "docker-compose.yml", + "service": "n8n", + "workspaceFolder": "/workspaces", + "mounts": [ + "type=bind,source=${localWorkspaceFolder},target=/workspaces,consistency=cached", + "type=bind,source=${localEnv:HOME}/.ssh,target=/home/node/.ssh,consistency=cached", + "type=bind,source=${localEnv:HOME}/.n8n,target=/home/node/.n8n,consistency=cached" + ], + "forwardPorts": [8080, 5678], + "postCreateCommand": "corepack prepare --activate && pnpm install ", + "postAttachCommand": "pnpm build", + "customizations": { + "codespaces": { + "openFiles": ["CONTRIBUTING.md"] + } + } +} diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 0000000000..7ecead94b6 --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,23 @@ +volumes: + postgres-data: + +services: + postgres: + image: postgres:16-alpine + restart: unless-stopped + volumes: + - postgres-data:/var/lib/postgresql/data + environment: + - POSTGRES_DB=n8n + - POSTGRES_PASSWORD=password + + n8n: + build: + context: . + dockerfile: Dockerfile + volumes: + - ..:/workspaces:cached + command: sleep infinity + environment: + DB_TYPE: postgresdb + DB_POSTGRESDB_PASSWORD: password diff --git a/.npmrc b/.npmrc index 688ccc8857..42d2964a04 100644 --- a/.npmrc +++ b/.npmrc @@ -9,3 +9,6 @@ hoist = true shamefully-hoist = true hoist-workspace-packages = false loglevel = warn +package-manager-strict=false +# https://github.com/pnpm/pnpm/issues/7024 +package-import-method=clone-or-copy diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d60df9eb96..6602d748b3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,6 +9,7 @@ Great that you are here and you want to contribute to n8n - [Code of conduct](#code-of-conduct) - [Directory structure](#directory-structure) - [Development setup](#development-setup) + - [Dev Container](#dev-container) - [Requirements](#requirements) - [Node.js](#nodejs) - [pnpm](#pnpm) @@ -60,6 +61,10 @@ The most important directories: If you want to change or extend n8n you have to make sure that all the needed dependencies are installed and the packages get linked correctly. Here's a short guide on how that can be done: +### Dev Container + +If you already have VS Code and Docker installed, you can click [here](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/n8n-io/n8n) to get started. Clicking these links will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use. + ### Requirements #### Node.js diff --git a/n8n.code-workspace b/n8n.code-workspace new file mode 100644 index 0000000000..9d32d7aa04 --- /dev/null +++ b/n8n.code-workspace @@ -0,0 +1,7 @@ +{ + "folders": [ + { + "path": ".", + }, + ], +}