This commit is contained in:
Deborah Barnard 2022-11-08 10:10:46 +00:00
parent 80401768b8
commit babbb6526a
2 changed files with 26 additions and 20 deletions

View File

@ -2,31 +2,37 @@
This hosting guide shows you how to self-host n8n on Heroku. It uses:
- [Docker Compose](https://docs.docker.com/compose/){:target="\_blank" .external-link} to create and define the application components and how they work together.
- [Heroku's PostgreSQL service](https://devcenter.heroku.com/categories/heroku-postgres){:target="\_blank" .external-link} to host n8n's data storage.
- [Heroku's CLI tool](https://devcenter.heroku.com/articles/heroku-cli){:target="\_blank" .external-link}.
- A "[Deploy to Heroku](https://devcenter.heroku.com/articles/heroku-button){:target="\_blank" .external-link}" button to offer a one click, with minor configuration, deployment.
- [Docker Compose](https://docs.docker.com/compose/){:target="_blank" .external-link} to create and define the application components and how they work together.
- [Heroku's PostgreSQL service](https://devcenter.heroku.com/categories/heroku-postgres){:target="_blank" .external-link} to host n8n's data storage.
- [Heroku's CLI tool](https://devcenter.heroku.com/articles/heroku-cli){:target="_blank" .external-link}.
- A **Deploy to Heroku** button offering a one click, with minor configuration, deployment.
## Use deploy template to create a Heroku project
## Use the deploy template to create a Heroku project
The quickest way to get started with deploying n8n to Heroku is to open the repository that contains the template code and click the `Deploy to Heroku` button at the top of the read me.
The quickest way to get started with deploying n8n to Heroku is using the **Deploy to Heroku** button:
This opens the "Create New App" page on Heroku where you can set a name for the project that uses the template and the region to deploy the project to.
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/n8n-io/n8n-heroku/tree/main)
### Change environment variables
This opens the **Create New App** page on Heroku. Set a name for the project, and choose the region to deploy the project to.
### Configure environment variables
Heroku pre-fills the configuration options defined in the `setup` > `config` section of the `Dockerfile`, which also sets default values for the environment variables n8n uses.
You can change any of these values to suit your needs, but you should change the following values:
You can change any of these values to suit your needs. You must change the following values:
- **N8N_BASIC_AUTH_USER** and **N8N_BASIC_AUTH_PASSWORD** which define the admin user account details.
- **N8N_ENCRYPTION_KEY**, [which n8n uses to encrypt user account details](/hosting/configuration/#encryption-key) before saving to the database.
- **N8N_BASIC_AUTH_USER** and **N8N_BASIC_AUTH_PASSWORD**, which define the admin user account details.
- **N8N_ENCRYPTION_KEY**, which n8n uses to [encrypt user account details](/hosting/configuration/#encryption-key) before saving to the database.
- **WEBHOOK_URL** should match the application name you create to ensure that webhooks have the correct URL.
When Heroku has built and deployed the app it provides links to manage or view the application.
### Deploy n8n
Select **Deploy app**.
After Heroku builds and deploys the app it provides links to **Manage App** or **View** the application.
!!! note "Heroku and DNS"
[Read this page of the Heroku documentation](https://devcenter.heroku.com/categories/networking-dns){:target="\_blank" .external-link} to find out how to connect your domain to a Heroku application.
Refer to the [Heroku documentation](https://devcenter.heroku.com/categories/networking-dns){:target="_blank" .external-link} to find out how to connect your domain to a Heroku application.
## Changing the deployment template
@ -34,19 +40,18 @@ You can make changes to the deployment template by forking the repository and de
### The Dockerfile
By default the Dockerfile pulls the latest n8n image, if you want to use a different or fixed version, then update the image tag on the top line of the _Dockerfile_.
By default the Dockerfile pulls the latest n8n image, if you want to use a different or fixed version, then update the image tag on the top line of the `Dockerfile`.
### Heroku and exposing ports
Heroku doesn't allow Docker-based applications to define an exposed port with the `EXPOSE` command. Instead, Heroku provides a `PORT` environment variable that it dynamically populates at application runtime. The _entrypoint.sh_ file overrides the default Docker image command to instead set the port variable that Heroku provides. You can then access n8n on port 80 in a web browser.
Heroku doesn't allow Docker-based applications to define an exposed port with the `EXPOSE` command. Instead, Heroku provides a `PORT` environment variable that it dynamically populates at application runtime. The `entrypoint.sh` file overrides the default Docker image command to instead set the port variable that Heroku provides. You can then access n8n on port 80 in a web browser.
!!! note "Docker limitations with Heroku"
[Read this guide](https://devcenter.heroku.com/articles/container-registry-and-runtime#unsupported-dockerfile-commands){:target="\_blank" .external-link} for more details on the limitations of using Docker with Heroku.
[Read this guide](https://devcenter.heroku.com/articles/container-registry-and-runtime#unsupported-dockerfile-commands){:target="_blank" .external-link} for more details on the limitations of using Docker with Heroku.
### Configuring Heroku
The _heroku.yml_ file defines the application you want to create on Heroku. It consists of two sections.
The `heroku.yml` file defines the application you want to create on Heroku. It consists of two sections:
`setup` > `addons` defines the Heroku addons to use, in this case, only the PostgreSQL database.
The `build` section defines how Heroku will build the application. In this case it uses the Docker buildpack to build a `web` service based on the supplied `Dockerfile`.
* `setup` > `addons` defines the Heroku addons to use. In this case, the PostgreSQL database addon.
* The `build` section defines how Heroku builds the application. In this case it uses the Docker buildpack to build a `web` service based on the supplied `Dockerfile`.

View File

@ -5,6 +5,7 @@ Guides to self-hosting n8n with:
* [Docker Compose](/hosting/server-setups/docker-compose/)
* [Caddy](/hosting/server-setups/caddy/)
* [Digital Ocean](/hosting/server-setups/digital-ocean/) (using Caddy and Docker Compose)
* [Heroku](/hosting/server-setups/heroku/)
* [AWS](/hosting/server-setups/aws/)
* [Google Cloud Platform](/hosting/server-setups/google-cloud/)