Skip to content
This repository has been archived by the owner on Apr 26, 2023. It is now read-only.

Baseentity attribute infinispan persistence #10

Open
wants to merge 22 commits into
base: 10.1.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ba7dce4
Initial commit
varunshastry Jul 27, 2022
4ba458f
Merge branch '10.1.0' into baseentity_attribute_infinispan_persistence
varunshastry Jul 27, 2022
5fd1000
Adding script for phased build
varunshastry Jul 27, 2022
68eab9d
Uncommenting building products
varunshastry Jul 27, 2022
c6bab31
Changing package-names for entities
varunshastry Jul 27, 2022
39a2883
Merge branch '10.1.0' into baseentity_attribute_infinispan_persistence
varunshastry Jul 28, 2022
e6b44bd
Removing docker tag handling for products since LATEST is always cons…
varunshastry Jul 28, 2022
7ee65cf
Merge branch '10.1.0' into baseentity_attribute_infinispan_persistence
varunshastry Aug 1, 2022
0e737fc
Persistence changes and DB update scripts
varunshastry Aug 10, 2022
b9cbc62
Persistence changes and DB update scripts
varunshastry Aug 10, 2022
6b048c1
Merge branch '10.1.0' into baseentity_attribute_infinispan_persistence
varunshastry Aug 10, 2022
b46c3a3
Pulling changes from 10.1.0
varunshastry Aug 11, 2022
a920fe5
Merge branch 'baseentity_attribute_infinispan_persistence' of https:/…
varunshastry Aug 11, 2022
993ee4e
DB url changes for fyodor, gadaq; stopping proto generation during ga…
varunshastry Aug 15, 2022
2b7cca5
Extracting network setup to a dedicated script
varunshastry Aug 16, 2022
c99023c
Merge branch '10.1.0' into baseentity_attribute_infinispan_persistence
varunshastry Aug 22, 2022
aedd5ae
Setting rx3.buffer-size to 256 in infinispan
varunshastry Sep 7, 2022
0e4211a
Merge branch '10.2.0' into baseentity_attribute_infinispan_persistence
varunshastry Sep 8, 2022
a98d31d
Adding data-index as dependency
varunshastry Sep 9, 2022
b68cbc0
Correcting the infinispan config for persistence
Sep 30, 2022
5081610
Updating infinispan version to 14-11, triggering reindex on startup
Oct 24, 2022
8e2fc65
Correcting the persistence config
Oct 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions add_docker_tags_to_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,3 @@ echo "Adding all tags from docker_tags.env..."
add_tag_to_env docker_tags.env
echo "Completed adding all tags from docker_tags.env."

if [[ -n "$PRODUCT_CODES" ]]
then
if [ -d "../products" ];
then
products=($(echo $PRODUCT_CODES | tr ":" "\n"))
for p in "${products[@]}"
do
#copy the product ports into .env
source ../products/prd_${p}/docker_tags.env
echo "Adding all ports from docker_tags.env of prd_${p}..."
add_tag_to_env ../products/prd_${p}/docker_tags.env
echo "Completed adding all ports from docker_tags.env of prd_${p}."
done
fi
fi


2 changes: 1 addition & 1 deletion cyrusBuildProducts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if [[ -n "$PRODUCT_CODES" ]]
do
echo "Building prd_${p}"
#copy across SVG and protos
cd ${HOME}/projects/genny/products/prd_${p}
cd ../products/prd_${p}
./build.sh $clean;./build-docker.sh
done
fi
Expand Down
11 changes: 7 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
ports:
- ${INFINISPAN_PORT}:${INFINISPAN_INTERNAL_PORT}
environment:
JAVA_OPTS: " -Xms64m -Xmx4096m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=2048m -Dinfinispan.bind.address=0.0.0.0 -Dpersistence.db.server.ip=mysql -Dpersistence.db.server.port=${MYSQL_PORT} -Dpersistence.db.name=gennydb -Dpersistence.db.username=genny -Dpersistence.db.password=password"
JAVA_OPTS: " -Xms64m -Xmx16384m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=2048m -Dinfinispan.bind.address=0.0.0.0 -Dpersistence.db.server.ip=mysql -Dpersistence.db.server.port=${MYSQL_PORT} -Dpersistence.db.name=gennydb -Dpersistence.db.username=genny -Dpersistence.db.password=password -Drx3.buffer-size=256"
USER: genny
PASS: password
ISPN_HOME: /opt/infinispan
Expand Down Expand Up @@ -406,6 +406,7 @@ services:
- INFINISPAN_URL=infinispan:${INFINISPAN_PORT}
- INFINISPAN_CLIENT_INTELLIGENCE=BASIC
- GENNY_KAFKA_URL=kafka:${KAFKA_PORT}
- GENNY_MYSQL_FULL_URL=mysql:${MYSQL_PORT}/gennydb
- kafka.bootstrap.servers=kafka:${KAFKA_PORT}
ports:
- ${FYODOR_PORT}:${FYODOR_INTERNAL_PORT}
Expand All @@ -423,19 +424,21 @@ services:
depends_on:
fyodor:
condition: service_healthy
kafka:
data-index:
condition: service_healthy
env_file:
- ${ENV_FILE}
environment:
- INFINISPAN_URL=infinispan:${INFINISPAN_PORT}
- QUARKUS_INFINISPAN_CLIENT_USE_SCHEMA_REGISTRATION=false
- INFINISPAN_CLIENT_INTELLIGENCE=BASIC
- FYODOR_SERVICE_API=http://alyson.genny.life:${FYODOR_PORT}
- GENNY_KAFKA_URL=kafka:${KAFKA_PORT}
- kafka.bootstrap.servers=kafka:${KAFKA_PORT}
- GENNY_KOGITO_SERVICE_URL=http://alyson2.genny.life:${GADAQ_PORT}
- GENNY_KOGITO_DATAINDEX_HTTP_URL=http://alyson.genny.life:${DATAINDEX_PORT}
- GENNY_GADAQ_SERVICE_URL=http://alyson2.genny.life:${GADAQ_PORT}
- GENNY_MYSQL_FULL_URL=mysql:${MYSQL_PORT}/gennydb
ports:
- ${GADAQ_PORT}:${GADAQ_INTERNAL_PORT}
networks:
Expand Down Expand Up @@ -672,7 +675,7 @@ services:
QUARKUS_INFINISPAN_CLIENT_AUTH_REALM: default
QUARKUS_INFINISPAN_CLIENT_AUTH_USERNAME: genny
QUARKUS_INFINISPAN_CLIENT_SASL_MECHANISM: DIGEST-MD5
QUARKUS_INFINISPAN_CLIENT_SERVER_LIST: infinispan:${INFINISPAN_PORT}
QUARKUS_INFINISPAN_CLIENT_SERVER_LIST: alyson.genny.life:${INFINISPAN_PORT}
QUARKUS_INFINISPAN_CLIENT_USE_AUTH: "true"
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:${DATAINDEX_INTERNAL_PORT}/q/health/ready" ]
Expand All @@ -699,7 +702,7 @@ services:
QUARKUS_INFINISPAN_CLIENT_AUTH_REALM: default
QUARKUS_INFINISPAN_CLIENT_AUTH_USERNAME: genny
QUARKUS_INFINISPAN_CLIENT_SASL_MECHANISM: DIGEST-MD5
QUARKUS_INFINISPAN_CLIENT_SERVER_LIST: infinispan:${INFINISPAN_PORT}
QUARKUS_INFINISPAN_CLIENT_SERVER_LIST: alyson.genny.life:${INFINISPAN_PORT}
QUARKUS_INFINISPAN_CLIENT_USE_AUTH: "true"
KOGITO_DATAINDEX_HTTP_URL: http://alyson.genny.life:${DATAINDEX_PORT}/graphql
KOGITO_MANAGEMENT_CONSOLE_PROPS: -Dkogito.consoles.keycloak.config.client-id=kogito-console-quarkus -Dkogito.consoles.keycloak.config.realm=internmatch -Dkogito.consoles.keycloak.config.url=https://keycloak.gada.io/auth -Dkogito.consoles.keycloak.config.health-check-url=https://keycloak.gada.io/auth/realms/internmatch/.well-known/openid-configuration -Dkogito.svg.folder.path=/home/kogito/data/svg -Dkogito.consoles.keycloak.config.disable-health-check=false -Dkogito.consoles.keycloak.config.update-token-validity=30
Expand Down
2 changes: 1 addition & 1 deletion docker_tags.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Captures the versions for the images used in docker-compose

IMAGE_PROXY_VERSION=v0.10.0
INFINISPAN_VERSION=14-9
INFINISPAN_VERSION=14-11
KAFKA_ECOSYSTEM_VERSION=7.1.2
KOGITO_ECOSYSTEM_VERSION=1.27.0
MYSQL_VERSION=8.0.29
Expand Down
27 changes: 18 additions & 9 deletions infinispan/infinispan_persistence.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
<cache-container name="default" statistics="true" default-cache="default_cache">
<global-state/>
<distributed-cache name="default_cache"/>
<!--<distributed-cache name="baseentity_attribute">

<distributed-cache name="baseentity_attribute">
<encoding>
<key media-type="application/x-protostream"/>
<value media-type="application/x-protostream"/>
Expand All @@ -22,13 +23,19 @@
username="${persistence.db.username:genny}"
password="${persistence.db.password:password}"
driver="com.mysql.cj.jdbc.Driver"/>
<schema message-name="baseentity_attribute_value"
key-message-name="baseentity_attribute_key"
package="genny"
<schema message-name="BaseEntityAttribute"
key-message-name="BaseEntityAttributeKey"
package="life.genny.qwandaq.persistence.baseentityattribute"
embedded-key="true"/>
</table-jdbc-store>
</persistence>
</distributed-cache>-->
<indexing enabled="true" storage="filesystem" path="indexes/baseentityattributes" startup-mode="reindex">
<indexed-entities>
<indexed-entity>life.genny.qwandaq.persistence.baseentityattribute.BaseEntityAttribute</indexed-entity>
</indexed-entities>
</indexing>
<memory storage="OFF_HEAP" max-size="2GB" when-full="REMOVE"/>
</distributed-cache>
<distributed-cache name="baseentity">
<encoding>
<key media-type="application/x-protostream"/>
Expand All @@ -43,16 +50,18 @@
driver="com.mysql.cj.jdbc.Driver"/>
<schema message-name="BaseEntity"
key-message-name="BaseEntityKey"
package="life.genny.qwandaq.baseentity"
package="life.genny.qwandaq.persistence.baseentity"
embedded-key="true"/>
</table-jdbc-store>
</persistence>
<indexing enabled="true" storage="filesystem" path="baseentitys">
<indexing enabled="true" storage="filesystem" path="indexes/baseentitys" startup-mode="reindex">
<indexed-entities>
<indexed-entity>life.genny.qwandaq.baseentity.BaseEntity</indexed-entity>
<indexed-entity>life.genny.qwandaq.persistence.baseentity.BaseEntity</indexed-entity>
</indexed-entities>
</indexing>
</distributed-cache>
<memory storage="OFF_HEAP" max-size="512MB" when-full="REMOVE"/>
</distributed-cache>

<distributed-cache name="jobs" statistics="true">
<locking concurrency-level="1000" acquire-timeout="15000" striping="false"/>
<indexing enabled="true" storage="filesystem" path="data-index-jobs">
Expand Down
34 changes: 34 additions & 0 deletions network-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

os_type=""
if [[ "$OSTYPE" == "linux-gnu" ]]; then
os_type="ubuntu"
elif [[ "$OSTYPE" == "darwin"* ]]; then
os_type="mac"
fi

echo "OS Type is ${os_type}"

if [[ "${os_type}" == "mac" ]]; then
IP=$(ifconfig | grep 10.123.123.123)
elif [[ "${os_type}" == "ubuntu" ]]; then
IP=$(ip a | grep 10.123.123.123)
fi
echo $IP

#if ping -c 1 10.123.123.123 &> /dev/null
if [[ -z "$IP" ]]; then
if [[ ${os_type} == "mac" ]]; then
echo "OS TYPE: macOS"
sudo ifconfig lo0 alias 10.123.123.123
elif [[ ${os_type} == "ubuntu" ]]; then
echo "OS TYPE: Linux"
sudo ip address add 10.123.123.123 dev lo
else
echo "Can't detect OS type, neither Linux nor macOS!"
exit -1
fi
else
echo "10.123.123.123 exists"
fi

3 changes: 3 additions & 0 deletions restart.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash

./network-setup.sh

#find all the projects
rm -Rf ./rules/prj_*
#cp -rp ../prj_genny/rules/rulesCurrent ./rules/
Expand Down
32 changes: 1 addition & 31 deletions run-setup.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,6 @@
#!/bin/bash

os_type=""
if [[ "$OSTYPE" == "linux-gnu" ]]; then
os_type="ubuntu"
elif [[ "$OSTYPE" == "darwin"* ]]; then
os_type="mac"
fi

echo "OS Type is ${os_type}"

if [[ "${os_type}" == "mac" ]]; then
IP=$(ifconfig | grep 10.123.123.123)
elif [[ "${os_type}" == "ubuntu" ]]; then
IP=$(ip a | grep 10.123.123.123)
fi
echo $IP

#if ping -c 1 10.123.123.123 &> /dev/null
if [[ -z "$IP" ]]; then
if [[ ${os_type} == "mac" ]]; then
echo "OS TYPE: macOS"
sudo ifconfig lo0 alias 10.123.123.123
elif [[ ${os_type} == "ubuntu" ]]; then
echo "OS TYPE: Linux"
sudo ip address add 10.123.123.123 dev lo
else
echo "Can't detect OS type, neither Linux nor macOS!"
exit -1
fi
else
echo "10.123.123.123 exists"
fi
./network-setup.sh

DOCUMENTATION=\
"\nFor running a custom genny project please follow the commands below otherwise type './run-setup.sh up' for running the default configuration\n"\
Expand Down
3 changes: 2 additions & 1 deletion schema-updater/files_to_be_run.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Add 1 file in a line only, no in-line comments supported
# Add 1 file in a line only, in-line comments NOT supported

update_sqls/create_executed_scripts_tbl.sql
update_sqls/update_baseentity_constraints.sql
update_sqls/update_baseentity_attribute_constraints.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE baseentity_attribute ADD CONSTRAINT unique_key UNIQUE KEY (ATTRIBUTE_ID,BASEENTITY_ID);
ALTER TABLE baseentity_attribute DROP PRIMARY KEY;
ALTER TABLE baseentity_attribute ADD CONSTRAINT pri_key PRIMARY KEY (realm,baseEntityCode,attributeCode);
35 changes: 1 addition & 34 deletions schema-updater/update_sqls/update_baseentity_constraints.sql
Original file line number Diff line number Diff line change
@@ -1,36 +1,3 @@
DROP TABLE IF EXISTS answerlinks;
DROP TABLE IF EXISTS context;
DROP PROCEDURE IF EXISTS drop_constraint;
DELIMITER //
CREATE PROCEDURE drop_constraint(tbl_name VARCHAR(64), constraint_name VARCHAR(64))
BEGIN
DECLARE stmt VARCHAR(1024);
SET @sql := CONCAT('ALTER TABLE ', tbl_name, ' DROP CONSTRAINT ', constraint_name);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END//
DELIMITER ;
SELECT CONSTRAINT_NAME into @bea_constraint_name FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = 'gennydb' AND REFERENCED_TABLE_NAME = 'baseentity' AND TABLE_NAME='baseentity_attribute';
CALL drop_constraint('baseentity_attribute', @bea_constraint_name);
SELECT CONSTRAINT_NAME into @beb_constraint_name FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = 'gennydb' AND REFERENCED_TABLE_NAME = 'baseentity' AND TABLE_NAME='baseentity_baseentity';
CALL drop_constraint('baseentity_baseentity', @beb_constraint_name);
ALTER TABLE baseentity MODIFY COLUMN id BIGINT AUTO_INCREMENT;
ALTER TABLE baseentity DROP CONSTRAINT unique_id;
ALTER TABLE baseentity ADD CONSTRAINT unique_id UNIQUE(id);
DROP PROCEDURE IF EXISTS add_constraint;
DELIMITER //
CREATE PROCEDURE add_constraint(tbl_name VARCHAR(64), constraint_name VARCHAR(64), col_name VARCHAR(64))
BEGIN
DECLARE stmt VARCHAR(1024);
SET @sql := CONCAT('ALTER TABLE ', tbl_name, ' ADD CONSTRAINT ', constraint_name, ' FOREIGN KEY (', col_name, ') REFERENCES baseentity(id)');
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END//
DELIMITER ;
CALL add_constraint('baseentity_attribute', @bea_constraint_name, 'baseentity_id');
CALL add_constraint('baseentity_baseentity', @beb_constraint_name, 'source_id');
DROP PROCEDURE IF EXISTS add_constraint;
ALTER TABLE baseentity ADD CONSTRAINT unique_key UNIQUE KEY(id);
ALTER TABLE baseentity DROP PRIMARY KEY;
ALTER TABLE baseentity ADD CONSTRAINT pri_key PRIMARY KEY (realm,code);