From 7ca581e18706ebb66e19c8f57a9f7085780fbc02 Mon Sep 17 00:00:00 2001 From: WizaXxX Date: Sat, 13 Mar 2021 22:25:31 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D1=83=20=D1=84=D0=BE?= =?UTF-8?q?=D1=80=D0=BC=D0=B0=D1=82=D0=B0=20=D0=BF=D0=BE=D1=82=D0=BE=D0=BA?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose_pattern.yml | 5 ++-- modules/helper.py | 56 +++++++++++++++++++++++++++++++------- other_files/params.json | 6 ++-- start.py | 15 +++++----- 4 files changed, 60 insertions(+), 22 deletions(-) diff --git a/docker-compose_pattern.yml b/docker-compose_pattern.yml index e5b9787..d3b588c 100644 --- a/docker-compose_pattern.yml +++ b/docker-compose_pattern.yml @@ -72,7 +72,7 @@ services: command: srv+cli volumes: - 1c_pg_socket:/tmp/postgresql/socket - - ./artifacts/srv/data:/var/lib/1c/data + - 1c_server_data:/var/lib/1c/data - ./artifacts/srv/log:/var/log/1c - ./mnt:/mnt - /tmp/.aksusb:/tmp/.aksusb @@ -154,4 +154,5 @@ services: volumes: 1c_pg_data: - 1c_pg_socket: \ No newline at end of file + 1c_pg_socket: + 1c_server_data: \ No newline at end of file diff --git a/modules/helper.py b/modules/helper.py index 39defb4..fd283a4 100644 --- a/modules/helper.py +++ b/modules/helper.py @@ -26,6 +26,16 @@ def new_docker_command(extra_path=None): command.append(current_distr_path + ':/out_files') return command +def add_command_copy_file_from_mnt_to_tmp(commands, container_name, full_path, file_name): + + commands.append('docker') + commands.append('exec') + commands.append(container_name) + commands.append('sh') + commands.append('-c') + commands.append('"cp {} /tmp/{}"'.format(full_path, file_name)) + commands.append('&&') + def web_publish_command(host_name, conf_name, internal, descriptor, base_name=''): if internal: @@ -59,32 +69,42 @@ def get_out_file_name_command(action, ib_name): return '/Out "/mnt/{}_{}.out"'.format(action, ib_name) def create_ib_command(host_name, ib_name, file_name, job_block, action): + + full_path = '/mnt/{}'.format(file_name) + container_name = 'srv.{}'.format(host_name) + command = [] + add_command_copy_file_from_mnt_to_tmp(command, container_name, full_path, file_name) command.append('docker') command.append('exec') command.append('-t') - command.append('srv.' + host_name) + command.append(container_name) command.append('{}1cv8'.format(path_to_1c)) command.append('CREATEINFOBASE') command.append('"Srvr=srv;Ref={0};DBMS=PostgreSQL;DBSrvr=/tmp/postgresql/socket;DB={0};DBUID=postgres;LicDstr=Y;Locale=ru_RU;CrSQLDB=Y;SchJobDn={1};"'.format( ib_name, job_block)) command.append('/UseTemplate') - command.append('/mnt/{}'.format(file_name)) + command.append('/tmp/{}'.format(file_name)) command.append(get_out_file_name_command(action, ib_name)) return command def install_control_ext_command(host_name, ib_name, action): + + full_path = '/mnt/other-files/cfe/api_1cfresh.cfe' + container_name = 'srv.{}'.format(host_name) + command = [] + add_command_copy_file_from_mnt_to_tmp(command, container_name, full_path, 'api_1cfresh.cfe') command.append('docker') command.append('exec') command.append('-t') - command.append('srv.' + host_name) + command.append(container_name) command.append('{}1cv8'.format(path_to_1c)) command.append('DESIGNER') command.append('/S') command.append('"srv\\{}"'.format(ib_name)) command.append('/LoadCfg') - command.append('"/mnt/other-files/cfe/api_1cfresh.cfe"') + command.append('"/tmp/api_1cfresh.cfe"') command.append('-Extension') command.append('"api_1cfresh"') command.append('/UpdateDBCfg') @@ -92,17 +112,22 @@ def install_control_ext_command(host_name, ib_name, action): return command def install_sm_ext_command(host_name, ib_name, action): + + full_path = '/mnt/other-files/cfe/УправлениеМС.cfe' + container_name = 'srv.{}'.format(host_name) + command = [] + add_command_copy_file_from_mnt_to_tmp(command, container_name, full_path, 'УправлениеМС.cfe') command.append('docker') command.append('exec') command.append('-t') - command.append('srv.' + host_name) + command.append(container_name) command.append('{}1cv8'.format(path_to_1c)) command.append('DESIGNER') command.append('/S') command.append('"srv\\{}"'.format(ib_name)) command.append('/LoadCfg') - command.append('"/mnt/other-files/cfe/УправлениеМС.cfe"') + command.append('"/tmp/УправлениеМС.cfe"') command.append('-Extension') command.append('"УправлениеМС"') command.append('/UpdateDBCfg') @@ -110,17 +135,23 @@ def install_sm_ext_command(host_name, ib_name, action): return command def install_ext_command(host_name, ib_name, action): + + full_path = '/mnt/{}.cfe'.format(ib_name) + file_name = '{}.cfe'.format(ib_name) + container_name = 'srv.{}'.format(host_name) + command = [] + add_command_copy_file_from_mnt_to_tmp(command, container_name, full_path, file_name) command.append('docker') command.append('exec') command.append('-t') - command.append('srv.' + host_name) + command.append(container_name) command.append('{}1cv8'.format(path_to_1c)) command.append('DESIGNER') command.append('/S') command.append('"srv\\{}"'.format(ib_name)) command.append('/LoadCfg') - command.append('"/mnt/{}.cfe"'.format(ib_name)) + command.append('"/tmp/{}"'.format(file_name)) command.append('-Extension') command.append('"fresh"') command.append('/UpdateDBCfg') @@ -128,17 +159,22 @@ def install_ext_command(host_name, ib_name, action): return command def disable_safe_mode(host_name, ib_name, action): + + full_path = '/mnt/other-files/cfe/disable.epf' + container_name = 'srv.{}'.format(host_name) + command = [] + add_command_copy_file_from_mnt_to_tmp(command, container_name, full_path, 'disable.epf') command.append('docker') command.append('exec') command.append('-t') - command.append('srv.' + host_name) + command.append(container_name) command.append('{}1cv8'.format(path_to_1c)) command.append('ENTERPRICE') command.append('/S') command.append('"srv\\{}"'.format(ib_name)) command.append('/Execute') - command.append('"/mnt/other-files/cfe/disable.epf"') + command.append('"/tmp/disable.epf"') command.append(get_out_file_name_command(action, ib_name)) return command diff --git a/other_files/params.json b/other_files/params.json index cef42bd..4b3e87e 100755 --- a/other_files/params.json +++ b/other_files/params.json @@ -29,7 +29,7 @@ "ИмяФайлаШаблонаВнутреннейПубликации": "zoneless", "СоздаватьВМенеджере": true, "ИмяФайлаКонфигурации":"smtl.cf", - "БлокироватьРаботуРегЗаданийПриСоздании": false + "БлокироватьРаботуРегЗаданийПриСоздании": true }, { "Сервер": "web/int/sa", @@ -44,7 +44,7 @@ "ИмяФайлаШаблонаВнутреннейПубликации": "zoneless", "СоздаватьВМенеджере": true, "ИмяФайлаКонфигурации":"sa.cf", - "БлокироватьРаботуРегЗаданийПриСоздании": false + "БлокироватьРаботуРегЗаданийПриСоздании": true }, { "Сервер": "", @@ -59,7 +59,7 @@ "ИмяФайлаШаблонаВнутреннейПубликации": "zoneless", "СоздаватьВМенеджере": false, "ИмяФайлаКонфигурации":"am.cf", - "БлокироватьРаботуРегЗаданийПриСоздании": false + "БлокироватьРаботуРегЗаданийПриСоздании": true } ] } \ No newline at end of file diff --git a/start.py b/start.py index 4763eb2..680f7eb 100644 --- a/start.py +++ b/start.py @@ -212,6 +212,7 @@ def delete_volumes(): call('docker volume rm workdir_1c_pg_data', remote=False) call('docker volume rm workdir_1c_pg_socket', remote=False) + call('docker volume rm workdir_1c_server_data', remote=False) @print_description def prepare_bases(): @@ -229,6 +230,8 @@ def prepare_bases(): conf_file_name=ib_data[ib_prop.conf_file], job_block=ib_data[ib_prop.job] ) + if ib_data[ib_prop.job]: + enable_job(ib_data[ib_prop.name], ib_data[ib_prop.adm]) # prepare sm base prepare_new_ib( @@ -236,7 +239,9 @@ def prepare_bases(): int_name=sm_ib[ib_prop.int_name], conf_file_name=sm_ib[ib_prop.conf_file], job_block=sm_ib[ib_prop.job] - ) + ) + if ib_prop.job: + enable_job(ib_data[ib_prop.name], ib_data[ib_prop.adm]) @print_description def renew_nginx_files(): @@ -413,12 +418,9 @@ def wait_site(): call('docker exec -t site.{} /wait_site.sh'.format(host_name), remote=False) +def enable_job(base_name, user): -@print_description -def enable_job_in_sm(): - """Enable scheduled jobs sm""" - - call('docker exec -t ras.{} deployka scheduledjobs unlock -db sm -db-user "Администратор"'.format(host_name), + call('docker exec -t ras.{} deployka scheduledjobs unlock -db {} -db-user "{}"'.format(host_name, base_name, user), remote=False) @print_description @@ -465,7 +467,6 @@ if new_server: create_bucket() publish_sevises() prepare_bases() - enable_job_in_sm() create_db_site() create_db_forum()