Skip to content
Open

nwe #26

Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7262673
Update PostgreSQL version to 15 in app.json
kuromi04 Sep 22, 2025
34ace78
Merge pull request #1 from kuromi04/kuromi04-patch-1
kuromi04 Sep 22, 2025
8005517
Update repository URL in app.json
kuromi04 Sep 22, 2025
09dbac1
Merge pull request #2 from kuromi04/kuromi04-patch-2
kuromi04 Sep 22, 2025
e1cd4e0
Update Heroku deploy button link in README
kuromi04 Sep 26, 2025
7a90229
Fix deploy button link in README.md
kuromi04 Sep 26, 2025
a100791
Update repository URL in app.json
kuromi04 Sep 27, 2025
324f696
Merge pull request #4 from kuromi04/kuromi04-patch-4
kuromi04 Sep 27, 2025
f43879c
Improve Heroku deployment for automatic n8n updates
kuromi04 Oct 13, 2025
79c12e2
Merge pull request #5 from kuromi04/codex/improve-heroku-deployment-c…
kuromi04 Oct 13, 2025
81108f3
Update Heroku PostgreSQL plan to essential-0
kuromi04 Oct 18, 2025
d0bf903
Merge pull request #7 from kuromi04/kuromi04-patch-5
kuromi04 Oct 18, 2025
e144831
Update Heroku PostgreSQL plan to essential-0
kuromi04 Oct 18, 2025
cd055ab
Update Heroku configuration for database and run command
kuromi04 Oct 18, 2025
30eda5d
Update Dockerfile
kuromi04 Oct 18, 2025
8fe510c
Simplify entrypoint.sh and improve database handling
kuromi04 Oct 18, 2025
81229f3
Update app.json for n8n Heroku deployment
kuromi04 Oct 18, 2025
5a70539
Update Heroku deploy button link in README
kuromi04 Oct 18, 2025
9717e89
Change Heroku deploy button link
kuromi04 Oct 18, 2025
3eb27b7
Update app.json descriptions and keywords order
kuromi04 Oct 18, 2025
ac93b6e
Update heroku.yml for PostgreSQL addon setup
kuromi04 Oct 18, 2025
93c692d
Remove comments from Dockerfile
kuromi04 Oct 18, 2025
c27911a
Refactor entrypoint.sh for clarity and structure
kuromi04 Oct 18, 2025
61c3d40
Enhance app.json with detailed descriptions and keys
kuromi04 Oct 18, 2025
0217420
Fix formatting in README.md
kuromi04 Oct 18, 2025
18457e3
Update Heroku PostgreSQL plan in app.json
kuromi04 Oct 18, 2025
49402af
Refactor Dockerfile for entrypoint and permissions
kuromi04 Oct 18, 2025
3630ac4
Revise app.json for n8n Heroku deployment
kuromi04 Oct 18, 2025
0077428
Refactor entrypoint.sh for improved database config
kuromi04 Oct 18, 2025
314d841
Update heroku.yml for PostgreSQL configuration
kuromi04 Oct 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Dockerfile
FROM n8nio/n8n:latest

USER root

WORKDIR /home/node/packages/cli
ENTRYPOINT []

COPY ./entrypoint.sh /
ENV N8N_HOST=0.0.0.0
ENV N8N_PORT=8080
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Heroku Port Conflict with Dockerfile

Hardcoding N8N_PORT=8080 in the Dockerfile conflicts with Heroku's dynamic PORT assignment. This prevents the application from binding to the correct port and starting successfully on Heroku, as the entrypoint script no longer respects Heroku's PORT variable.

Fix in Cursor Fix in Web

EXPOSE 8080
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
CMD ["/entrypoint.sh"]
CMD ["/entrypoint.sh"]
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
# n8n-heroku

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://dashboard.heroku.com/new?template=https://github.com/n8n-io/n8n-heroku/tree/main)
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/kuromi04/n8n-heroku2025)




## n8n - Free and open fair-code licensed node based Workflow Automation Tool.

This is a [Heroku](https://heroku.com/)-focused container implementation of [n8n](https://n8n.io/).

Use the **Deploy to Heroku** button above to launch n8n on Heroku. When deploying, make sure to check all configuration options and adjust them to your needs. It's especially important to set `N8N_ENCRYPTION_KEY` to a random secure value.
Use the **Deploy to Heroku** button above to launch n8n on Heroku. When deploying, make sure to check all configuration options
and adjust them to your needs. It's especially important to set `N8N_ENCRYPTION_KEY` to a random secure value.

Refer to the [Heroku n8n tutorial](https://docs.n8n.io/hosting/server-setups/heroku/) for more information.

If you have questions after trying the tutorials, check out the [forums](https://community.n8n.io/).

## Automatic n8n version management

This container keeps the n8n CLI up to date without requiring code changes:

- Set the `N8N_VERSION` config var to pin a specific n8n release. The default value (`latest`) resolves to the newest stable version on each deploy or dyno restart.
- Automatic upgrades can be disabled by setting `N8N_AUTO_UPDATE=false` if you prefer to manage updates manually.

During startup the entrypoint script compares the installed version with the desired one and installs upgrades when required, ensuring that only n8n itself changes while the rest of the environment remains stable.
66 changes: 24 additions & 42 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,25 @@
{
"name": "n8n",
"description": "deploy n8n to heroku without any hassle",
"keywords": [
"n8n",
"node",
"automation"
],
"website": "https://n8n.io",
"repository": "https://github.com/n8n-io/n8n-heroku",
"logo": "https://raw.githubusercontent.com/n8n-io/n8n-heroku/main/n8n_logo.png",
"success_url": "/",
"stack": "container",
"env": {
"GENERIC_TIMEZONE": {
"description": "Time Zone to use with Heroku. You can find the name of your timezone for example here: https://momentjs.com/timezone/.",
"value": "Europe/Berlin"
},
"N8N_ENCRYPTION_KEY": {
"description": "Set the n8n encryption key to a static value to avoid Heroku overriding it (causing authentication to fail).",
"value": "change-me-to-something-else"
},
"WEBHOOK_URL": {
"description": "Replace <appname> with your Heroku application name. This will ensure the correct webhook URLs are being shown in n8n.",
"value": "https://<appname>.herokuapp.com"
},
"DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED": {
"description": "SSL is required to connect to Postgres on Heroku",
"value": "false"
}
},
"addons": [
{
"plan": "heroku-postgresql",
"options": {
"version": "14"
}
},
{
"plan": "papertrail:choklad"
}
]
}
"name": "n8n on Heroku",
"description": "Instala n8n en Heroku con despliegue 1-click y actualizaciones simples",
"stack": "container",
"env": {
"N8N_BASIC_AUTH_ACTIVE": { "value": "true" },
"N8N_BASIC_AUTH_USER": { "description": "Usuario para acceder a n8n", "value": "admin" },
"N8N_BASIC_AUTH_PASSWORD": { "description": "Contraseña para n8n", "value": "changeme" },
"N8N_ENCRYPTION_KEY": { "description": "Clave de cifrado segura", "value": "use-uuid-generator" },
"N8N_PORT": { "value": "8080" }
},
"addons": [
{ "plan": "heroku-postgresql: Essential-0" }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Heroku Addon Plan Syntax Error

The heroku-postgresql addon plan in app.json uses invalid syntax. It includes a space after the colon and incorrect casing for 'Essential-0', which prevents Heroku from provisioning the addon and causes deployment to fail.

Fix in Cursor Fix in Web

],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: SSL Connection Issue with Heroku PostgreSQL

The updated entrypoint.sh uses DB_POSTGRESDB_CONNECTION_STRING directly, which, combined with the removal of DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED from app.json, will likely prevent n8n from connecting to Heroku PostgreSQL due to SSL requirements. Additionally, the PostgreSQL plan specification in app.json is inconsistent.

Additional Locations (1)

Fix in Cursor Fix in Web

"build": {
"docker": {
"web": "Dockerfile"
}
},
"run": {
"web": "/entrypoint.sh"
},
"keywords": ["n8n", "heroku", "automation"]
}

36 changes: 10 additions & 26 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
#!/bin/sh

# check if port variable is set or go with default
if [ -z ${PORT+x} ]; then echo "PORT variable not defined, leaving N8N to default port."; else export N8N_PORT="$PORT"; echo "N8N will start on '$PORT'"; fi

# regex function
parse_url() {
eval $(echo "$1" | sed -e "s#^\(\(.*\)://\)\?\(\([^:@]*\)\(:\(.*\)\)\?@\)\?\([^/?]*\)\(/\(.*\)\)\?#${PREFIX:-URL_}SCHEME='\2' ${PREFIX:-URL_}USER='\4' ${PREFIX:-URL_}PASSWORD='\6' ${PREFIX:-URL_}HOSTPORT='\7' ${PREFIX:-URL_}DATABASE='\9'#")
}

# prefix variables to avoid conflicts and run parse url function on arg url
PREFIX="N8N_DB_" parse_url "$DATABASE_URL"
echo "$N8N_DB_SCHEME://$N8N_DB_USER:$N8N_DB_PASSWORD@$N8N_DB_HOSTPORT/$N8N_DB_DATABASE"
# Separate host and port
N8N_DB_HOST="$(echo $N8N_DB_HOSTPORT | sed -e 's,:.*,,g')"
N8N_DB_PORT="$(echo $N8N_DB_HOSTPORT | sed -e 's,^.*:,:,g' -e 's,.*:\([0-9]*\).*,\1,g' -e 's,[^0-9],,g')"

export DB_TYPE=postgresdb
export DB_POSTGRESDB_HOST=$N8N_DB_HOST
export DB_POSTGRESDB_PORT=$N8N_DB_PORT
export DB_POSTGRESDB_DATABASE=$N8N_DB_DATABASE
export DB_POSTGRESDB_USER=$N8N_DB_USER
export DB_POSTGRESDB_PASSWORD=$N8N_DB_PASSWORD

# kickstart nodemation
n8n
# entrypoint.sh
#!/usr/bin/env bash
set -e
: "${WEBHOOK_URL:=https://${HEROKU_APP_NAME}.herokuapp.com/}"
export WEBHOOK_URL
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Heroku App Name Not Set Causes Malformed URL

The entrypoint.sh script defaults WEBHOOK_URL using HEROKU_APP_NAME. Since HEROKU_APP_NAME is not automatically provided by Heroku, the WEBHOOK_URL becomes malformed (e.g., https://.herokuapp.com/), breaking webhook functionality.

Fix in Cursor Fix in Web

if [ -n "$DATABASE_URL" ]; then
export DB_TYPE=postgresdb
export DB_POSTGRESDB_CONNECTION_STRING="$DATABASE_URL"
fi
exec n8n start
13 changes: 7 additions & 6 deletions heroku.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# heroku.yml
setup:
addons:
- plan: heroku-postgresql
as: DATABASE

addons:
- plan: heroku-postgresql:mini
build:
docker:
web: Dockerfile
docker:
web: Dockerfile
run:
web: /entrypoint.sh