I’m running n8n on my own server as part of our system. We need to make sure the admin account is set up exactly how we want it. This is important because we need an n8n API key for our deployment process, tests, and live environment.
We’re using a custom Postgres setup, so maybe we could add the user with an SQL command? The n8n docs talk about setting up the owner account, but they don’t say how to do it automatically. Any ideas on how to make this part of our setup process?
I’ve found a workaround that might solve your issue, Dave. Instead of relying solely on environment variables or the API, you could leverage Docker’s entrypoint override functionality. Create a custom entrypoint script that runs before n8n starts, setting up your admin account precisely.
Here’s a rough outline of what you could do:
Write a bash script that uses n8n’s CLI to create the admin user
Set this script as the entrypoint in your Docker configuration
The script can then start n8n as usual once it’s done
This method gives you fine-grained control over the admin setup process and integrates smoothly with your existing Docker setup. It’s been reliable in my experience, especially when dealing with complex configurations or multiple environments.
Just remember to properly handle secrets and ensure your script is secure. Good luck with your setup!
I’ve encountered a similar challenge in my n8n deployments. While environment variables are a good start, they don’t offer complete control over the admin account setup. Consider using the n8n API to programmatically configure the account post-installation. You can create a script that runs after n8n starts, utilizing the /users endpoint to create or modify the admin user with exact specifications. This approach allows for more granular control and can be integrated into your deployment pipeline. Remember to secure your API calls and credentials appropriately. Additionally, exploring n8n’s command-line interface (CLI) options might provide alternative methods for initial setup automation.