I use db less config.
I set KONGA_SEED_KONG_NODE_DATA_SOURCE_FILE.
It never worked. I need help, please ~~



Works only from 0.14.7 version of konga.
I need to use legacy version but it's impossible to configure KONGA_SEED_KONG_NODE_DATA_SOURCE_FILE.
It's possible to have this feature on legacy version?
I'm using the 0.14.7 version now, it doesn't work either.
@xiaolin8 , unfortunately I cannot reproduce the issue on Konga 0.14.7. It's working fine on my end and from what I get from your screenshots, it should be working for you as well.
Can you please run in dev mode with the same env vars and post Kongas logs? Maybe that will help me identify what I'm missing.
I have just submitted a PR where I solve this setting extravolumes and extravolumemounts (those were not available) in your custom values. Those should point to configmaps (secrets should work too) that define the files you need. It works with me.
module.exports = [
{
"name": "kong-admin",
"type": "key_auth",
"kong_admin_url": "http://your-kong-admin-svc:8444",
"health_checks": false,
}
]
Same here with Kubernetes volumemount with config map:
```
env:
- name: KONGA_SEED_USER_DATA_SOURCE_FILE
valueFrom:
configMapKeyRef:
name: kong-konga-dashboard-users
key: users
kind: ConfigMap
apiVersion: v1
metadata:
name: kong-konga-dashboard-users
labels:
app: kong-konga-dashboard
data:
users: 'module.exports = [
{
"username": "admin",
"email": "[email protected]",
"firstName": "Peter",
"lastName": "Administrator",
"node_id": "http://kong:8001",
"admin": true,
"active" : true,
"password": "admin1234"
},
```
Could not find module.exports = [ { "username": "admin", "email": "[email protected]", "firstName": "Peter", "lastName": "Administrator", "node_id": "http://kong:8001", "admin": true, "active" : true, "password": "admin1234" }, { "username": "otheruser", "email": "[email protected]", "firstName": "Joe", "lastName": "Blogs", "node_id": "http://kong:8001", "admin": false, "active" : true, "password": "anotherpassword" } ] from KONGA_SEED_USER_DATA_SOURCE_FILE
TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type undefined
at validateString (internal/validators.js:125:11)
at Module.require (internal/modules/cjs/loader.js:687:3)
at require (internal/modules/cjs/helpers.js:25:18)
at getseedData (/app/config/default-seed-data.js:25:28)
at Object.
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at /app/node_modules/sails/node_modules/include-all/lib/help-include-all-sync.js:271:33
at Array.forEach (
at _recursivelyIncludeAll (/app/node_modules/sails/node_modules/include-all/lib/help-include-all-sync.js:174:11)
at includeAll (/app/node_modules/sails/node_modules/include-all/lib/help-include-all-sync.js:292:5)
at helpBuildDictionary (/app/node_modules/sails/node_modules/include-all/lib/help-build-dictionary.js:43:15)
at Function.module.exports.aggregate (/app/node_modules/sails/node_modules/include-all/index.js:101:10)
at Array.loadOtherConfigFiles (/app/node_modules/sails/lib/hooks/moduleloader/index.js:247:22)
at /app/node_modules/async/lib/async.js:591:38
at _arrayEach (/app/node_modules/async/lib/async.js:85:13)
at Object.async.auto (/app/node_modules/async/lib/async.js:552:9)
Failed to load undefined from KONGA_SEED_USER_DATA_SOURCE_FILE
Reverting to default user seed
[34mdebug: [39mHook:api_health_checks:process() called
[34mdebug: [39mHook:health_checks:process() called
[34mdebug: [39mHook:start-scheduled-snapshots:process() called
[34mdebug: [39mHook:upstream_health_checks:process() called
[34mdebug: [39mHook:user_events_hook:process() called
[34mdebug: [39mSeeding User...
[34mdebug: [39mUser seed planted
[34mdebug: [39mSeeding Kongnode...
[34mdebug: [39mKongnode seed planted
[34mdebug: [39mSeeding Emailtransport...
[34mdebug: [39mEmailtransport seed planted
[34mdebug: [39m-------------------------------------------------------
[34mdebug: [39m:: Thu Jan 23 2020 00:06:19 GMT+0000 (Coordinated Universal Time)
[34mdebug: [39mEnvironment : development
solved my problem:
volumeMounts:
- mountPath: /users/
name: users
env:
- name: KONGA_SEED_USER_DATA_SOURCE_FILE
value: /users/usersdb.data
kind: ConfigMap
apiVersion: v1
metadata:
name: kong-dashboard-users
labels:
app: kong-dashboard
data:
usersdb.data: "module.exports = [
{
'username': 'admin',
'email': '[email protected]
I have the same issue:
# cat kong_seed_node_data.json
module.exports = [
{
"name": "Kong",
"type": "default",
"kong_admin_url": "http://kong:8001",
"health_checks": false,
}
]
# less docker-compose.yml
(...)
konga-prepare:
image: pantsel/konga:0.14.7
command: "-c prepare -a postgres -u postgresql://kong:${KONG_PG_PASSWORD}@db:5432/konga"
depends_on:
- db
networks:
- kong-net
restart: on-failure
konga:
image: pantsel/konga:0.14.7
depends_on:
- konga-prepare
## FIXME: we need always instead of on-failure because sometimes the database takes a little while to be
## ready after konga-prepare, and konga fails because it can't find the database but exists with error code 0
restart: always
ports:
- "1337:1337"
networks:
- kong-net
environment:
TOKEN_SECRET: "${KONGA_TOKEN_SECRET}" #Created by Ansible in .env
DB_ADAPTER: postgres
DB_HOST: db
DB_USER: kong
DB_PASSWORD: "${KONG_PG_PASSWORD}"
DB_DATABASE: konga
NODE_ENV: production
KONGA_SEED_KONG_NODE_DATA_SOURCE_FILE: /run/kong_seed_node_data.json
volumes:
- ./kong_seed_node_data.json:/run/kong_seed_node_data.json
The error in the console is:
konga_1 | SyntaxError: /run/kong_seed_node_data.json: Unexpected token m in JSON at position 0
konga_1 | at JSON.parse (<anonymous>)
konga_1 | at Object.Module._extensions..json (internal/modules/cjs/loader.js:797:27)
konga_1 | at Module.load (internal/modules/cjs/loader.js:653:32)
konga_1 | at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
konga_1 | at Function.Module._load (internal/modules/cjs/loader.js:585:3)
konga_1 | at Module.require (internal/modules/cjs/loader.js:692:17)
konga_1 | at require (internal/modules/cjs/helpers.js:25:18)
konga_1 | at getseedData (/app/config/default-seed-data.js:25:28)
konga_1 | at Object.<anonymous> (/app/config/default-seed-data.js:49:21)
konga_1 | at Module._compile (internal/modules/cjs/loader.js:778:30)
konga_1 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
konga_1 | at Module.load (internal/modules/cjs/loader.js:653:32)
konga_1 | at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
konga_1 | at Function.Module._load (internal/modules/cjs/loader.js:585:3)
konga_1 | at Module.require (internal/modules/cjs/loader.js:692:17)
konga_1 | at require (internal/modules/cjs/helpers.js:25:18)
konga_1 | at /app/node_modules/sails/node_modules/include-all/lib/help-include-all-sync.js:271:33
konga_1 | at Array.forEach (<anonymous>)
konga_1 | at _recursivelyIncludeAll (/app/node_modules/sails/node_modules/include-all/lib/help-include-all-sync.js:174:11)
konga_1 | at includeAll (/app/node_modules/sails/node_modules/include-all/lib/help-include-all-sync.js:292:5)
konga_1 | at helpBuildDictionary (/app/node_modules/sails/node_modules/include-all/lib/help-build-dictionary.js:43:15)
konga_1 | at Function.module.exports.aggregate (/app/node_modules/sails/node_modules/include-all/index.js:101:10)
konga_1 | Failed to load /run/kong_seed_node_data.json from KONGA_SEED_KONG_NODE_DATA_SOURCE_FILE
konga_1 | Reverting to default kong_node seed
@eburgueno , judging from your message, your json file is not valid
@pantsel do you see anything wrong with it? It's almost a line for line copy of the one in the docs:
module.exports = [
{
"name": "Kong",
"type": "default",
"kong_admin_url": "http://kong:8001",
"health_checks": false,
}
]
Try renaming your file to kong_seed_node_data.data instead of .json because the file is not a valid json file. (And it shouldnt be a json file also). The docs are using the .data extention.
the file is not a valid json file.
Of course. Didn't think about that. Calling it .data did the trick. Thanks!
Most helpful comment
Try renaming your file to kong_seed_node_data.data instead of .json because the file is not a valid json file. (And it shouldnt be a json file also). The docs are using the .data extention.