Skip to content

PDA SESSION

pace edited this page Nov 5, 2020 · 3 revisions

Prerequisites

  • Java - 8+
  • Git
  • Gradle-5.1.1 (or newer)

Installation

Note: Before installing the application, we need to create 2 AWS buckets one private and one public. A step by step process to get a development environment up and running.

Get the application from the git repository.

git clone https://github.com/PDA-Open-Source/PDA-SESSION.git
cd PDA-SESSION

Configuration

Copy the below list of configuration and add them to the application.properties file, insert the values with proper configuration details.

server.port = 9091

#neo4j Configuration Same registry Configuration
server.nginx.name=http://domainname #pda-web Endpoint
spring.data.neo4j.username=neo4j
spring.data.neo4j.password=neo4j
spring.data.neo4j.port=7687
spring.data.neo4j.uri=bolt://localhost:7687 #neo4j url

# Postgres Database Configuration
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.datasource.url=jdbc:postgresql://localhost:5432/pda_session
spring.datasource.username=postgres
spring.datasource.password=password
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=update

#PDA Application URL
iam-baseurl= http://localhost:9090/api/v2/user/
Entity.get=http://localhost:9092/api/v1/entity/
registry-base-url=http://localhost:8090/
getGenerateAttestationUrl=http://localhost:9092/api/v1/entity/

#keycloak Configuration
keycloak.principal-attribute=preferred_username
keycloak.auth-server-url=http://localhost:8080/auth/ #Keycloak URL
keycloak.realm=master
keycloak-client-id=admin-cli
keycloak.credentials.secret= #keycloak client secret key
keycloak-public-key= #keycloak realm Public key
client.granttype=password # Keycloak Grant Type
admin-user-username=admin # Keycloak login username
admin-user-password=admin # Keycloak login password
keycloak.resource=account
keycloak.bearer-only = true

#encrypt/decrypt values
salt-value= #In case to change the value refer PDA-WEB wiki
iv-value= #In case to change the value refer PDA-WEB wiki
secret-key=t #In case to change the value refer PDA-WEB wiki
key-size=128
iteration-count=1000
spring.jpa.show-sql=true

# Clevertap Credential Configuration
clevertap.account-id=
clevertap.passcode=
clevertap.base.uri=http://localhost:9092/api/v1/entity/

# aws s3 configuration
aws-accesskey=""
aws-secretkey=""
aws-s3-bucket-name=""
aws-s3-url=""
aws-region=""
aws-qrcode=qr-code/
aws-s3-session-qr-folder-name=session-qr
#name of the private bucket
aws-s3-bucket-name-private=""
#url of the private bucket
aws-s3-url-private=""

# Threshold after which files are written to disk.
spring.servlet.multipart.enabled=true
spring.servlet.multipart.file-size-threshold=2KB
# Max file size.
spring.servlet.multipart.max-file-size=50MB
# Max Request Size
spring.servlet.multipart.max-request-size=55MB

# generate attestation url
attestation.generate=http://localhost:9092/api/v1/template/
attestation.generate.multiple=http://127.0.0.1:9092/api/v1/template/
organisation.get=http://localhost:9092/api/v1/entity/orgs
organisation.get.names=http://loaclahost:9092/api/v1/entity/orgs/names

#Email SMTP Configuration
sourcemailid=
sourceemailpassword=
mail-smtp-auth=mail.smtp.auth
mail-smtp-starttls-enable=mail.smtp.starttls.enable
mail-smtp-host=mail.smtp.host
smtp-gmail-com=smtp.gmail.com
mail-smtp-port=mail.smtp.port
port=587

#Cron Email Configuration
cron-email-path=PDA-SESSION/src/main/resources/templates/CronEmail.html
cron-email-subject=MemberAttestation-CRON

#Logging
log.location=/home/logs/session
management.endpoints.web.exposure.include=prometheus
session-qr-code-path=PDA-SESSION/src/main/resources/templates/

member-attestation-schedular-email=
session-end-minutes=240

Starting Service

After adding the necessary configuration now let us run the service.

Using Docker

docker build -t <servicename>:<versionname> . #update version in docker-compose file
docker compose up -d

Using jar file

gradle clean build
java -jar build/libs/<name of  the  jar file>

We need to run the below query set up cronjob and cronjob is set to 30 min right now which can be modified to any interval in src/main/java/com/pda/session/scheduler/MemberAttestationScheduler.java

insert into cronlogsdao (id,success,endofcron,nameofcron,startofcron,successrecords,totalrecords,failedrecords) values (1,true,'2019-01-01T01:00:00.000','Member Attestation Cron','2019-01-01T01:00',0,0,0);

Now we can check the application on the localhost and the port 9092 defined in application.properties file and can access Swagger API document at http://localhost:9091/swagger-ui.html and the necessary database tables are created once the application is up and running.