ging / fiware-idm

OAuth 2.0-based authentication of users and devices, user profile management, Single Sign-On (SSO) and Identity Federation across multiple administration domains.
https://keyrock-fiware.github.io
MIT License
36 stars 81 forks source link

Use sequelize to check connection #273

Closed jason-fox closed 2 years ago

jason-fox commented 2 years ago

Proposed changes

Previously makeRequest() used HTTP to see if the database could be contacted. This PR switches it to use sequelize

Types of changes

What types of changes does your code introduce to the project: Put an x in the boxes that apply

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

Further comments

Tested by dockerizing and starting up MySQL

github-actions[bot] commented 2 years ago

CLA Assistant Lite bot All contributors have signed the CLA ✍️

jason-fox commented 2 years ago

Sample log:

2022-03-04T16:56:03.307752000Z 
2022-03-04T16:56:03.450Z idm:config Setting IDM_PORT to environment value: 3005
2022-03-04T16:56:03.454Z idm:config Setting IDM_HOST to environment value: http://localhost:3005
2022-03-04T16:56:03.454Z idm:config Setting IDM_HEADLESS to environment value: false
2022-03-04T16:56:03.455Z idm:config Setting IDM_HTTPS_ENABLED to environment value: false
2022-03-04T16:56:03.455Z idm:config Setting IDM_HTTPS_PORT to environment value: 3443
2022-03-04T16:56:03.456Z idm:config Setting IDM_PDP_LEVEL to environment value: basic
2022-03-04T16:56:03.457Z idm:config Setting IDM_DB_HOST to environment value: mysql-db
2022-03-04T16:56:03.457Z idm:config Setting IDM_DB_PASS to environment value: ********
2022-03-04T16:56:03.457Z idm:config Setting IDM_DB_USER to environment value: ********
2022-03-04T16:56:03.457Z idm:config Setting IDM_DB_NAME to environment value: idm
2022-03-04T16:56:03.458Z idm:config Setting IDM_DB_DIALECT to environment value: mysql
2022-03-04T16:56:03.458Z idm:config Setting IDM_EMAIL_HOST to environment value: localhost
2022-03-04T16:56:03.458Z idm:config Setting IDM_EMAIL_PORT to environment value: 25
2022-03-04T16:56:03.459Z idm:config Setting IDM_EMAIL_ADDRESS to environment value: noreply@localhost
2022-03-04T16:56:03.460Z idm:config ***********************************************
2022-03-04T16:56:03.460Z idm:config WARNING: The current encryption keys match the defaults found in the plaintext
2022-03-04T16:56:03.460Z idm:config          template file - please update for a production instance
2022-03-04T16:56:03.461Z idm:config ***********************************************
Fri, 04 Mar 2022 16:56:04 GMT sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators at node_modules/sequelize/lib/sequelize.js:245:13
2022-03-04T16:56:04.593Z idm:database Warning: Connection refused - mysql-db:3306 - ECONNREFUSED 
2022-03-04T16:56:04.594Z idm:database Info: Retrying after 5 seconds.
2022-03-04T16:56:09.614Z idm:database Warning: Connection refused - mysql-db:3306 - ECONNREFUSED 
2022-03-04T16:56:09.614Z idm:database Info: Retrying after 5 seconds.
2022-03-04T16:56:14.708Z idm:database Warning: Connection refused - mysql-db:3306 - ECONNREFUSED 
2022-03-04T16:56:14.713Z idm:database Info: Retrying after 5 seconds.
2022-03-04T16:56:19.746Z idm:database Warning: Connection refused - mysql-db:3306 - ECONNREFUSED 
2022-03-04T16:56:19.746Z idm:database Info: Retrying after 5 seconds.
2022-03-04T16:56:24.791Z idm:database Warning: Connected, but DB not initialized  - Unknown database 'idm'
Database created
Database migrated
Database seeded
****************
WARNING: Seeding database with an admin user using default credentials.
This user must be deleted when running on a production instance
****************
2022-03-04T16:56:42.663Z idm:app Keyrock GUI is available
2022-03-04T16:56:42.670Z idm:server Listening on port 3005
2022-03-04T16:56:42.837Z idm:models Connection has been established successfully
wistefan commented 2 years ago

Very important change to enable Keyrock working with managed databases(like AWS RDS or GoogleSQL). When can we expect a release with that @apozohue10?

aalonsog commented 2 years ago

Dear all, apologies for the delay. We are working ok checking this, we hope to be able to merge it next week.