问题
I tried to start scalardb backend QA application with Azure Cosmos DB. The Spring boot application shows as started. But I couldn't access the QA backend application with port 8090. Port 8090 does not list in listening ports lsof -i -P -n | grep LISTEN
.
QA backend Application
When we connect it with the QA frontend application, it shows an error message An error occurred during the login
QA frontend Application
Step to reproduce
Cosmos DB Account Creation
- Create an Azure Cosmos DB account with
Core (SQL)
API. - Change Default consistency to
STRONG
. - Create schema using Schema Tool for Scalar DB
schema.json
"qa.question": {
"transaction": false,
"partition-key": [
"date"
],
"clustering-key": [
"created_at"
],
"columns": {
"date": "TEXT",
"created_at": "BIGINT",
"title": "TEXT",
"user": "TEXT",
"context": "TEXT",
"updated_at": "BIGINT",
"number_of_answers": "INT"
},
"ru": 400
},
"qa.answer": {
"transaction": false,
"partition-key": [
"question_created_at"
],
"clustering-key": [
"created_at"
],
"columns": {
"question_created_at": "BIGINT",
"context": "TEXT",
"user": "TEXT",
"created_at": "BIGINT"
},
"ru": 400
},
"qa.account": {
"transaction": false,
"partition-key": [
"email"
],
"clustering-key": [],
"columns": {
"email": "TEXT",
"password": "TEXT"
},
"ru": 400
},
"qa.firstQuestionDate": {
"transaction": false,
"partition-key": [
"id"
],
"clustering-key": [],
"columns": {
"id": "TEXT",
"first_question_date": "TEXT"
},
"ru": 400
}
}
QA Backend Application Setup
- Application clone from QA application
- Update scalardb.properties (backend/QA/src/main/resources/scalardb.properties) file with cosmos db details.
scalardb.properties
# Comma separated contact points
scalar.db.contact_points=<Cosmos DB URI>
# Port number for all the contact points. Default port number for each database is used if empty.
#scalar.db.contact_port=
# Credential information to access the database
scalar.db.username=
scalar.db.password=<PRIMARY KEY>
# Storage implementation. Either cassandra or cosmos can be set. Default storage is cassandra.
scalar.db.storage=cosmos
- Update scalardb dependency with lastest version (2.2.0)
build.gradle
....
dependencies {
//Scalar DB library
compile group: 'com.scalar-labs', name: 'scalardb', version: '2.2.0'
//Spring dependencies
compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}") {
exclude(group: 'ch.qos.logback')
}
compile("org.springframework.boot:spring-boot-starter:${springBootVersion}") {
exclude(group: 'ch.qos.logback')
}
//Spring security layer for authentication
compile("org.springframework.boot:spring-boot-starter-security:${springBootVersion}") {
exclude(group: 'ch.qos.logback')
}
//Handle Json Web Token authentication
compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: "${springBootVersion}"
}
- Execute
export SPRING_PROFILES_ACTIVE="storage"
- Start backend QA application with
sh gradlew bootRun
command.
Setup Frontend Application
- Go to
/frontend
. - Execute
make
command. - Open QA application in browser
http://localhost:8080/#/login
.
The QA frontend application shows an error message An error occurred during the login
when we attempt to log in.
The QA backend Application does not start with port 8090.
Has anyone already solved this problem? Can you give some suggestions to resolve this issue?
来源:https://stackoverflow.com/questions/64240960/scalardb-qa-application-not-properly-working-with-azure-cosmos-db