From 908d70bcee6e0adfbfda491f9e402dd630b95c91 Mon Sep 17 00:00:00 2001 From: danilapog Date: Fri, 30 Dec 2022 18:17:16 +0300 Subject: [PATCH] Add dameng stand --- Dockerfile | 1 + docker-compose-damengDB.yml | 55 +++++++++++++++++++++++++++++++++++++ prepare.sh | 8 ++++++ run-document-server.sh | 17 ++++++++++++ 4 files changed, 81 insertions(+) create mode 100644 docker-compose-damengDB.yml create mode 100755 prepare.sh diff --git a/Dockerfile b/Dockerfile index 4e6ae96..467a8ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -73,6 +73,7 @@ RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ COPY config /app/ds/setup/config/ COPY run-document-server.sh /app/ds/run-document-server.sh +COPY bin /opt/dmdbms/bin EXPOSE 80 443 diff --git a/docker-compose-damengDB.yml b/docker-compose-damengDB.yml new file mode 100644 index 0000000..e12f618 --- /dev/null +++ b/docker-compose-damengDB.yml @@ -0,0 +1,55 @@ +version: '2' +services: + onlyoffice-documentserver: + image: onlyoffice/4testing-documentserver-ee:99.99.99.${BUILD} + container_name: onlyoffice-documentserver + depends_on: + - onlyoffice-dameng + - onlyoffice-rabbitmq + environment: + - DB_TYPE=dameng + - DB_HOST=onlyoffice-dameng + - DB_PORT=5236 + - DB_NAME=onlyoffice + - DB_USER=onlyoffice + - AMQP_URI=amqp://guest:guest@onlyoffice-rabbitmq + # Uncomment strings below to enable the JSON Web Token validation. + #- JWT_ENABLED=true + #- JWT_SECRET=secret + #- JWT_HEADER=Authorization + #- JWT_IN_BODY=true + ports: + - '80:80' + - '443:443' + stdin_open: true + restart: always + stop_grace_period: 60s + volumes: + - /var/www/onlyoffice/Data + - /var/log/onlyoffice + - /var/lib/onlyoffice/documentserver/App_Data/cache/files + - /var/www/onlyoffice/documentserver-example/public/files + - /usr/share/fonts + + onlyoffice-rabbitmq: + container_name: onlyoffice-rabbitmq + image: rabbitmq + restart: always + expose: + - '5672' + + onlyoffice-dameng: + container_name: onlyoffice-dameng + image: dm8_single:v8.1.2.128_ent_x86_64_ctm_pack4 + environment: + - PAGE_SIZE=16 + - LD_LIBRARY_PATH=/opt/dmdbms/bin + - INSTANCE_NAME=dm8_01 + restart: always + expose: + - '5236' + volumes: + - dameng_data:/opt/dmdbms/data + +volumes: + dameng_data: diff --git a/prepare.sh b/prepare.sh new file mode 100755 index 0000000..77884cb --- /dev/null +++ b/prepare.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# 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" diff --git a/run-document-server.sh b/run-document-server.sh index 91a96b5..5824ff9 100755 --- a/run-document-server.sh +++ b/run-document-server.sh @@ -149,6 +149,9 @@ read_setting(){ "mariadb"|"mysql") DB_PORT=${DB_PORT:-"3306"} ;; + "dameng") + DB_PORT=${DB_PORT:-"5236"} + ;; "") DB_PORT=${DB_PORT:-${POSTGRESQL_SERVER_PORT:-$(${JSON} services.CoAuthoring.sql.dbPort)}} ;; @@ -371,6 +374,10 @@ create_db_tbl() { "mariadb"|"mysql") create_mysql_tbl ;; + "dameng") + create_dameng_tbl + ;; + esac } @@ -413,6 +420,16 @@ create_postgresql_tbl() { $PSQL -f "$APP_DIR/server/schema/postgresql/createdb.sql" } +create_dameng_tbl() { + DM8_USER=SYSDBA + DM8_PASS=SYSDBA001 + + (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 + (cd /opt/dmdbms/bin/ && ./disql $DM8_USER/$DM8_PASS@$DB_HOST:$DB_PORT \`$APP_DIR/server/schema/dameng/createdb.sql) +} + create_mysql_tbl() { CONNECTION_PARAMS="-h$DB_HOST -P$DB_PORT -u$DB_USER -p$DB_PWD -w" MYSQL="mysql -q $CONNECTION_PARAMS"