What are the best practices for dealing with multiple environments (i.e., Development, Staging and Production)? For example, I’m developing locally with Docker Compose and using Postgres as the backing store. What’s the recommended way for deploying/promoting to another environment? I need to be able to move the workflow configurations into another environment with it’s specific ENV variables.
How should I handle the workflow configurations - in frameworks like Rails or Hasura there is the idea of migrations. In Hasura for example, whenever you make changes to configuration, Hasura updates a yaml metadata configuration file. Is there a way to do something similar with the n8n json files so that when starting up a n8n instance it ingests the json config files and sets up all the workflows?
Hey, @ChaseP!
You can find out how to deploy to production using docker here.
You can also find the information on configurations here.
While you’re in the development, I would suggest you download your workflow after you build it. You can then use this workflow in production by pasting the JSON in the editor. This will add the workflow to your production instance of n8n with all your configurations. I would also suggest you make sure that you have the right credentials for your nodes.
I hope this helps.
Please let me know if you have any questions.
Is there a way to do this programmatically (via API)? For example, read in the JSON configuration from the file system at application start (or based on a migration CLI command). Something like this is a necessity for multi-environment setups and CI.
Taking advantage of your post, I’m wondering about the best way to set up a staging and production environment on the same machine using Docker Compose. Does anyone have any ideas on best practices for this?
The current recommended approach would be to use the environments feature with exernal secret stores this uses Git to store your workflows and you can move workflows to production fairly quickly. You can find out more on this in our docs here: Source control and environments | n8n Docs
If you don’t have the enterprise version of n8n you would need to manually build out your own process using the cli to export credentials and workflows then importing them as needed, You can also use the API to update workflows as well but you would still need a way to handle credentials.