mirror of
https://github.com/1C-Company/docker_fresh.git
synced 2024-12-04 10:24:48 +02:00
fix
This commit is contained in:
parent
6f8baa837a
commit
e09f63a6b4
@ -55,6 +55,7 @@ services:
|
||||
- ./artifact/srv/log:/var/log/1c
|
||||
- ./mnt:/mnt
|
||||
- /tmp/.aksusb:/tmp/.aksusb
|
||||
- ../licenses_1c:/var/1C/licenses
|
||||
- ../images/core/conf/logcfg.xml:/opt/1C/v8.3/x86_64/conf/logcfg.xml
|
||||
|
||||
ports:
|
||||
|
@ -1,5 +1,6 @@
|
||||
FROM fresh/centos
|
||||
|
||||
ADD ./distr/license-tools /tmp/license-tools
|
||||
ADD ./distr/*.rpm /tmp/core/
|
||||
|
||||
RUN yum -y localinstall /tmp/core/*.rpm; \
|
||||
@ -10,9 +11,11 @@ RUN yum -y localinstall /tmp/core/*.rpm; \
|
||||
yum -y install x11vnc metacity net-tools gdb perl tar git jq; \
|
||||
yum -y install https://centos7.iuscommunity.org/ius-release.rpm; \
|
||||
yum -y --setopt=tsflags=nodocs install python36u python36u-devel python36u-pip; \
|
||||
yum -y install java-1.8.0-openjdk; \
|
||||
cert-sync /etc/pki/tls/certs/ca-bundle.crt; \
|
||||
oscript /usr/share/oscript/lib/opm/src/cmd/opm.os install deployka; \
|
||||
chmod +x /usr/bin/deployka
|
||||
chmod +x /usr/bin/deployka; \
|
||||
chmod +x /tmp/license-tools/1ce-installer-cli; /tmp/license-tools/1ce-installer-cli install
|
||||
|
||||
ADD ./conf/conf.cfg /opt/1C/v8.3/x86_64/conf/
|
||||
ADD ./conf/logcfg.xml /opt/1C/v8.3/x86_64/conf/
|
||||
|
@ -12,3 +12,5 @@ client_file_name=1C_Enterprise83-client-$DISTR_VER1-$DISTR_VER2.x86_64.rpm
|
||||
tar -xvf client_$DISTR_FILE_VERSION.rpm64.tar.gz $client_file_name -C /main_dir/distr
|
||||
tar -xvf rpm64_$DISTR_FILE_VERSION.tar.gz $common_file_name $server_file_name $ws_file_name -C /main_dir/distr
|
||||
|
||||
tar -xvf rpm64_$DISTR_FILE_VERSION.tar.gz "license-tools" -C /main_dir/distr/
|
||||
|
||||
|
2
licenses_1c/.gitignore
vendored
Normal file
2
licenses_1c/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
@ -35,9 +35,17 @@ def delete_core_distr_files():
|
||||
|
||||
return command
|
||||
|
||||
def delete_license_tools_files():
|
||||
command = helper.new_docker_command('images/core/distr/')
|
||||
command.append('alpine')
|
||||
command.append('sh -c "rm -rf /out_files/license-tools"')
|
||||
|
||||
return command
|
||||
|
||||
def add_all_after_commands():
|
||||
commands = []
|
||||
commands.append(delete_core_distr_files())
|
||||
commands.append(delete_license_tools_files())
|
||||
|
||||
return commands
|
||||
|
||||
|
@ -27,9 +27,9 @@ def new_docker_command(extra_path=None):
|
||||
def web_publish_command(host_name, conf_name, internal, descriptor, base_name=''):
|
||||
|
||||
if internal:
|
||||
prefix = 'a'
|
||||
else:
|
||||
prefix = 'int'
|
||||
else:
|
||||
prefix = 'a'
|
||||
|
||||
command = []
|
||||
command.append('docker')
|
||||
@ -40,7 +40,7 @@ def web_publish_command(host_name, conf_name, internal, descriptor, base_name=''
|
||||
command.append('-wsdir')
|
||||
command.append(prefix + '/' + conf_name)
|
||||
command.append('-dir')
|
||||
command.append('/var/www/' + conf_name)
|
||||
command.append('/var/www/' + prefix + '/' + conf_name)
|
||||
command.append('-connstr')
|
||||
|
||||
if base_name != '':
|
||||
@ -69,3 +69,68 @@ def create_ib_command(host_name, ib_name, conf_ver=''):
|
||||
command.append('/DumpResult "/mnt/create_ib_' + ib_name + '.result"')
|
||||
|
||||
return command
|
||||
|
||||
def install_control_ext_command(host_name, ib_name):
|
||||
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('DESIGNER')
|
||||
command.append('/S')
|
||||
command.append('"srv\\{}"'.format(ib_name))
|
||||
command.append('/LoadCfg')
|
||||
command.append('"/mnt/other-file/cfe/api_1cfresh.cfe"')
|
||||
command.append('-Extension')
|
||||
command.append('"api_1cfresh"')
|
||||
command.append('/UpdateDBCfg')
|
||||
command.append('/Out "/mnt/install_control_ext_' + ib_name + '.out"')
|
||||
command.append('/DumpResult "/mnt/install_control_ext_' + ib_name + '.result"')
|
||||
|
||||
return command
|
||||
|
||||
def install_ext_command(host_name, ib_name):
|
||||
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('DESIGNER')
|
||||
command.append('/S')
|
||||
command.append('"srv\\{}"'.format(ib_name))
|
||||
command.append('/LoadCfg')
|
||||
command.append('"/mnt/{}"'.format(ib_name))
|
||||
command.append('-Extension')
|
||||
command.append('"fresh"')
|
||||
command.append('/UpdateDBCfg')
|
||||
command.append('/Out "/mnt/install_ext_' + ib_name + '.out"')
|
||||
command.append('/DumpResult "/mnt/install_ext_' + ib_name + '.result"')
|
||||
|
||||
return command
|
||||
|
||||
def disable_safe_mode(host_name, ib_name):
|
||||
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('ENTERPRICE')
|
||||
command.append('/S')
|
||||
command.append('"srv\\{}"'.format(ib_name))
|
||||
command.append('/Execute')
|
||||
command.append('"/mnt/other-files/cfe/disable.epf"')
|
||||
command.append('/Out "/mnt/disable_safe_mode_' + ib_name + '.out"')
|
||||
command.append('/DumpResult "/mnt/disable_safe_mode_' + ib_name + '.result"')
|
||||
|
||||
return command
|
||||
|
||||
def get_host_name(argv):
|
||||
|
||||
if '-h' not in argv:
|
||||
print('parameter -р not specified')
|
||||
exit(1)
|
||||
host_index = argv.index('-h')
|
||||
return argv[host_index + 1]
|
@ -24,14 +24,6 @@
|
||||
"ТипКонфигурации": "Прикладная",
|
||||
"Администратор": "Admin",
|
||||
"ПользовательУправления": "RemoteAccess"
|
||||
},
|
||||
{
|
||||
"Сервер": "web/int/smtl2",
|
||||
"ИмяВКластере": "smtl2",
|
||||
"КодКонфигурации": "smtl",
|
||||
"ТипКонфигурации": "Прикладная",
|
||||
"Администратор": "Admin",
|
||||
"ПользовательУправления": "RemoteAccess"
|
||||
}
|
||||
]
|
||||
}
|
57
start.py
57
start.py
@ -4,8 +4,9 @@ import modules.helper as helper
|
||||
import sys
|
||||
from datetime import datetime
|
||||
|
||||
host_name = 'test.1cfresh.dev'
|
||||
host_name = '.1cfresh.dev'
|
||||
sup_password = '123Qwer'
|
||||
global_debug = False
|
||||
configurations = {}
|
||||
|
||||
|
||||
@ -16,24 +17,25 @@ work_dir = '/out_files/workdir/'
|
||||
work_dir_other = work_dir + 'mnt/other-files/'
|
||||
local_work_dir = helper.replace_sep(helper.this_path + '/workdir/')
|
||||
|
||||
def call(command, remote=True, debug=True):
|
||||
def call(command, remote=True, debug=False):
|
||||
commands = []
|
||||
|
||||
if remote:
|
||||
commands.append(docker_run_str)
|
||||
commands.append(command)
|
||||
if debug:
|
||||
if debug or global_debug:
|
||||
print(' '.join(commands))
|
||||
subprocess.call(' '.join(commands), shell=True)
|
||||
|
||||
def get_configurations_data():
|
||||
# r=root, d=directories, files = files
|
||||
for r, d, files in os.walk(helper.replace_sep(local_work_dir + '/mnt')):
|
||||
for r, d, files in os.walk(helper.replace_sep(local_work_dir + 'mnt')):
|
||||
for file in files:
|
||||
conf_key = file.split('.')[0].split('_')[0]
|
||||
configurations[conf_key] = '.'.join(file.split('.')[0].split('_')).replace(conf_key + '.', '')
|
||||
|
||||
def prepare_new_ib(key):
|
||||
|
||||
print('creating', key)
|
||||
start_time = datetime.now()
|
||||
call(' '.join(helper.create_ib_command(host_name, key, configurations[key])), remote=False)
|
||||
@ -41,15 +43,54 @@ def prepare_new_ib(key):
|
||||
print('duration:', datetime.now() - start_time)
|
||||
|
||||
print('install control extension')
|
||||
#TODO
|
||||
start_time = datetime.now()
|
||||
call(' '.join(helper.install_control_ext_command(host_name, key)), remote=False)
|
||||
print('control extension is install')
|
||||
print('duration:', datetime.now() - start_time)
|
||||
|
||||
ext_name = helper.replace_sep(local_work_dir + 'mnt/' + key + '.cfe')
|
||||
if os.path.isfile(ext_name):
|
||||
print('install extension')
|
||||
start_time = datetime.now()
|
||||
call(' '.join(helper.install_ext_command(host_name, key)), remote=False)
|
||||
print('extension is install')
|
||||
print('duration:', datetime.now() - start_time)
|
||||
|
||||
new_server = True
|
||||
print('disable safe mode for extensions')
|
||||
start_time = datetime.now()
|
||||
call(' '.join(helper.disable_safe_mode(host_name, key)), remote=False)
|
||||
print('safe mode is disable')
|
||||
print('duration:', datetime.now() - start_time)
|
||||
|
||||
print('initialization')
|
||||
start_time = datetime.now()
|
||||
call('docker exec web.' + host_name + ' curl -X POST http://localhost/int/' + key + '/hs/api.1cfresh/init', remote=False)
|
||||
print('initialization is finish')
|
||||
print('duration:', datetime.now() - start_time)
|
||||
|
||||
def set_full_host_name(is_new):
|
||||
global host_name
|
||||
if is_new:
|
||||
part_host_name = helper.get_host_name(sys.argv)
|
||||
f = open(local_work_dir + 'hostname', 'x+')
|
||||
f.write(part_host_name)
|
||||
f.close()
|
||||
else:
|
||||
f = open(local_work_dir + 'hostname')
|
||||
part_host_name = f.read() + host_name
|
||||
f.close()
|
||||
|
||||
host_name = part_host_name + host_name
|
||||
print('host name is', host_name)
|
||||
|
||||
call(docker_compose_str + 'down', False)
|
||||
new_server = False
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
new_server = sys.argv[1] == 'new'
|
||||
|
||||
call(docker_compose_str + 'down', False)
|
||||
if '-debug' in sys.argv:
|
||||
global_debug = True
|
||||
|
||||
if new_server:
|
||||
call('rm -rf /out_files/workdir')
|
||||
@ -57,6 +98,8 @@ if new_server:
|
||||
call('sh -c "cp /out_files/distr/*.cf ' + work_dir + 'mnt/"')
|
||||
get_configurations_data()
|
||||
|
||||
set_full_host_name(new_server)
|
||||
|
||||
# renew docker-compose.yml
|
||||
call('cp /out_files/docker-compose.yml /out_files/workdir/docker-compose.yml')
|
||||
call('sh -c "sed -i \'s/HOSTNAMEREPLACE/' + host_name + '/\' ' + work_dir + '/*.yml"')
|
||||
|
Loading…
Reference in New Issue
Block a user