### Install QEMU and Libvirt Source: https://docs.n8n.io/hosting/installation/server-setups/openshift-crc Install necessary packages for libvirt on Ubuntu systems to resolve 'libvirt not found' errors during `crc setup`. ```bash sudo apt install -y qemu-kvm libvirt-daemon-system libvirt-clients sudo systemctl start libvirtd ``` -------------------------------- ### Start and Enable libvirt Service Source: https://docs.n8n.io/hosting/installation/server-setups/openshift-crc Start the libvirt service and configure it to automatically start on system boot. Verify its status to ensure it is running. ```bash sudo systemctl start libvirtd sudo systemctl enable libvirtd ``` ```bash sudo systemctl status libvirtd ``` -------------------------------- ### Try n8n with npx Source: https://docs.n8n.io/hosting/installation/npm Use this command to try n8n without a full installation. It downloads necessary files and starts n8n, accessible at http://localhost:5678. ```bash npx n8n ``` -------------------------------- ### Start n8n Tunnel Service and Local Instance Source: https://docs.n8n.io/hosting/installation/npm For local development, this starts the cloudflared tunnel service and then runs n8n locally. Docker is required for the tunnel service. This setup is not safe for production. ```bash # Terminal 1: Start the cloudflared tunnel service pnpm --filter n8n-containers services --services cloudflared # Terminal 2: Start n8n locally pnpm dev ``` -------------------------------- ### Install project dependencies Source: https://docs.n8n.io/integrations/creating-nodes/build/declarative-style-node Install the necessary dependencies for the node development project. ```bash npm i ``` -------------------------------- ### Install Docker Compose on Hetzner Source: https://docs.n8n.io/hosting/installation/server-setups/hetzner Updates the package list and installs the Docker Compose plugin. ```bash apt update && apt -y upgrade apt install docker-compose-plugin ``` -------------------------------- ### Example Caddyfile Configuration Source: https://docs.n8n.io/hosting/installation/server-setups/digital-ocean An example of how the Caddyfile might look with a specific domain like 'automate.example.com' configured for the n8n reverse proxy. ```plaintext automate.example.com { reverse_proxy n8n:5678 { flush_interval -1 } } ``` -------------------------------- ### Install community node Source: https://docs.n8n.io/integrations/community-nodes/installation/manual-install Install a specific node package from the npm registry. ```bash npm i n8n-nodes-nodeName ``` -------------------------------- ### Queue Metrics Output Example Source: https://docs.n8n.io/hosting/configuration/configuration-examples/prometheus Example output format for queue-related metrics exposed by n8n. ```text 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ``` ```text # HELP n8n_scaling_mode_queue_jobs_active Current number of jobs being processed across all workers in scaling mode. # TYPE n8n_scaling_mode_queue_jobs_active gauge n8n_scaling_mode_queue_jobs_active 0 # HELP n8n_scaling_mode_queue_jobs_completed Total number of jobs completed across all workers in scaling mode since instance start. # TYPE n8n_scaling_mode_queue_jobs_completed counter n8n_scaling_mode_queue_jobs_completed 0 # HELP n8n_scaling_mode_queue_jobs_failed Total number of jobs failed across all workers in scaling mode since instance start. # TYPE n8n_scaling_mode_queue_jobs_failed counter n8n_scaling_mode_queue_jobs_failed 0 # HELP n8n_scaling_mode_queue_jobs_waiting Current number of enqueued jobs waiting for pickup in scaling mode. ``` -------------------------------- ### Run CRC Setup Source: https://docs.n8n.io/hosting/installation/server-setups/openshift-crc Execute the CRC setup command. This is a one-time operation that configures KVM networking, checks system requirements, and downloads the CRC bundle. ```bash crc setup ``` -------------------------------- ### Install n8n-node Globally Source: https://docs.n8n.io/integrations/creating-nodes/build/n8n-node Install the n8n-node CLI globally using npm for system-wide access. ```bash npm install --global @n8n/node-cli ``` -------------------------------- ### Verify Docker and Docker Compose Installation Source: https://docs.n8n.io/hosting/installation/server-setups/docker-compose Run these commands to confirm that Docker and Docker Compose are installed and accessible on your system. ```bash docker --version docker compose version ``` -------------------------------- ### Conversational Agent Prompt Example Source: https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/conversational-agent This example demonstrates how to structure the human message for the Conversational Agent, including tool definitions, format instructions, and user input. ```text TOOLS ------ Assistant can ask the user to use tools to look up information that may be helpful in answering the user's original question. The tools the human can use are: {tools} {format_instructions} USER'S INPUT -------------------- Here is the user's input (remember to respond with a markdown code snippet of a JSON blob with a single action, and NOTHING else): {{input}} ``` -------------------------------- ### Start n8n with Docker and PostgreSQL Source: https://docs.n8n.io/hosting/installation/docker This command starts the n8n container with PostgreSQL as the database. It requires setting various PostgreSQL connection environment variables in addition to the standard n8n configuration. ```bash docker volume create n8n_data docker run -it --rm \ --name n8n \ -p 5678:5678 \ -e GENERIC_TIMEZONE="" \ -e TZ="" \ -e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \ -e N8N_RUNNERS_ENABLED=true \ -e DB_TYPE=postgresdb \ -e DB_POSTGRESDB_DATABASE= \ -e DB_POSTGRESDB_HOST= \ -e DB_POSTGRESDB_PORT= \ -e DB_POSTGRESDB_USER= \ -e DB_POSTGRESDB_SCHEMA= \ -e DB_POSTGRESDB_PASSWORD= \ -v n8n_data:/home/node/.n8n \ docker.n8n.io/n8nio/n8n ``` -------------------------------- ### Create n8n-node Project Without Installing Source: https://docs.n8n.io/integrations/creating-nodes/build/n8n-node Use this command to set up an n8n-node project locally without globally installing the tool. Subsequent commands are run via npm scripts. ```bash npm create @n8n/node@latest ``` -------------------------------- ### Install KVM and libvirt Source: https://docs.n8n.io/hosting/installation/server-setups/openshift-crc Install KVM (Linux's hypervisor) and libvirt components necessary for CRC to manage the OpenShift cluster's virtual machine. This includes qemu-kvm, libvirt-daemon-system, libvirt-clients, and bridge-utils. ```bash sudo apt install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils ``` -------------------------------- ### Setup multi-instance environment Source: https://docs.n8n.io/hosting/installation/server-setups/openshift-crc Initializes the OpenShift project and adds the Bitnami Helm repository for required services. ```bash oc new-project $NAMESPACE ``` ```bash helm repo add bitnami https://charts.bitnami.com/bitnami helm repo update ``` -------------------------------- ### Install n8n Globally with npm Source: https://docs.n8n.io/hosting/installation/npm Installs the latest stable version of n8n globally on your system. After installation, start n8n using the 'n8n' command. ```bash npm install n8n -g ``` ```bash n8n ``` ```bash n8n start ``` -------------------------------- ### Install and Configure NetworkManager Source: https://docs.n8n.io/hosting/installation/server-setups/openshift-crc Install NetworkManager, which CRC requires for managing DNS entries for the cluster's internal domains. Start and enable the service, then verify its connection status. ```bash sudo apt install -y network-manager sudo systemctl start NetworkManager sudo systemctl enable NetworkManager ``` ```bash nmcli general status ``` -------------------------------- ### Create and navigate to nodes directory Source: https://docs.n8n.io/integrations/community-nodes/installation/manual-install Prepare the directory structure required for manual node installation. ```bash mkdir ~/.n8n/nodes cd ~/.n8n/nodes ``` -------------------------------- ### Navigate to Downloads Directory Source: https://docs.n8n.io/hosting/installation/server-setups/openshift-crc Change the current directory to your Downloads folder to begin the installation process. ```bash cd ~/Downloads ``` -------------------------------- ### Start n8n worker processes Source: https://docs.n8n.io/hosting/scaling/queue-mode Commands to initiate worker processes for executing workflows in a queue-based setup. ```bash ./packages/cli/bin/n8n worker ``` ```bash docker run --name n8n-queue -p 5679:5678 docker.n8n.io/n8nio/n8n worker ``` -------------------------------- ### Start n8n Instance Source: https://docs.n8n.io/integrations/creating-nodes/build/declarative-style-node Command to launch the n8n application after linking custom nodes. ```bash n8n start ``` -------------------------------- ### Get current datetime in expressions and code nodes Source: https://docs.n8n.io/data/specific-data-types/luxon Examples of accessing the current time using $now in expressions, JavaScript code nodes, and Python code nodes. ```javascript {{$now}} // n8n displays the ISO formatted timestamp // For example 2022-03-09T14:02:37.065+00:00 {{"Today's date is " + $now}} // n8n displays "Today's date is " // For example "Today's date is 1646834498755" ``` ```javascript $now // n8n displays // For example 2022-03-09T14:00:25.058+00:00 let rightNow = "Today's date is " + $now // n8n displays "Today's date is " // For example "Today's date is 1646834498755" ``` ```python _now # n8n displays # For example 2022-03-09T14:00:25.058+00:00 rightNow = "Today's date is " + str(_now) # n8n displays "Today's date is " # For example "Today's date is 1646834498755" ``` -------------------------------- ### Create Custom Directory and Initialize npm Source: https://docs.n8n.io/integrations/creating-nodes/test/run-node-locally If the `~/.n8n/custom` directory does not exist, create it manually and initialize npm within it. This is a troubleshooting step for local installations. ```bash # Create custom directory if it doesn't exist mkdir -p ~/.n8n/custom cd ~/.n8n/custom npm init -y ``` -------------------------------- ### Example: Get Binary Data Buffer for First Item Source: https://docs.n8n.io/code/cookbook/code-node/get-binary-data-buffer Retrieves the binary data buffer for the first input item (index 0) using the default 'data' property name. ```javascript let binaryDataBufferItem = await this.helpers.getBinaryDataBuffer(0, 'data'); // Returns the data in the binary buffer for the first input item ``` -------------------------------- ### Set up OpenShift Environment Source: https://docs.n8n.io/hosting/installation/server-setups/openshift-crc Configure environment variables and log in to OpenShift for n8n deployment. ```bash eval $(crc oc-env) export NAMESPACE=n8n-YYYYMMDD # use your original date oc login -u kubeadmin -p https://api.crc.testing:6443 ``` -------------------------------- ### Install Helm Source: https://docs.n8n.io/hosting/installation/server-setups/openshift-crc Install Helm, a package manager for Kubernetes, which is used to install n8n and its supporting services. ```bash curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash ``` -------------------------------- ### Install MinIO via Helm Source: https://docs.n8n.io/hosting/installation/server-setups/openshift-crc Deploys a MinIO instance for S3-compatible storage using the Bitnami Helm chart. ```bash helm install minio bitnami/minio \ --namespace $NAMESPACE \ --set auth.rootUser=minioadmin \ --set auth.rootPassword='MinioStrongPassword123' \ --set global.compatibility.openshift.adaptSecurityContext=auto \ --wait ``` -------------------------------- ### Create Database and User Source: https://docs.n8n.io/hosting/installation/server-setups/google-cloud-run Initialize the n8n database and create a dedicated user for application access. ```bash gcloud sql databases create n8n --instance=n8n-db ``` ```bash gcloud sql users create n8n-user \ --instance=n8n-db \ --password="change-this-password" ``` -------------------------------- ### Start CRC Source: https://docs.n8n.io/hosting/installation/server-setups/openshift-crc Command to start the CodeReady Containers environment. ```bash crc start ``` -------------------------------- ### GET /templates/collections Source: https://docs.n8n.io/hosting/configuration/configuration-examples/custom-templates List or get specific template collections. ```APIDOC ## GET /templates/collections ### Description List all template collections or get a specific one by ID. ### Method GET ### Endpoint /templates/collections or /templates/collections/ ### Parameters #### Query Parameters - **category** (comma-separated list of strings) - Optional - The categories to search within - **search** (string) - Optional - The search query ``` -------------------------------- ### Build and Link Your Node Locally Source: https://docs.n8n.io/integrations/creating-nodes/test/run-node-locally After developing your node, build it and then link it locally. This makes your node available for testing. ```bash # In your node directory npm run build npm link ``` -------------------------------- ### Install n8n Next Version Source: https://docs.n8n.io/hosting/installation/npm Installs the latest pre-release version of n8n, often used for testing upcoming features. This command can be used for both initial installation and updates. ```bash npm install -g n8n@next ``` -------------------------------- ### Install Redis via Helm Source: https://docs.n8n.io/hosting/installation/server-setups/openshift-crc Deploys a standalone Redis instance using the Bitnami Helm chart. ```bash helm install redis bitnami/redis \ --namespace $NAMESPACE \ --set auth.enabled=false \ --set architecture=standalone \ --set global.compatibility.openshift.adaptSecurityContext=auto \ --wait ``` -------------------------------- ### Clone the n8n node starter repository Source: https://docs.n8n.io/integrations/creating-nodes/build/declarative-style-node Use these commands to clone the template repository and navigate into the project directory. ```bash git clone https://github.com//.git n8n-nodes-nasa-pics cd n8n-nodes-nasa-pics ``` -------------------------------- ### Verify Helm Installation Source: https://docs.n8n.io/hosting/installation/server-setups/openshift-crc Confirm that Helm has been installed successfully by checking its version. ```bash helm version ``` -------------------------------- ### Configure Caddyfile Source: https://docs.n8n.io/hosting/installation/server-setups/digital-ocean Open the Caddyfile in the caddy_config directory using nano to configure domain settings. ```bash nano caddy_config/Caddyfile ``` -------------------------------- ### Initialize Custom Directory Source: https://docs.n8n.io/integrations/creating-nodes/build/declarative-style-node Commands to create and initialize the custom nodes directory if it does not exist. ```bash mkdir custom cd custom npm init ``` -------------------------------- ### Verify CRC Installation Source: https://docs.n8n.io/hosting/installation/server-setups/openshift-crc Check the CRC installation by running the version command. ```bash crc version ``` -------------------------------- ### Verify n8n-node Installation Source: https://docs.n8n.io/integrations/creating-nodes/build/n8n-node Check if the n8n-node CLI is installed and accessible by verifying its version. ```bash n8n-node --version ``` -------------------------------- ### Install PostgreSQL via Helm Source: https://docs.n8n.io/hosting/installation/server-setups/openshift-crc Deploys a PostgreSQL instance using the Bitnami Helm chart with OpenShift compatibility enabled. ```bash helm install postgresql bitnami/postgresql \ --namespace $NAMESPACE \ --set auth.username=n8n \ --set auth.password='YourStrongPassword123' \ --set auth.database=n8n_enterprise \ --set global.compatibility.openshift.adaptSecurityContext=auto \ --wait ``` -------------------------------- ### Create Values File Source: https://docs.n8n.io/hosting/installation/server-setups/openshift-crc Initializes the values file for the n8n Helm deployment. ```bash nano n8n-multimain-ocp-values.yaml ``` -------------------------------- ### Start n8n with Docker (SQLite) Source: https://docs.n8n.io/hosting/installation/docker This command starts the n8n container using Docker, creating a persistent volume for data, mapping port 5678, and setting timezone and other environment variables. It defaults to using SQLite for data storage. ```bash docker volume create n8n_data docker run -it --rm \ --name n8n \ -p 5678:5678 \ -e GENERIC_TIMEZONE="" \ -e TZ="" \ -e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \ -e N8N_RUNNERS_ENABLED=true \ -v n8n_data:/home/node/.n8n \ docker.n8n.io/n8nio/n8n ``` -------------------------------- ### Install specific node version Source: https://docs.n8n.io/integrations/community-nodes/installation/manual-install Install a specific version of a node package by appending the version tag. ```bash npm install n8n-nodes-nodeName@version ``` -------------------------------- ### Install virtiofsd Source: https://docs.n8n.io/hosting/installation/server-setups/openshift-crc Install virtiofsd, a component required by CRC for efficient filesystem sharing between the host and the cluster VM. ```bash sudo apt install -y virtiofsd ``` -------------------------------- ### Create Postgres Database Instance Source: https://docs.n8n.io/hosting/installation/server-setups/google-cloud-run Provision a Cloud SQL Postgres instance. Ensure the root password is updated before execution. ```bash gcloud sql instances create n8n-db \ --database-version=POSTGRES_13 \ --tier=db-f1-micro \ --region=$REGION \ --root-password="change-this-password" \ --storage-size=10GB \ --availability-type=ZONAL \ --no-backup \ --storage-type=HDD ```