Closed nevian427 closed 4 years ago
I am not sure, but what is the question ? I see only some output that doesn't say too much, except this:
{"level":"error","msg":"pq: database "homer7_config" does not exist","time":"2020-04-28T16:40:37+03:00"}
Question is: why bootstrap doesn't respect config file settings? Bootstrap uses only commandline switches to create DB and user but after switches to config file to create tables.
because at the end you should have a correct config file ? ;-) and once you have setup it during installation you are ready to use it.
I have correct config file but it's NOT being red. Initialize and create uses ONLY command line
because it requires "root" access to create databases and users. Therefore it takes command line parameters. What is your concern ?
Ok I gave it DB root but it doesn't look for proper server and DB names from config. I should duplicate all the names in command line vs supplying only root access. Create DB ignores config but create/populate tables respects it
np, the code is open, just make a fork and do as you wish and contribute back. Good luck!
Hi,
I have modified config to suit my environment and try to create DBs from ground up: /usr/local/bin/homer-app -webapp-config-path=/etc/homer -initialize_db -database-root-password=password App ignores my settings and tries(and fail) to use defaults. But if I supply DB settings in command line it does its create DB magic and then switches to config to create tables.
[root@msk-vo-s-bl1 homer]# /usr/local/bin/homer-app -webapp-config-path=/etc/homer -initialize_db -database-root-password=password -database-host=10.0.64.104
CONNECT to DB ROOT STRING: [host=10.0.64.104 user=postgres dbname=postgres sslmode=disable port=5432 password=password]
{"level":"info","msg":"----------------------------------- ","time":"2020-04-28T16:40:36+03:00"} {"level":"info","msg":" Database Data Root Session created ","time":"2020-04-28T16:40:36+03:00"} {"level":"info","msg":"----------------------------------- ","time":"2020-04-28T16:40:36+03:00"}
HOMER - creating user [user=homer_user password=homer_password]
(/home/shurik/go/src/github.com/sipcapture/homer-app/migration/migration.go:57) [2020-04-28 16:40:36] [60.25ms] CREATE USER homer_user WITH PASSWORD 'homer_password' [0 rows affected or returned ]
DONE
HOMER - show users Role name | Attributes
DONE
HOMER - create db [homer_data] with [name=homer_user]
(/home/shurik/go/src/github.com/sipcapture/homer-app/migration/migration.go:84) [2020-04-28 16:40:36] pq: database "homer_data" already exists
(/home/shurik/go/src/github.com/sipcapture/homer-app/migration/migration.go:84) [2020-04-28 16:40:36] [1.24ms] CREATE DATABASE homer_data OWNER homer_user [0 rows affected or returned ]
DONE
HOMER - create db [homer_config] with [name=homer_user]
(/home/shurik/go/src/github.com/sipcapture/homer-app/migration/migration.go:84) [2020-04-28 16:40:36] pq: database "homer_config" already exists
(/home/shurik/go/src/github.com/sipcapture/homer-app/migration/migration.go:84) [2020-04-28 16:40:36] [0.68ms] CREATE DATABASE homer_config OWNER homer_user [0 rows affected or returned ]
DONE
CONNECT to DB ROOT STRING: [host=10.0.64.104 user=postgres dbname=homer_data sslmode=disable port=5432 password=password]
{"level":"info","msg":"----------------------------------- ","time":"2020-04-28T16:40:37+03:00"} {"level":"info","msg":" Database Data Root Session created ","time":"2020-04-28T16:40:37+03:00"} {"level":"info","msg":"----------------------------------- ","time":"2020-04-28T16:40:37+03:00"}
HOMER - creating role for user [user=homer_user dbconfig=homer_config, dbdata=homer_data]
(/home/shurik/go/src/github.com/sipcapture/homer-app/migration/migration.go:96) [2020-04-28 16:40:37] [2.82ms] GRANT ALL PRIVILEGES ON DATABASE homer_config to homer_user; [0 rows affected or returned ]
(/home/shurik/go/src/github.com/sipcapture/homer-app/migration/migration.go:99) [2020-04-28 16:40:37] [1.88ms] GRANT ALL PRIVILEGES ON DATABASE homer_data to homer_user; [0 rows affected or returned ]
(/home/shurik/go/src/github.com/sipcapture/homer-app/migration/migration.go:102) [2020-04-28 16:40:37] [1.45ms] ALTER DATABASE homer_config OWNER TO homer_user; [0 rows affected or returned ]
(/home/shurik/go/src/github.com/sipcapture/homer-app/migration/migration.go:105) [2020-04-28 16:40:37] [4.74ms] ALTER DATABASE homer_data OWNER TO homer_user; [0 rows affected or returned ]
(/home/shurik/go/src/github.com/sipcapture/homer-app/migration/migration.go:111) [2020-04-28 16:40:37] [155.56ms] SELECT schemaname, tablename, tableowner FROM pg_catalog.pg_tables WHERE schemaname != 'pg_catalog' AND schemaname != 'information_schema' AND tableowner != 'homer_user' AND tablename LIKE 'hep_proto%' [0 rows affected or returned ]
DONE {"level":"info","msg":"Connecting to the config: [10.0.64.104, homer, homer7_config, 0]\n","time":"2020-04-28T16:40:37+03:00"} {"level":"error","msg":"pq: database \"homer7_config\" does not exist","time":"2020-04-28T16:40:37+03:00"} panic: failed to connect database
goroutine 1 [running]: main.getConfigDBSession(0xc00022e8f0) /home/shurik/go/src/github.com/sipcapture/homer-app/main.go:602 +0x7ae main.initDB() /home/shurik/go/src/github.com/sipcapture/homer-app/main.go:1153 +0x349 main.checkAdminFlags() /home/shurik/go/src/github.com/sipcapture/homer-app/main.go:963 +0xed3 main.main() /home/shurik/go/src/github.com/sipcapture/homer-app/main.go:213 +0x189