mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 12:07:42 +00:00
[improvement][docker]Facilitate database configuration when running with docker.
This commit is contained in:
5
assembly/bin/supersonic-docker-compose.sh
Normal file
5
assembly/bin/supersonic-docker-compose.sh
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
export SUPERSONIC_VERSION=latest
|
||||||
|
|
||||||
|
docker-compose -f docker-compose.yml -p supersonic up
|
||||||
23
assembly/bin/supersonic-docker-run.sh
Normal file
23
assembly/bin/supersonic-docker-run.sh
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
export SUPERSONIC_VERSION=latest
|
||||||
|
|
||||||
|
#### Set below DB configs to connect to your own database
|
||||||
|
# Supported DB_TYPE: h2, mysql, postgres
|
||||||
|
export S2_DB_TYPE=h2
|
||||||
|
export S2_DB_HOST=
|
||||||
|
export S2_DB_PORT=
|
||||||
|
export S2_DB_USER=
|
||||||
|
export S2_DB_PASSWORD=
|
||||||
|
export S2_DB_DATABASE=
|
||||||
|
|
||||||
|
docker run --rm -it -d \
|
||||||
|
--name supersonic_standalone \
|
||||||
|
-p 9080:9080 \
|
||||||
|
-e S2_DB_TYPE=${S2_DB_TYPE} \
|
||||||
|
-e S2_DB_HOST=${S2_DB_HOST} \
|
||||||
|
-e S2_DB_PORT=${S2_DB_PORT} \
|
||||||
|
-e S2_DB_USER=${S2_DB_USER} \
|
||||||
|
-e S2_DB_PASSWORD=${S2_DB_PASSWORD} \
|
||||||
|
-e S2_DB_DATABASE=${S2_DB_DATABASE} \
|
||||||
|
supersonicbi/supersonic:${SUPERSONIC_VERSION}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
#### Set below DB configs to connect to your own database
|
#### Set below DB configs to connect to your own database
|
||||||
|
# Comment out below exports to config your DB connection
|
||||||
# Supported DB_TYPE: h2, mysql, postgres
|
# Supported DB_TYPE: h2, mysql, postgres
|
||||||
export S2_DB_TYPE=h2
|
#export S2_DB_TYPE=h2
|
||||||
export S2_DB_HOST=
|
#export S2_DB_HOST=
|
||||||
export S2_DB_PORT=
|
#export S2_DB_PORT=
|
||||||
export S2_DB_USER=
|
#export S2_DB_USER=
|
||||||
export S2_DB_PASSWORD=
|
#export S2_DB_PASSWORD=
|
||||||
export S2_DB_DATABASE=
|
#export S2_DB_DATABASE=
|
||||||
@@ -27,4 +27,4 @@ WORKDIR /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION}
|
|||||||
EXPOSE 9080
|
EXPOSE 9080
|
||||||
# Command to run the supersonic daemon
|
# Command to run the supersonic daemon
|
||||||
RUN chmod +x bin/supersonic-daemon.sh
|
RUN chmod +x bin/supersonic-daemon.sh
|
||||||
CMD ["bash", "-c", "bin/supersonic-daemon.sh restart standalone docker && tail -f /dev/null"]
|
CMD ["bash", "-c", "bin/supersonic-daemon.sh restart standalone ${S2_DB_TYPE} && tail -f /dev/null"]
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
# Function to execute the build script
|
# Function to execute the build script
|
||||||
execute_build_script() {
|
execute_build_script() {
|
||||||
echo "Executing build script: assembly/bin/supersonic-build.sh"
|
echo "Executing build script: sh assembly/bin/supersonic-build.sh"
|
||||||
assembly/bin/supersonic-build.sh
|
sh assembly/bin/supersonic-build.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to build the Docker image
|
# Function to build the Docker image
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
SUPERSONIC_VERSION=latest docker-compose -f docker-compose.yml -p supersonic up
|
|
||||||
@@ -30,10 +30,12 @@ services:
|
|||||||
privileged: true
|
privileged: true
|
||||||
container_name: supersonic_standalone
|
container_name: supersonic_standalone
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: supersonic_postgres
|
S2_DB_TYPE: postgres
|
||||||
DB_NAME: postgres
|
S2_DB_HOST: supersonic_postgres
|
||||||
DB_USERNAME: supersonic_user
|
S2_DB_PORT: 5432
|
||||||
DB_PASSWORD: supersonic_password
|
S2_DB_DATABASE: postgres
|
||||||
|
S2_DB_USER: supersonic_user
|
||||||
|
S2_DB_PASSWORD: supersonic_password
|
||||||
ports:
|
ports:
|
||||||
- "9080:9080"
|
- "9080:9080"
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
spring:
|
|
||||||
datasource:
|
|
||||||
driver-class-name: org.postgresql.Driver
|
|
||||||
url: jdbc:postgresql://${DB_HOST}:${DB_PORT:5432}/${DB_NAME}?stringtype=unspecified
|
|
||||||
username: ${DB_USERNAME}
|
|
||||||
password: ${DB_PASSWORD}
|
|
||||||
sql:
|
|
||||||
init:
|
|
||||||
continue-on-error: true
|
|
||||||
mode: always
|
|
||||||
username: ${DB_USERNAME}
|
|
||||||
password: ${DB_PASSWORD}
|
|
||||||
schema-locations: classpath:db/schema-postgres.sql,classpath:db/schema-postgres-demo.sql
|
|
||||||
data-locations: classpath:db/data-postgres.sql,classpath:db/data-postgres-demo.sql
|
|
||||||
|
|
||||||
s2:
|
|
||||||
embedding:
|
|
||||||
store:
|
|
||||||
provider: PGVECTOR
|
|
||||||
base:
|
|
||||||
url: ${DB_HOST}
|
|
||||||
port: ${DB_PORT:5432}
|
|
||||||
databaseName: ${DB_NAME}
|
|
||||||
user: ${DB_USERNAME}
|
|
||||||
password: ${DB_PASSWORD}
|
|
||||||
dimension: 512
|
|
||||||
Reference in New Issue
Block a user