mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 03:58:14 +00:00
[improvement]Use QueryWrapper in place of hard-coded SQLs (#1944)
Some checks are pending
supersonic CentOS CI / build (11) (push) Waiting to run
supersonic CentOS CI / build (21) (push) Waiting to run
supersonic CentOS CI / build (8) (push) Waiting to run
supersonic mac CI / build (11) (push) Waiting to run
supersonic mac CI / build (21) (push) Waiting to run
supersonic mac CI / build (8) (push) Waiting to run
supersonic ubuntu CI / build (11) (push) Waiting to run
supersonic ubuntu CI / build (21) (push) Waiting to run
supersonic ubuntu CI / build (8) (push) Waiting to run
supersonic windows CI / build (11) (push) Waiting to run
supersonic windows CI / build (21) (push) Waiting to run
supersonic windows CI / build (8) (push) Waiting to run
Some checks are pending
supersonic CentOS CI / build (11) (push) Waiting to run
supersonic CentOS CI / build (21) (push) Waiting to run
supersonic CentOS CI / build (8) (push) Waiting to run
supersonic mac CI / build (11) (push) Waiting to run
supersonic mac CI / build (21) (push) Waiting to run
supersonic mac CI / build (8) (push) Waiting to run
supersonic ubuntu CI / build (11) (push) Waiting to run
supersonic ubuntu CI / build (21) (push) Waiting to run
supersonic ubuntu CI / build (8) (push) Waiting to run
supersonic windows CI / build (11) (push) Waiting to run
supersonic windows CI / build (21) (push) Waiting to run
supersonic windows CI / build (8) (push) Waiting to run
* [improvement][launcher]Use API to get element ID avoiding hard-code. * [fix][launcher]Fix mysql scripts. * [improvement][launcher]Support DuckDB database and refactor translator code structure. * [improvement][headless-fe] Revamped the interaction for semantic modeling routing and successfully implemented the switching between dimension and dataset management. * [improvement][Headless] Add table ddl in Dbschema * [improvement][Headless] Add get database by type * [improvement][Headless] Supports automatic batch creation of models based on db table names. * [improvement][Headless] Supports getting domain by bizName * [improvement][launcher]Refactor unit tests and demo data. * [fix][launcher]Change default vector dimension to 512. * [improvement](Dict) add dimValueAliasMap info for KnowledgeBaseService * [improvement][headless]Use QueryWrapper to replace hard-code SQL in mapper xml. * [improvement][chat]Introduce ChatMemory to delegate ChatMemoryDO. * [fix][common]Fix embedding store sys configs. * [fix][common]Fix postgres schema, using varchar instead of char. * [improvement][launcher]Change supersonic docker deployment from mysql to postgres. * [Fix][launcher]Fix a number of issues related to semantic modeling. * [Fix][headless]Fix the evaluation logic of agg type. * [fix][assembly]Fix Dockerfile and add docker compose run script. * [fix][chat]Fix "multiple assignments to same column "similar_queries". * [improvement][headless]Use LamdaQueryWrapper to avoid hard-coded column names. * [improvement][headless]Refactor headless infra to support advanced semantic modelling. * [improvement][headless]Change class name `Dim` to `Dimension`. * [improvement][chat]Introduce `TimeFieldMapper` to always map time field. * [fix][headless]Remove unnecessary dimension existence check. * [fix][chat]Fix adjusted filters don't take effect. ---------
This commit is contained in:
@@ -7,14 +7,13 @@ WORKDIR /usr/src/app
|
||||
# Argument to pass in the supersonic version at build time
|
||||
ARG SUPERSONIC_VERSION
|
||||
|
||||
# Install necessary packages, including MySQL client
|
||||
RUN apt-get update && \
|
||||
apt-get install -y default-mysql-client unzip && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
RUN apt-get update
|
||||
|
||||
# Install necessary packages, including Postgres client
|
||||
RUN apt-get update && apt-get install -y postgresql-client
|
||||
|
||||
# Install the vim editor.
|
||||
RUN apt-get update && \
|
||||
apt-get install -y vim && \
|
||||
RUN apt-get update && apt-get install -y vim && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Update the package list and install iputils-ping.
|
||||
@@ -40,4 +39,4 @@ WORKDIR /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION}
|
||||
EXPOSE 9080
|
||||
# Command to run the supersonic daemon
|
||||
RUN chmod +x bin/supersonic-daemon.sh
|
||||
CMD ["bash", "-c", "bin/supersonic-daemon.sh restart standalone prd && tail -f /dev/null"]
|
||||
CMD ["bash", "-c", "bin/supersonic-daemon.sh restart standalone docker && tail -f /dev/null"]
|
||||
32
docker/DockerfileS2
Normal file
32
docker/DockerfileS2
Normal file
@@ -0,0 +1,32 @@
|
||||
# Use an official OpenJDK runtime as a parent image
|
||||
FROM supersonicbi/supersonic:0.9.8
|
||||
|
||||
# Set the working directory in the container
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Argument to pass in the supersonic version at build time
|
||||
ARG SUPERSONIC_VERSION
|
||||
|
||||
# Install necessary packages, including Postgres client
|
||||
RUN apt-get install -y postgresql-client
|
||||
|
||||
RUN rm /usr/src/app/supersonic-standalone-latest
|
||||
|
||||
# Copy the supersonic standalone zip file into the container
|
||||
COPY assembly/build/supersonic-standalone-${SUPERSONIC_VERSION}.zip .
|
||||
|
||||
# Unzip the supersonic standalone zip
|
||||
RUN unzip supersonic-standalone-${SUPERSONIC_VERSION}.zip && \
|
||||
rm supersonic-standalone-${SUPERSONIC_VERSION}.zip
|
||||
|
||||
# Create a symbolic link to the supersonic installation directory
|
||||
RUN ln -s /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION} /usr/src/app/supersonic-standalone-latest
|
||||
|
||||
# Set the working directory to the supersonic installation directory
|
||||
WORKDIR /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION}
|
||||
|
||||
# Expose the default port
|
||||
EXPOSE 9080
|
||||
# Command to run the supersonic daemon
|
||||
RUN chmod +x bin/supersonic-daemon.sh
|
||||
CMD ["bash", "-c", "bin/supersonic-daemon.sh restart standalone docker && tail -f /dev/null"]
|
||||
3
docker/docker-compose-run.sh
Normal file
3
docker/docker-compose-run.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SUPERSONIC_VERSION=0.9.10-SNAPSHOT docker-compose -f docker-compose.yml -p supersonic up
|
||||
@@ -1,51 +1,28 @@
|
||||
services:
|
||||
chroma:
|
||||
image: chromadb/chroma:0.5.3
|
||||
postgres:
|
||||
image: pgvector/pgvector:pg17
|
||||
privileged: true
|
||||
container_name: supersonic_chroma
|
||||
ports:
|
||||
- "8000:8000"
|
||||
volumes:
|
||||
- chroma_data:/chroma
|
||||
networks:
|
||||
- supersonic_network
|
||||
dns:
|
||||
- 114.114.114.114
|
||||
- 8.8.8.8
|
||||
- 8.8.4.4
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "http://0.0.0.0:8000"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
privileged: true
|
||||
container_name: supersonic_mysql
|
||||
container_name: supersonic_postgres
|
||||
environment:
|
||||
LANG: 'C.UTF-8' # 设置环境变量
|
||||
MYSQL_ROOT_PASSWORD: root_password
|
||||
MYSQL_DATABASE: supersonic_db
|
||||
MYSQL_USER: supersonic_user
|
||||
MYSQL_PASSWORD: supersonic_password
|
||||
POSTGRES_ROOT_PASSWORD: root_password
|
||||
POSTGRES_DATABASE: postgres
|
||||
POSTGRES_USER: supersonic_user
|
||||
POSTGRES_PASSWORD: supersonic_password
|
||||
ports:
|
||||
- "13306:3306"
|
||||
- "15432:5432"
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
- postgres_data:/var/lib/postgresql
|
||||
networks:
|
||||
- supersonic_network
|
||||
dns:
|
||||
- 114.114.114.114
|
||||
- 8.8.8.8
|
||||
- 8.8.4.4
|
||||
depends_on:
|
||||
chroma:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
test: ["CMD-SHELL", "sh -c 'pg_isready -U supersonic_user -d postgres'"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
|
||||
db_init:
|
||||
@@ -53,22 +30,21 @@ services:
|
||||
privileged: true
|
||||
container_name: supersonic_db_init
|
||||
depends_on:
|
||||
mysql:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- supersonic_network
|
||||
command: >
|
||||
sh -c "
|
||||
sleep 15 &&
|
||||
if ! mysql -h supersonic_mysql -usupersonic_user -psupersonic_password -e 'use supersonic_db; show tables;' | grep -q 's2_database'; then
|
||||
mysql -h supersonic_mysql -usupersonic_user -psupersonic_password supersonic_db < /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}/conf/db/schema-mysql.sql &&
|
||||
mysql -h supersonic_mysql -usupersonic_user -psupersonic_password supersonic_db < /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}/conf/db/schema-mysql-demo.sql &&
|
||||
mysql -h supersonic_mysql -usupersonic_user -psupersonic_password supersonic_db < /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}/conf/db/data-mysql.sql &&
|
||||
mysql -h supersonic_mysql -usupersonic_user -psupersonic_password supersonic_db < /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}/conf/db/data-mysql-demo.sql
|
||||
else
|
||||
echo 'Database already initialized.'
|
||||
fi
|
||||
"
|
||||
if ! PGPASSWORD=supersonic_password psql -h supersonic_postgres -U supersonic_user -d postgres -c 'select * from s2_database limit 1' > /dev/null;
|
||||
then
|
||||
PGPASSWORD=supersonic_password psql -hsupersonic_postgres -U supersonic_user -d postgres < /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}/conf/db/schema-postgres.sql
|
||||
PGPASSWORD=supersonic_password psql -hsupersonic_postgres -U supersonic_user -d postgres < /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}/conf/db/schema-postgres-demo.sql
|
||||
PGPASSWORD=supersonic_password psql -hsupersonic_postgres -U supersonic_user -d postgres < /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}/conf/db/data-postgres.sql
|
||||
PGPASSWORD=supersonic_password psql -hsupersonic_postgres -U supersonic_user -d postgres < /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}/conf/db/data-postgres-demo.sql
|
||||
else
|
||||
echo 'Database already initialized.'
|
||||
fi"
|
||||
dns:
|
||||
- 114.114.114.114
|
||||
- 8.8.8.8
|
||||
@@ -79,17 +55,14 @@ services:
|
||||
privileged: true
|
||||
container_name: supersonic_standalone
|
||||
environment:
|
||||
DB_HOST: supersonic_mysql
|
||||
DB_NAME: supersonic_db
|
||||
DB_HOST: supersonic_postgres
|
||||
DB_NAME: postgres
|
||||
DB_USERNAME: supersonic_user
|
||||
DB_PASSWORD: supersonic_password
|
||||
CHROMA_HOST: supersonic_chroma
|
||||
ports:
|
||||
- "9080:9080"
|
||||
depends_on:
|
||||
chroma:
|
||||
condition: service_healthy
|
||||
mysql:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
db_init:
|
||||
condition: service_completed_successfully
|
||||
@@ -112,8 +85,7 @@ services:
|
||||
# propagation: rprivate
|
||||
# create_host_path: true
|
||||
volumes:
|
||||
mysql_data:
|
||||
chroma_data:
|
||||
postgres_data:
|
||||
supersonic_data:
|
||||
|
||||
networks:
|
||||
|
||||
Reference in New Issue
Block a user