First of all thanks for reading this.
Hi my name is Elias aka. BrutalBirdie
I am currently packaging n8n for Cloudron.
The packaged app source code can be viewed here.
Prerequisite
Cloudron utilizes docker containers which run in a very strict read-only mode and only certain paths are read-write and persistent.
The common data path for user data is /app/data
.
This way I can package the binary app and all the data that needs to be backuped is in a single path.
Making the backups very small and also making upgrade processes a lot easier.
The Problem
After a lot of tinkering I had to learn he hard way that .n8n/config
can not be used for N8N_CONFIG_FILES
this needs to be a separate file.
So I do exactly that.
Excerpt from docker/app/pkg/start.sh
CONFIG_FILE="/app/data/.n8n/app-config.json"
if [[ ! -f $CONFIG_FILE ]]; then
echo "=> Creating config file"
echo "{}" > $CONFIG_FILE
fi
cat $CONFIG_FILE | \
jq '.database.type="postgresdb"' | \
jq '.database.postgresdb.host=env.CLOUDRON_POSTGRESQL_HOST' | \
jq '.database.postgresdb.port=env.CLOUDRON_POSTGRESQL_PORT' | \
jq '.database.postgresdb.user=env.CLOUDRON_POSTGRESQL_USERNAME' | \
jq '.database.postgresdb.password=env.CLOUDRON_POSTGRESQL_PASSWORD' | \
jq '.database.postgresdb.database=env.CLOUDRON_POSTGRESQL_DATABASE' \
> $CONFIG_FILE
When running the app this work as intended.
The file gets generated and used by n8n.
May 28 14:41:28 Loading configuration overwrites from:
May 28 14:41:28 - /app/data/.n8n/app-config.json
May 28 14:41:30 n8n ready on 0.0.0.0, port 5678
May 28 14:41:30 Version: 0.117.0
May 28 14:41:30
May 28 14:41:30 Editor is now accessible via:
May 28 14:41:30 http://localhost:5678/
The config file:
{
"database": {
"type": "postgresdb",
"postgresdb": {
"host": "postgresql",
"port": "5432",
"user": "user6e5a8498ee6647ae8ac1bd1fc52e4434",
"password": "b41b4df616f87683ceae6ee04ed191080077f783acc7f3695fbb04a2b0fbb0e855b924313ccc0c1bc28c28acdd32f7bfc966ebf5369b0d1f38d6cddeb6c54b6c",
"database": "db6e5a8498ee6647ae8ac1bd1fc52e4434"
}
}
}
Working, so far so good.
Now I want to increase the logging level because the app is stuck here:
But this issue is not relevant for this topic.
So I did more reading and tinkering.
Official Doc states:
docs.n8n .io/reference/configuration.html#configuration-via-file
Okay so this config file should be correct, right?
{
"database": {
"type": "postgresdb",
"postgresdb": {
"host": "postgresql",
"port": "5432",
"user": "user6e5a8498ee6647ae8ac1bd1fc52e4434",
"password": "b41b4df616f87683ceae6ee04ed191080077f783acc7f3695fbb04a2b0fbb0e855b924313ccc0c1bc28c28acdd32f7bfc966ebf5369b0d1f38d6cddeb6c54b6c",
"database": "db6e5a8498ee6647ae8ac1bd1fc52e4434"
}
},
"logs": {
"level": "debug"
}
}
Ending in this error message:
Error: configuration param 'logs.level' not declared in the schema
So what is going on here? Am I missing something?