In my experience, automating the assignment of the owner account in a self-hosted n8n instance is achievable by leveraging initial configuration scripts triggered during container startup. I managed to accomplish this by setting appropriate environment variables upon container initialization, integrating them with custom PostgreSQL seeding routines. The key step is ensuring that the initial database population process recognizes these credentials, thus establishing the owner account. Customizing your Docker Compose configuration to include this automated seeding strategy has proven effective in my deployment setups.
i solved it by adding a custom startup script that seeds the owner into the db when the container boots. works ok for my setup, though it’s a bit kludgy if you ask me. check your logs to tweak it if necassary.
I have been refining my n8n setups for several months now, and one reliable method to automate owner account assignment involves customizing the container entrypoint to include an initialization script. I adapted the official image by overriding the startup command, integrating a preliminary script that verifies whether the owner exists in the database. This script waits until the PostgreSQL service is fully ready using simple health checks before executing the owner seeding command. The approach not only ensures consistency across deployments but also simplifies maintenance when scaling the setup. This solution has worked seamlessly in environments under both experimental and production loads.