I’m running a self-hosted n8n automation platform and need to automatically set up the admin account during deployment. My workflow requires an API key for our CI/CD pipeline and production environment setup.
Since I’m using PostgreSQL, I could potentially insert the owner data directly through SQL scripts. The official docs mention manual setup but don’t explain automation options. Has anyone found a way to bypass the initial setup wizard?
I’ve hit this same issue. Just add these environment variables to your n8n container: [email protected] and N8N_OWNER_PASSWORD=your_secure_password. N8n will auto-create the owner account on startup if none exists - skips the setup wizard entirely. Once it’s running, POST to /rest/login with those credentials, grab the session, and create your API keys. Don’t hardcode the password in your compose file though - use Docker secrets or something similar for production.
I used environment variables plus an initialization script. Besides N8N_OWNER_EMAIL and N8N_OWNER_PASSWORD, set N8N_ENCRYPTION_KEY to prevent regeneration problems when restarting. I wrote a bash script that waits for n8n to start, then curls the /rest/me endpoint to check if the owner exists before generating API keys. The script runs in its own container in the same compose file with depends_on. This works reliably across deployments and handles stuff like database resets way better than messing with SQL directly. Don’t forget proper restart policies since owner creation only happens on first startup.
sure! just set N8N_USER_MANAGEMENT_DISABLED=true in your env vars. but keep in mind, if you want user accounts later, u might have to add them manually or remove that flag to do the setup again.