From 5d07a93187a376a5b243fa8f40993f36db1b141f Mon Sep 17 00:00:00 2001 From: danilapog Date: Mon, 9 Jan 2023 14:36:00 +0300 Subject: [PATCH] Refactoring damengdb stand --- run-document-server.sh | 1 + tests/damengdb/README.md | 18 ++++++++++++++++++ tests/damengdb/damengdb-get-disql.sh | 8 ++++++++ .../damengdb-get-image.sh} | 6 ++---- .../docker-compose.yml} | 2 ++ 5 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 tests/damengdb/README.md create mode 100755 tests/damengdb/damengdb-get-disql.sh rename tests/{damengdb_prepare.sh => damengdb/damengdb-get-image.sh} (51%) rename tests/{damengdb.yml => damengdb/docker-compose.yml} (93%) diff --git a/run-document-server.sh b/run-document-server.sh index 5824ff9..10eda57 100755 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -427,6 +427,7 @@ create_dameng_tbl() { (cd /opt/dmdbms/bin/ && ./disql $DM8_USER/$DM8_PASS@$DB_HOST:$DB_PORT -e "create user "onlyoffice" identified by "onlyoffice" password_policy 0;") # Create db on remote server + echo "EXIT" | tee -a $APP_DIR/server/schema/dameng/createdb.sql (cd /opt/dmdbms/bin/ && ./disql $DM8_USER/$DM8_PASS@$DB_HOST:$DB_PORT \`$APP_DIR/server/schema/dameng/createdb.sql) } diff --git a/tests/damengdb/README.md b/tests/damengdb/README.md new file mode 100644 index 0000000..8b082de --- /dev/null +++ b/tests/damengdb/README.md @@ -0,0 +1,18 @@ +## Stand Documentserver with damengdb + +### How it works + +#### Only on the first run: + +The first deployment of the stand requires the execution of scripts to prepare the environment. + +***First:*** It is necessary to obtain an image of the dameng db database. To do this, run the script: + bash damengdb-get-image.sh + +***Second:*** After the image is obtained, it is also necessary to obtain a binary DISQL files that is used for remote access to the database service. To do this, run the script: + bash damengdb-get-disql.sh + +### Deploy stand + +After db image and disql binary is ready, you cant deploy stand with flexible build number with simple command: + BUILD= docker compose up -d diff --git a/tests/damengdb/damengdb-get-disql.sh b/tests/damengdb/damengdb-get-disql.sh new file mode 100755 index 0000000..4c51c9d --- /dev/null +++ b/tests/damengdb/damengdb-get-disql.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# Get disql for remote access + docker run -d -p 5236:5236 --restart=always --name dm8_01 --privileged=true -e PAGE_SIZE=16 -e LD_LIBRARY_PATH=/opt/dmdbms/bin -e INSTANCE_NAME=dm8_01 + echo "Disql bin will be copied from dm8 container. Please wait couple of minutes" + sleep 60 + docker cp dm8_01:/opt/dmdbms/bin . + docker stop dm8_01 ; docker rm dm8_01 + echo "OK: Disql bin files ready" diff --git a/tests/damengdb_prepare.sh b/tests/damengdb/damengdb-get-image.sh similarity index 51% rename from tests/damengdb_prepare.sh rename to tests/damengdb/damengdb-get-image.sh index 77884cb..a922928 100755 --- a/tests/damengdb_prepare.sh +++ b/tests/damengdb/damengdb-get-image.sh @@ -2,7 +2,5 @@ # Download dameng image wget -O dm8_docker.tar -c https://download.dameng.com/eco/dm8/dm8_20220822_rev166351_x86_rh6_64_ctm.tar docker load -i dm8_docker.tar -echo "OK: Dameng image ready. Now you can run: docker compose up -d" -# Extract disql bin files - tar -xvf disql.tar -echo "OK: disql files was extracted in ./bin folder" + echo "OK: Dameng image already downloaded" + rm -rf dm8_docker.tar diff --git a/tests/damengdb.yml b/tests/damengdb/docker-compose.yml similarity index 93% rename from tests/damengdb.yml rename to tests/damengdb/docker-compose.yml index e12f618..ec333f6 100644 --- a/tests/damengdb.yml +++ b/tests/damengdb/docker-compose.yml @@ -25,6 +25,8 @@ services: restart: always stop_grace_period: 60s volumes: + - ../../run-document-server.sh:/app/ds/run-document-server.sh + - ./bin:/opt/dmdbms/bin/ - /var/www/onlyoffice/Data - /var/log/onlyoffice - /var/lib/onlyoffice/documentserver/App_Data/cache/files