1
0
mirror of https://github.com/1C-Company/docker_fresh.git synced 2025-03-03 14:42:21 +02:00
docker_fresh/modules/helper.py

71 lines
2.2 KiB
Python
Raw Normal View History

2020-04-05 16:06:36 +03:00
import pathlib
import os
sep = str(os.path.sep)
this_path = str(pathlib.Path().absolute()) + sep
distr_path = this_path + 'distr' + sep
def replace_sep(path):
return path.replace('/', sep)
def new_docker_command(extra_path=None):
command = []
command.append('docker')
command.append('run')
command.append('--rm')
command.append('-v')
if extra_path != None:
current_distr_path = this_path + extra_path
current_distr_path = current_distr_path.replace('/', sep)
else:
current_distr_path = distr_path
command.append(current_distr_path + ':/out_files')
2020-04-06 00:09:47 +03:00
return command
def web_publish_command(host_name, conf_name, internal, descriptor, base_name=''):
if internal:
prefix = 'a'
else:
prefix = 'int'
command = []
command.append('docker')
command.append('exec')
command.append('web.' + host_name)
command.append('/opt/1C/v8.3/x86_64/webinst')
command.append('-apache24')
command.append('-wsdir')
command.append(prefix + '/' + conf_name)
command.append('-dir')
command.append('/var/www/' + conf_name)
command.append('-connstr')
if base_name != '':
command.append('\'Srvr=srv;Ref=' + base_name + ';\'')
else:
command.append('\'Srvr=srv;Ref=' + conf_name + ';\'')
command.append('-confpath')
command.append('\'/etc/httpd/conf/httpd.conf\'')
command.append('-descriptor')
command.append('\'/mnt/other-files/vrd/' + descriptor + '.vrd\'')
return command
def create_ib_command(host_name, ib_name, conf_ver=''):
command = []
command.append('docker')
command.append('exec')
command.append('-t')
command.append('srv.' + host_name)
command.append('/opt/1C/v8.3/x86_64/1cv8')
command.append('CREATEINFOBASE')
command.append('\'Srvr="srv";Ref="' + ib_name + '";DBMS=PostgreSQL;DBSrvr="db";DB="' + ib_name + '";DBUID="postgres";LicDstr="Y";Locale="ru_RU";CrSQLDB="Y";SchJobDn="N";\'')
command.append('/UseTemplate')
command.append('/mnt/' + ib_name + '_' + conf_ver.replace('.', '_') + '.cf')
command.append('/Out "/mnt/create_ib_' + ib_name + '.out"')
command.append('/DumpResult "/mnt/create_ib_' + ib_name + '.result"')
2020-04-05 16:06:36 +03:00
return command