The project automates the deployment of an n8n instance on the Google Cloud Platform (GCP). It uses a combination of shell scripts and Docker Compose to provision the infrastructure and configure the application.
provision-cloud.sh: This is the main script that orchestrates the deployment. It runs on the user's local machine and uses thegcloudCLI to:- Prompt the user for GCP project details and a domain name.
- Provision a static IP address, a firewall rule, and a Compute Engine VM.
- Copy the configuration templates and the setup script to the VM.
- Execute the setup script on the VM.
setup-instance.sh: This script runs on the newly created VM and does the following:- Installs Docker and Docker Compose.
- Sets up the application directory.
- Configures the
Caddyfileand.envfiles with the user-provided domain name. - Starts the n8n and Caddy containers using Docker Compose.
templates/: This directory contains the configuration files:docker-compose.yml: Defines then8nandcaddyservices.Caddyfile: Configures Caddy as a reverse proxy with automatic HTTPS..env: Contains the environment variables for the n8n application.
The project is not "built" in a traditional sense. It is "run" to deploy the n8n application.
Prerequisites:
- Google Cloud SDK (
gcloud) installed and configured. - A GCP project with billing enabled and necessary permissions.
- A registered domain name.
To run the deployment:
- Clone the repository.
- Execute the
provision-cloud.shscript:bash provision-cloud.sh
- Follow the interactive prompts.
- Update the DNS A record for the domain as instructed by the script.
- Separation of Concerns: The deployment process is split into two scripts:
provision-cloud.shfor local orchestration andsetup-instance.shfor remote configuration. This makes the process more modular and easier to debug. - Templating: The configuration files in the
templatesdirectory use placeholders (e.g.,__DOMAIN_NAME__) that are dynamically replaced by thesetup-instance.shscript. This allows for easy customization of the deployment. - Automation: The entire process, from infrastructure provisioning to application deployment, is automated, requiring minimal user intervention.