Skip to content

Commit

Permalink
workaround to make SMUI work with mysql 8...
Browse files Browse the repository at this point in the history
  • Loading branch information
epugh committed Mar 13, 2024
1 parent fa63f33 commit 918d94f
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 28 deletions.
25 changes: 5 additions & 20 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:

mysql:
container_name: mysql
image: amd64/mysql:5.7.40
image: mysql:8.3.0
ports:
- 3306:3306
environment:
Expand All @@ -33,21 +33,6 @@ services:
test: "/usr/bin/mysql --user=root --password=password --execute \"SHOW DATABASES;\""
interval: 10s
timeout: 30s

mysql8:
container_name: mysql8
image: amd64/mysql:8.0.33
ports:
- 3307:3307
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_TCP_PORT=3307
volumes:
- ./mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
healthcheck:
test: "/usr/bin/mysql --user=root --password=password --execute \"SHOW DATABASES;\""
interval: 10s
timeout: 30s

smui:
container_name: smui
Expand Down Expand Up @@ -188,15 +173,15 @@ services:

quepid:
container_name: quepid
image: o19s/quepid:7.7.0
image: o19s/quepid:7.15.0
ports:
- 3000:3000
command: "foreman s -f Procfile"
environment:
- PORT=3000
- RACK_ENV=production
- RAILS_ENV=production
- DATABASE_URL=mysql2://root:${MYSQL_ROOT_PASSWORD}@mysql8:3307/quepid
- DATABASE_URL=mysql2://root:${MYSQL_ROOT_PASSWORD}@mysql:3306/quepid
- REDIS_URL=redis://redis:6379/1
- FORCE_SSL=false
- MAX_THREADS=2
Expand All @@ -214,10 +199,10 @@ services:
- KEYCLOAK_SITE=http://keycloak:9080
- SIGNUP_ENABLED=true
links:
- mysql8
- mysql
- redis
depends_on:
- mysql8
- mysql
- redis

embeddings:
Expand Down
2 changes: 1 addition & 1 deletion mysql/wait-for-mysql.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
DOT='\033[0;37m.\033[0m'
while [[ "$(docker inspect --format "{{json .State.Health.Status }}" mysql8)" != "\"healthy\"" ]]; do printf ${DOT}; sleep 5; done
while [[ "$(docker inspect --format "{{json .State.Health.Status }}" mysql)" != "\"healthy\"" ]]; do printf ${DOT}; sleep 5; done
echo ""
17 changes: 10 additions & 7 deletions quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ done
# Function check_prerequisites makes sure that you have curl, jq, docker-compose, and zip installed. See helpers.sh for details.
check_prerequisites

services="blacklight solr1 solr2 solr3 keycloak smui"


services="blacklight solr1 solr2 solr3 keycloak"

if $observability; then
Expand All @@ -81,9 +78,7 @@ if $vector_search; then
fi
fi

if $active_search_management; then
services="${services} smui"
fi


if ! $local_deploy; then
echo -e "${MAJOR}Updating configuration files for online deploy${RESET}"
Expand All @@ -101,6 +96,14 @@ if $shutdown; then
exit
fi

if $active_search_management; then
# need to start MySQL and verify it is up and running before starting SMUI.
docker compose up -d mysql
./mysql/wait-for-mysql.sh
services="${services} smui"

fi

docker-compose up -d --build ${services}

echo -e "${MAJOR}Waiting for Solr cluster to start up and all three nodes to be online.${RESET}"
Expand Down Expand Up @@ -151,7 +154,7 @@ else
curl --progress-bar -o ./solr/data/icecat-products-150k-20200809.tar.gz -k https://querqy.org/datasets/icecat/icecat-products-150k-20200809.tar.gz
fi
log_major "Populating products, please give it a few minutes!"
tar xzf ./solr/data/icecat-products-150k-20200809.tar.gz --to-stdout | curl --user solr:SolrRocks 'http://localhost:8983/solr/ecommerce/update?commit=true' --data-binary @- -H 'Content-type:application/json'
#tar xzf ./solr/data/icecat-products-150k-20200809.tar.gz --to-stdout | curl --user solr:SolrRocks 'http://localhost:8983/solr/ecommerce/update?commit=true' --data-binary @- -H 'Content-type:application/json'
fi

if $vector_search; then
Expand Down
37 changes: 37 additions & 0 deletions smui/3.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# --- !Ups

-- Add tag table.
-- Tags can be assigned to a single solr index or they can be global to all solr indexes (solr_index_id = null).
-- Exported tags must have a property (e.g. "tenant") and a value (e.g. "MO") so that the full tag would be "tenant:MO".
-- Tags that are not exported can have a value only without a property.
--
-- exported: 1 = is exported to querqy
-- 0 = is not exported to querqy and only used for tagging purposes in SMUI itself
create table input_tag (
id varchar(36) not null primary key,
solr_index_id varchar(36),
property varchar(1000),
tag_value varchar(1000) not null,
exported int not null,
predefined int not null,
last_update timestamp not null
);

create unique index input_tag_property_value_index on input_tag (solr_index_id, property (100), tag_value (100));
create index input_tag_predefined_index on input_tag (predefined);

-- Add table tag_2_input

create table tag_2_input (
tag_id varchar(36) not null,
input_id varchar(36) not null,
last_update timestamp not null,
primary key (tag_id, input_id)
);

create index tag_2_input_input_id_index on tag_2_input (input_id);

# --- !Downs

drop table input_tag;
drop table tag_2_input;
14 changes: 14 additions & 0 deletions smui/8.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# --- !Ups

-- Ensure that we do not allow duplicate solr indexes with same name.
create unique index solr_index_field_name on solr_index (name (500));

-- Ensure that we do not allow duplicate suggested solr fields for the same solr index.
create unique index suggested_solr_field_name_solr_index on suggested_solr_field (solr_index_id, name (500));



# --- !Downs

drop index solr_index_field_name
drop index suggested_solr_field_name_solr_index;
4 changes: 4 additions & 0 deletions smui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ FROM querqy/smui:4.0.11

COPY --chown=smui:smui conf/* conf/

# This is a workaround for now
COPY --chown=smui:smui 3.sql conf/evolutions/default/3.sql
COPY --chown=smui:smui 8.sql conf/evolutions/default/8.sql

USER root
RUN chmod +x conf/smui2*.sh
RUN apt-get update -y && apt-get install -y python3 python3-pip
Expand Down

0 comments on commit 918d94f

Please sign in to comment.