Docker через загрузку образов из файла¶
Подготовка¶
Подготовка сервера:
Обновите существующий список пакетов Ubuntu. Команда:
sudo apt update
Установите Docker.
Установите Docker Compose (версия выше 1.29).
Настройте разрешения для Docker Compose. Пример команды:
sudo chmod +x /usr/local/bin/docker-compose
Дистрибутив:
Заранее получите и скачайте образы Docker с дистрибутивом продукта Юниверс.
Установка¶
Скачайте и распакуйте из архива дистрибутива архивы образов Docker: universe_dg_ee_backend_docker_v2.6.zip и universe_dg_ee_frontend_docker_v2.6.zip. Внутри содержатся образы Docker с расширением .tar.
Распакуйте на сервер содержимое вышеуказанных архивов.
Запустите Docker.
Запустите загрузку образов:
docker load < /opt/universe_dg_ee_backend_docker_v2.6.tar
docker load < /opt/universe_dg_ee_frontend_docker_v2.6.tar
Дождитесь завершения.
Создайте файлы конфигурации
docker-compose.yml
,.env
,orientdb-server-config.xml
. Содержимое файлов см. ниже.
Расположение файлов на сервере может быть любым. Файлы конфигурации должны читаться через Docker compose.
Укажите имя образа и тег для файла .env. Используйте один из способов:
Измените имя и тег в параметрах BACKEND_IMAGE и FRONTEND_IMAGE файла .env. Сохраните изменения.
Используйте команду. Пример:
docker image tag repo.tddev.ru/universe-dg/backend:v2.6 universe_dg_ee_backend:v2.6
Отредактируйте остальные требуемые параметры в файлах
docker-compose.yml
,.env
иorientdb-server-config.xml
. Сохраните изменения.Перейдите в каталог с кодом. Пример команды:
cd universe-dg-deploy
Для запуска системы используйте команду:
docker-compose up -d
При запуске интерфейса система потребует лицензию. Установите вашу лицензию.
По умолчанию пользовательский интерфейс доступен для просмотра на localhost:8080.
Логин и пароль по умолчанию: admin/ admin. После первого входа в систему необходимо сменить пароль.
Обязательные файлы конфигурации¶
Указанные ниже файлы должны быть созданы вручную.
Пример файла .env:
BACKEND_IMAGE=universe_dg_ee_backend:v2.6
FRONTEND_IMAGE=universe_dg_ee_frontend:v2.6
OPENSEARCH_HTTP_OUTER_PORT=19200
DG_POSTGRES_USER=postgres
DG_POSTGRES_PASSWORD=postgres
DG_POSTGRES_DB_NAME=postgres
POSTGRES_OUTER_PORT=15432
ORIENTDB_HTTP_OUTER_PORT=12480
ORIENTDB_OUTER_PORT=12424
FRONTEND_PORT=8080
BACKEND_PORT=9080
BACKEND_ADDRESS=http://dg:8080
EMAIL_FRONTEND_URL=''
EMAIL_ENABLED=false
EMAIL_SERVER_HOST=localhost
EMAIL_SERVER_PORT=5025
EMAIL_SSL_ENABLE=true
EMAIL_STARTTLS_ENABLE=false
EMAIL_USERNAME=universe@example.com
EMAIL_PASSWORD=password
MODULES_BLACKLIST=org.universe.dg.crawler
GUEST_MODE=false
DG_DQ_ENSURE_MODEL=false
DG_DIS_UPDATE_PROFILES_PROJECTS_JOB_DISABLED=true
DG_DIS_UPDATE_PROFILES_PROJECTS_CRONEX=0 0 0/1 * * ?
DG_DIS_UPDATE_PROFILES_URL=http://localhost/list/profiles
DG_DIS_UPDATE_PROJECTS_URL=http://localhost/list/projects
где BACKEND_IMAGE и FRONTEND_IMAGE: имена Docker-образов и теги версии (тег указывается после двоеточия).
Пример файла docker-compose.yml:
version: '2.4'
services:
jacoco:
image: docker.universe-data.ru/universe/jacoco-agent:latest
profiles: ["jacoco"]
volumes:
- jacoco:/jacoco:ro
ui:
image: ${FRONTEND_IMAGE}
restart: always
ports:
- ${FRONTEND_PORT}:80
networks:
- dg_network
environment:
BACKEND_ADDRESS: ${BACKEND_ADDRESS}
links:
- dg
dg:
image: ${BACKEND_IMAGE}
restart: always
ports:
- ${BACKEND_PORT}:8080
- ${JACOCO_AGENT_PORT:-6300}:6300
networks:
- dg_network
volumes:
- ${BACKEND_INTEGRATION:-./universe-integration}:/usr/local/tomcat/universe-integration
- jacoco:/jacoco:ro
environment:
ORIENTDB_DB_ADDRESS: orientdb-dg:2424
ORIENTDB_DB_NAME: dg
ORIENTDB_USER: root
ORIENTDB_PASSWORD: root
POSTGRES_ADDRESS: postgres-dg:5432
POSTGRES_USERNAME: ${DG_POSTGRES_USER}
POSTGRES_PASSWORD: ${DG_POSTGRES_PASSWORD}
DATABASE_NAME: ${DG_POSTGRES_DB_NAME}
SEARCH_CLUSTER_ADDRESS: opensearch-dg:9200
SEARCH_CLUSTER_NAME: docker-cluster
EMAIL_ENABLED: ${EMAIL_ENABLED}
EMAIL_SERVER_HOST: ${EMAIL_SERVER_HOST}
EMAIL_SERVER_PORT: ${EMAIL_SERVER_PORT}
EMAIL_SSL_ENABLE: ${EMAIL_SSL_ENABLE}
EMAIL_STARTTLS_ENABLE: ${EMAIL_STARTTLS_ENABLE}
EMAIL_USERNAME: ${EMAIL_USERNAME}
EMAIL_PASSWORD: ${EMAIL_PASSWORD}
EMAIL_FRONTEND_URL: ${EMAIL_FRONTEND_URL}
MODULES_BLACKLIST: ${MODULES_BLACKLIST}
GUEST_MODE: ${GUEST_MODE}
DG_DQ_ENSURE_MODEL: ${DG_DQ_ENSURE_MODEL}
DG_DIS_UPDATE_PROFILES_JOB_DISABLED: ${DG_DIS_UPDATE_PROFILES_JOB_DISABLED}
DG_DIS_UPDATE_PROFILES_CRONEX: ${DG_DIS_UPDATE_PROFILES_CRONEX}
DG_DIS_UPDATE_PROFILES_URL: ${DG_DIS_UPDATE_PROFILES_URL}
JAVA_TOOL_OPTIONS: ${JAVA_TOOL_OPTIONS:-}
mem_limit: 2000m
mem_reservation: 1000m
depends_on:
postgres-dg:
condition: service_healthy
opensearch-dg:
condition: service_healthy
orientdb-dg:
condition: service_healthy
postgres-dg:
image: timescale/timescaledb:2.7.0-pg12
restart: always
environment:
POSTGRES_DB: ${DG_POSTGRES_DB_NAME}
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
DG_POSTGRES_USER: ${DG_POSTGRES_USER}
DG_POSTGRES_PASSWORD: ${DG_POSTGRES_PASSWORD}
ports:
- ${POSTGRES_OUTER_PORT}:5432
networks:
- dg_network
volumes:
- ./init-db.sh:/docker-entrypoint-initdb.d/initdb.sh
- dg-postgres-data:/var/lib/postgresql/data
command: postgres -c max_prepared_transactions=200 -c max_connections=200 -c shared_preload_libraries='timescaledb'
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d $DG_POSTGRES_DB_NAME"]
interval: 10s
timeout: 1s
retries: 20
opensearch-dg:
image: opensearchproject/opensearch:2.7.0
restart: always
environment:
- "OPENSEARCH_JAVA_OPTS=-Xms1024m -Xmx1024m"
- "discovery.type=single-node"
- "DISABLE_SECURITY_PLUGIN=true"
volumes:
- dg-opensearch-data:/usr/share/opensearch/data
- ./hunspell:/usr/share/opensearch/config/hunspell/
ulimits:
memlock:
soft: -1
hard: -1
ports:
- ${OPENSEARCH_HTTP_OUTER_PORT}:9200
networks:
- dg_network
healthcheck:
test: >
bash -c "curl http://localhost:9200 | grep '\"cluster_name\"'"
interval: 10s
timeout: 2s
retries: 20
orientdb-dg:
image: orientdb:3.2.4
restart: always
mem_limit: 2000m
mem_reservation: 1000m
environment:
ORIENTDB_ROOT_PASSWORD: root
ORIENTDB_OPTS_MEMORY: -Xmx256m -Dfile.mmap.maxMemory=500mb -Dstorage.diskCache.bufferSize=1000
JAVA_OPTS_SCRIPT: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap
ports:
- ${ORIENTDB_HTTP_OUTER_PORT}:2480
- ${ORIENTDB_OUTER_PORT}:2424
volumes:
- dg-orientdb-data:/orientdb/databases
- ./orientdb_configs/orientdb-server-config.xml:/orientdb/config/orientdb-server-config.xml
networks:
- dg_network
healthcheck:
test: >
bash -c "curl http://localhost:2480/listDatabases"
interval: 10s
timeout: 2s
retries: 20
volumes:
dg-postgres-data:
driver: local
dg-orientdb-data:
driver: local
dg-opensearch-data:
driver: local
jacoco:
driver: local
networks:
dg_network:
driver: bridge
Пример файла orientdb-server-config.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ /*
~ * Copyright 2014 Orient Technologies LTD (info(at)orientechnologies.com)
~ *
~ * Licensed under the Apache License, Version 2.0 (the "License");
~ * you may not use this file except in compliance with the License.
~ * You may obtain a copy of the License at
~ *
~ * http://www.apache.org/licenses/LICENSE-2.0
~ *
~ * Unless required by applicable law or agreed to in writing, software
~ * distributed under the License is distributed on an "AS IS" BASIS,
~ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ * See the License for the specific language governing permissions and
~ * limitations under the License.
~ *
~ * For more information: http://www.orientechnologies.com
~ */
-->
<orient-server>
<handlers>
<!-- DISABLED-->
<!--<handler class="com.orientechnologies.orient.graph.handler.OGraphServerHandler">-->
<!--<parameters>-->
<!--<parameter name="enabled" value="true"/>-->
<!--<parameter name="graph.pool.max" value="50"/>-->
<!--</parameters>-->
<!--</handler>-->
<!-- CLUSTER PLUGIN, TO TURN ON SET THE 'ENABLED' PARAMETER TO 'true' -->
<handler class="com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin">
<parameters>
<!-- <parameter name="nodeName" value="europe1" /> -->
<parameter name="enabled" value="${distributed}"/>
<parameter name="configuration.db.default"
value="${ORIENTDB_HOME}/config/default-distributed-db-config.json"/>
<parameter name="configuration.hazelcast" value="${ORIENTDB_HOME}/config/hazelcast.xml"/>
</parameters>
</handler>
<!-- JMX SERVER, TO TURN ON SET THE 'ENABLED' PARAMETER TO 'true' -->
<handler class="com.orientechnologies.orient.server.handler.OJMXPlugin">
<parameters>
<parameter name="enabled" value="false"/>
<parameter name="profilerManaged" value="true"/>
</parameters>
</handler>
<!-- AUTOMATIC BACKUP, TO TURN ON SET THE 'ENABLED' PARAMETER TO 'true' -->
<handler class="com.orientechnologies.orient.server.handler.OAutomaticBackup">
<parameters>
<parameter name="enabled" value="false"/>
<!-- LOCATION OF JSON CONFIGURATION FILE -->
<parameter name="config" value="${ORIENTDB_HOME}/config/automatic-backup.json"/>
</parameters>
</handler>
<!-- SERVER SIDE SCRIPT INTERPRETER. WARNING, THIS CAN BE A SECURITY HOLE BECAUSE MALICIOUS CODE COULD BE INJECTED.
ENABLE IT ONLY IF CLIENTS ARE TRUSTED, TO TURN ON SET THE 'ENABLED' PARAMETER TO 'true' -->
<handler
class="com.orientechnologies.orient.server.handler.OServerSideScriptInterpreter">
<parameters>
<parameter name="enabled" value="true"/>
<parameter name="allowedLanguages" value="SQL"/>
<!-- Comma separated packages allowed in JS scripts eg. java.math.*, java.util.ArrayList -->
<parameter name="allowedPackages" value=""/>
</parameters>
</handler>
<!-- CUSTOM SQL FUNCTIONS -->
<handler class="com.orientechnologies.orient.server.handler.OCustomSQLFunctionPlugin">
<parameters>
<!-- LOCATION OF JSON CONFIGURATION FILE -->
<parameter name="config" value="${ORIENTDB_HOME}/config/custom-sql-functions.json"/>
</parameters>
</handler>
</handlers>
<network>
<sockets>
<socket implementation="com.orientechnologies.orient.server.network.OServerTLSSocketFactory" name="ssl">
<parameters>
<parameter value="false" name="network.ssl.clientAuth"/>
<parameter value="config/cert/orientdb.ks" name="network.ssl.keyStore"/>
<parameter value="password" name="network.ssl.keyStorePassword"/>
<parameter value="config/cert/orientdb.ks" name="network.ssl.trustStore"/>
<parameter value="password" name="network.ssl.trustStorePassword"/>
</parameters>
</socket>
<socket implementation="com.orientechnologies.orient.server.network.OServerTLSSocketFactory" name="https">
<parameters>
<parameter value="false" name="network.ssl.clientAuth"/>
<parameter value="config/cert/orientdb.ks" name="network.ssl.keyStore"/>
<parameter value="password" name="network.ssl.keyStorePassword"/>
<parameter value="config/cert/orientdb.ks" name="network.ssl.trustStore"/>
<parameter value="password" name="network.ssl.trustStorePassword"/>
</parameters>
</socket>
</sockets>
<protocols>
<!-- Default registered protocol. It reads commands using the HTTP protocol
and write data locally -->
<protocol name="binary"
implementation="com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary"/>
<protocol name="http"
implementation="com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpDb"/>
</protocols>
<listeners>
<listener protocol="binary" ip-address="0.0.0.0" port-range="2424-2430" socket="default"/>
<listener protocol="http" ip-address="0.0.0.0" port-range="2480-2490" socket="default">
<parameters>
<!-- Connection's custom parameters. If not specified the global configuration
will be taken -->
<parameter name="network.http.charset" value="utf-8"/>
<parameter value="true" name="network.http.jsonResponseError"/>
<parameter value="Content-Security-Policy: frame-ancestors 'none'" name="network.http.additionalResponseHeaders"></parameter>
<!-- Define additional HTTP headers to always send as response -->
<!-- Allow cross-site scripting -->
<!-- parameter name="network.http.additionalResponseHeaders" value="Access-Control-Allow-Origin:
*;Access-Control-Allow-Credentials: true" / -->
</parameters>
<commands>
<command
pattern="GET|www GET|studio/ GET| GET|*.htm GET|*.html GET|*.xml GET|*.jpeg GET|*.jpg GET|*.png GET|*.gif GET|*.js GET|*.css GET|*.swf GET|*.ico GET|*.txt GET|*.otf GET|*.pjs GET|*.svg GET|*.json GET|*.woff GET|*.woff2 GET|*.ttf GET|*.svgz"
implementation="com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent">
<parameters>
<!-- Don't cache html resources in development mode -->
<entry name="http.cache:*.htm *.html"
value="Cache-Control: no-cache, no-store, max-age=0, must-revalidate\r\nPragma: no-cache"/>
<!-- Default caching -->
<entry name="http.cache:default" value="Cache-Control: max-age=120"/>
</parameters>
</command>
<command pattern="GET|gephi/*"
implementation="com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetGephi"/>
</commands>
</listener>
</listeners>
<cluster>
</cluster>
</network>
<storages>
<storage name="dg" path="plocal:/orientdb/databases/dg"
userName="root" userPassword="root"
loaded-at-startup="true" />
</storages>
<users>
</users>
<properties>
<!-- PROFILER: configures the profiler as <seconds-for-snapshot>,<archive-snapshot-size>,<summary-size> -->
<entry name="profiler.enabled" value="false"/>
<!-- <entry name="profiler.config" value="30,10,10" /> -->
</properties>
</orient-server>