mirror of
https://github.com/1C-Company/docker_fresh.git
synced 2024-12-04 10:24:48 +02:00
move conf files
This commit is contained in:
parent
28308b42fc
commit
a6a3b8bdeb
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,6 @@
|
||||
__pycache__/
|
||||
.DS_Store
|
||||
**/.DS_Store
|
||||
artifact/
|
||||
artifacts/
|
||||
workdir
|
||||
workdir/
|
16
.vscode/launch.json
vendored
Normal file
16
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Python: Текущий файл",
|
||||
"type": "python",
|
||||
"args": ["-h", "test-ikoz"],
|
||||
"request": "launch",
|
||||
"program": "${file}",
|
||||
"console": "integratedTerminal"
|
||||
}
|
||||
]
|
||||
}
|
@ -7,7 +7,7 @@ services:
|
||||
hostname: db.HOSTNAMEREPLACE
|
||||
container_name: db.HOSTNAMEREPLACE
|
||||
volumes:
|
||||
- ./artifact/db/data:/var/lib/1c/pgdata
|
||||
- ./artifacts/db/data:/var/lib/1c/pgdata
|
||||
- ./mnt:/mnt
|
||||
|
||||
nginx:
|
||||
@ -27,16 +27,16 @@ services:
|
||||
- 80:80
|
||||
- 443:443
|
||||
volumes:
|
||||
- ./nginx_conf/1c_app.conf:/etc/nginx/1c_app.conf
|
||||
- ./nginx_conf/1c_common.conf:/etc/nginx/1c_common.conf
|
||||
- ./nginx_conf/1c_error.conf:/etc/nginx/1c_error.conf
|
||||
- ./nginx_conf/1c_error_openid.conf:/etc/nginx/1c_error_openid.conf
|
||||
- ./nginx_conf/1c_error_site.conf:/etc/nginx/1c_error_site.conf
|
||||
- ./nginx_conf/1c_keepalive.conf:/etc/nginx/1c_keepalive.conf
|
||||
- ./nginx_conf/1c_upstream.conf:/etc/nginx/1c_upstream.conf
|
||||
- ./nginx_conf/nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./nginx_conf/conf.d/local-ssl.conf:/etc/nginx/conf.d/local-ssl.conf
|
||||
- ./nginx_conf/conf.d/local.conf://etc/nginx/conf.d/local.conf
|
||||
- ./artifacts/nginx/conf/1c_app.conf:/etc/nginx/1c_app.conf
|
||||
- ./artifacts/nginx/conf/1c_common.conf:/etc/nginx/1c_common.conf
|
||||
- ./artifacts/nginx/conf/1c_error.conf:/etc/nginx/1c_error.conf
|
||||
- ./artifacts/nginx/conf/1c_error_openid.conf:/etc/nginx/1c_error_openid.conf
|
||||
- ./artifacts/nginx/conf/1c_error_site.conf:/etc/nginx/1c_error_site.conf
|
||||
- ./artifacts/nginx/conf/1c_keepalive.conf:/etc/nginx/1c_keepalive.conf
|
||||
- ./artifacts/nginx/conf/1c_upstream.conf:/etc/nginx/1c_upstream.conf
|
||||
- ./artifacts/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./artifacts/nginx/conf/conf.d/local-ssl.conf:/etc/nginx/conf.d/local-ssl.conf
|
||||
- ./artifacts/nginx/conf/conf.d/local.conf://etc/nginx/conf.d/local.conf
|
||||
- ./mnt:/mnt
|
||||
- ../certs/fullchain.pem:/etc/pki-custom/fullchain.crt
|
||||
- ../certs/privkey.pem:/etc/pki-custom/privkey.key
|
||||
@ -51,12 +51,12 @@ services:
|
||||
container_name: srv.HOSTNAMEREPLACE
|
||||
command: srv+cli
|
||||
volumes:
|
||||
- ./artifact/srv/data:/var/lib/1c/data
|
||||
- ./artifact/srv/log:/var/log/1c
|
||||
- ./artifacts/srv/data:/var/lib/1c/data
|
||||
- ./artifacts/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
|
||||
- ../conf/core:/opt/1C/v8.3/x86_64/conf
|
||||
|
||||
ports:
|
||||
- 1540-1541:1540-1541
|
||||
@ -73,7 +73,7 @@ services:
|
||||
container_name: ras.HOSTNAMEREPLACE
|
||||
command: /opt/1C/v8.3/x86_64/ras cluster --port=1545 srv:1540
|
||||
volumes:
|
||||
- ./artifact/ras/log:/var/log/1c
|
||||
- ./artifacts/ras/log:/var/log/1c
|
||||
- ./mnt:/mnt
|
||||
- ../images/core/conf/logcfg.xml:/opt/1C/v8.3/x86_64/conf/logcfg.xml
|
||||
ports:
|
||||
@ -85,7 +85,9 @@ services:
|
||||
container_name: web.HOSTNAMEREPLACE
|
||||
command: web
|
||||
volumes:
|
||||
- ./artifact/web/log:/var/log/1c
|
||||
- ./artifacts/web/log:/var/log/1c
|
||||
- ./artifacts/web/www/a/:/var/www/a/
|
||||
- ./artifacts/web/www/int/:/var/www/int/
|
||||
- ./mnt:/mnt
|
||||
depends_on:
|
||||
- srv
|
||||
@ -95,12 +97,12 @@ services:
|
||||
hostname: site.HOSTNAMEREPLACE
|
||||
container_name: site.HOSTNAMEREPLACE
|
||||
volumes:
|
||||
- ./artifact/site/searchIndex:/var/www/content/searchIndex
|
||||
- ./artifact/site/site_files:/var/www/content/site_files
|
||||
- ./artifacts/site/searchIndex:/var/www/content/searchIndex
|
||||
- ./artifacts/site/site_files:/var/www/content/site_files
|
||||
- ./mnt:/mnt
|
||||
- ../distr/postgresql.jar:/usr/local/tomcat/lib/postgresql.jdbc4.jar
|
||||
- ../images/site/conf/context.xml:/usr/local/tomcat/conf/context.xml
|
||||
- ../images/site/conf/server.xml:/usr/local/tomcat/conf/server.xml
|
||||
- ../conf/site/context.xml:/usr/local/tomcat/conf/context.xml
|
||||
- ../conf/site/server.xml:/usr/local/tomcat/conf/server.xml
|
||||
- ../images/site/distr/site/media:/var/www/content/media/
|
||||
depends_on:
|
||||
- db
|
||||
@ -110,11 +112,11 @@ services:
|
||||
hostname: forum.HOSTNAMEREPLACE
|
||||
container_name: forum.HOSTNAMEREPLACE
|
||||
volumes:
|
||||
- ./artifact/forum:/var/www/forum/mess_files
|
||||
- ./artifacts/forum:/var/www/forum/mess_files
|
||||
- ./mnt:/mnt
|
||||
- ../distr/postgresql.jar:/usr/local/tomcat/lib/postgresql.jdbc4.jar
|
||||
- ../images/forum/conf/context.xml:/usr/local/tomcat/conf/context.xml
|
||||
- ../images/forum/conf/server.xml:/usr/local/tomcat/conf/server.xml
|
||||
- ../conf/forum/context.xml:/usr/local/tomcat/conf/context.xml
|
||||
- ../conf/forum/server.xml:/usr/local/tomcat/conf/server.xml
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
|
@ -17,9 +17,6 @@ RUN yum -y localinstall /tmp/core/*.rpm; \
|
||||
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/
|
||||
|
||||
ENV COREDATA /var/lib/1c/data
|
||||
ENV CORELOGS /var/log/1c
|
||||
ENV AGENTBASEDIR /var/lib/1c/agent_data
|
||||
|
@ -1,16 +0,0 @@
|
||||
FROM nginx:stable-alpine
|
||||
|
||||
ENV HOSTNAME host.1cfresh.dev
|
||||
|
||||
ENV SITE_HOST host.1cfresh.dev
|
||||
ENV BACKEND_HOST host.1cfresh.dev
|
||||
ENV GATE_HOST host.1cfresh.dev
|
||||
|
||||
ENV WORKER_PROCESSES 2
|
||||
|
||||
COPY ./entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
EXPOSE 80 443
|
||||
|
||||
ENTRYPOINT ["/bin/sh", "-c", "/entrypoint.sh"]
|
@ -1,17 +0,0 @@
|
||||
set -e
|
||||
|
||||
sh -c "sed -i 's/hosthosthost/'"$HOSTNAME"'/' /etc/nginx/*.conf"
|
||||
sh -c "sed -i 's/hosthosthost/'"$HOSTNAME"'/' /etc/nginx/conf.d/*.conf"
|
||||
|
||||
sh -c "sed -i 's/worker_processes_ENV/'"$WORKER_PROCESSES"'/' /etc/nginx/nginx.conf"
|
||||
|
||||
sh -c "sed -i 's/sitesitesite/'"$SITE_HOST"'/' /etc/nginx/*.conf"
|
||||
sh -c "sed -i 's/sitesitesite/'"$SITE_HOST"'/' /etc/nginx/conf.d/*.conf"
|
||||
|
||||
sh -c "sed -i 's/webwebweb/'"$BACKEND_HOST"'/' /etc/nginx/*.conf"
|
||||
|
||||
sh -c "sed -i 's/gategategate/'"$GATE_HOST"'/' /etc/nginx/*.conf"
|
||||
|
||||
exec sh -c "/usr/sbin/nginx -g 'daemon off;'"
|
||||
|
||||
exec "$@"
|
@ -40,17 +40,17 @@ 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/' + prefix + '/' + conf_name)
|
||||
command.append('/var/www/{}/{}'.format(prefix, conf_name))
|
||||
command.append('-connstr')
|
||||
|
||||
if base_name != '':
|
||||
command.append('\'Srvr=srv;Ref=' + base_name + ';\'')
|
||||
command.append('\'Srvr=srv;Ref={};\''.format(base_name))
|
||||
else:
|
||||
command.append('\'Srvr=srv;Ref=' + conf_name + ';\'')
|
||||
command.append('\'Srvr=srv;Ref={};\''.format(conf_name))
|
||||
command.append('-confpath')
|
||||
command.append('\'/etc/httpd/conf/httpd.conf\'')
|
||||
command.append('-descriptor')
|
||||
command.append('\'/mnt/other-files/vrd/' + descriptor + '.vrd\'')
|
||||
command.append('\'/mnt/other-files/vrd/{}.vrd\''.format(descriptor))
|
||||
|
||||
return command
|
||||
|
||||
@ -62,7 +62,8 @@ def create_ib_command(host_name, ib_name, conf_ver=''):
|
||||
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('\'Srvr="srv";Ref="{0}";DBMS=PostgreSQL;DBSrvr="db";DB="{0}";DBUID="postgres";LicDstr="Y";Locale="ru_RU";CrSQLDB="Y";SchJobDn="N";\''.format(
|
||||
ib_name))
|
||||
command.append('/UseTemplate')
|
||||
command.append('/mnt/' + ib_name + '_' + conf_ver.replace('.', '_') + '.cf')
|
||||
command.append('/Out "/mnt/create_ib_' + ib_name + '.out"')
|
||||
@ -81,12 +82,12 @@ def install_control_ext_command(host_name, ib_name):
|
||||
command.append('/S')
|
||||
command.append('"srv\\{}"'.format(ib_name))
|
||||
command.append('/LoadCfg')
|
||||
command.append('"/mnt/other-file/cfe/api_1cfresh.cfe"')
|
||||
command.append('"/mnt/other-files/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"')
|
||||
command.append('/Out "/mnt/install_control_ext_{}.out"'.format(ib_name))
|
||||
command.append('/DumpResult "/mnt/install_control_ext_{}.result"'.format(ib_name))
|
||||
|
||||
return command
|
||||
|
||||
@ -105,8 +106,8 @@ def install_ext_command(host_name, 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"')
|
||||
command.append('/Out "/mnt/install_ext_{}.out"'.format(ib_name))
|
||||
command.append('/DumpResult "/mnt/install_ext_{}.result"'.format(ib_name))
|
||||
|
||||
return command
|
||||
|
||||
@ -122,8 +123,8 @@ def disable_safe_mode(host_name, ib_name):
|
||||
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"')
|
||||
command.append('/Out "/mnt/disable_safe_mode_{}.out"'.format(ib_name))
|
||||
command.append('/DumpResult "/mnt/disable_safe_mode_{}.result"'.format(ib_name))
|
||||
|
||||
return command
|
||||
|
||||
|
176
start.py
176
start.py
@ -6,26 +6,33 @@ from datetime import datetime
|
||||
|
||||
host_name = '.1cfresh.dev'
|
||||
sup_password = '123Qwer'
|
||||
new_server = False
|
||||
global_debug = False
|
||||
configurations = {}
|
||||
|
||||
|
||||
docker_run_str = 'docker run --rm -v ' + helper.this_path + ':/out_files alpine'
|
||||
docker_run_str = 'docker run --rm -v {}:/out_files alpine'.format(helper.this_path)
|
||||
docker_compose_str = 'docker-compose -f workdir/docker-compose.yml '
|
||||
|
||||
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=False):
|
||||
def call(command, remote=True, debug=False, action='', measure_duration=False):
|
||||
commands = []
|
||||
|
||||
if remote:
|
||||
commands.append(docker_run_str)
|
||||
if remote: commands.append(docker_run_str)
|
||||
commands.append(command)
|
||||
if debug or global_debug:
|
||||
print(' '.join(commands))
|
||||
|
||||
if action != '': print(action)
|
||||
if debug or global_debug: print(' '.join(commands))
|
||||
|
||||
start_time = datetime.now()
|
||||
subprocess.call(' '.join(commands), shell=True)
|
||||
end_time = datetime.now() - start_time
|
||||
|
||||
if action != '':
|
||||
print(action, 'is fihish.', 'Duration:{}'.format(end_time) if measure_duration else '')
|
||||
|
||||
def get_configurations_data():
|
||||
# r=root, d=directories, files = files
|
||||
@ -34,39 +41,83 @@ def get_configurations_data():
|
||||
conf_key = file.split('.')[0].split('_')[0]
|
||||
configurations[conf_key] = '.'.join(file.split('.')[0].split('_')).replace(conf_key + '.', '')
|
||||
|
||||
def prepare_new_ib(key):
|
||||
def prepare_new_ib(key, post_data=''):
|
||||
|
||||
print('creating', key)
|
||||
start_time = datetime.now()
|
||||
call(' '.join(helper.create_ib_command(host_name, key, configurations[key])), remote=False)
|
||||
print(key, 'creation', 'is fihish')
|
||||
print('duration:', datetime.now() - start_time)
|
||||
call(' '.join(helper.create_ib_command(host_name, key, configurations[key])),
|
||||
remote=False,
|
||||
action='creating ' + key,
|
||||
measure_duration=True)
|
||||
|
||||
print('install control extension')
|
||||
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)
|
||||
call(' '.join(helper.install_control_ext_command(host_name, key)),
|
||||
remote=False,
|
||||
action='installing control extension',
|
||||
measure_duration=True)
|
||||
|
||||
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)
|
||||
call(' '.join(helper.install_ext_command(host_name, key)),
|
||||
remote=False,
|
||||
action='installing extension',
|
||||
measure_duration=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)
|
||||
call(' '.join(helper.disable_safe_mode(host_name, key)),
|
||||
remote=False,
|
||||
action='disabling safe mode for extensions',
|
||||
measure_duration=True)
|
||||
|
||||
str_post = '-d @{}'.format(post_data) if post_data != '' else ''
|
||||
call('docker exec web.{} curl {} -X POST http://localhost/int/{}/hs/api.1cfresh/init'.format(host_name, str_post, key),
|
||||
remote=False,
|
||||
action='initialization',
|
||||
measure_duration=True)
|
||||
|
||||
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 renew_nginx_files():
|
||||
conf_catalog = work_dir + 'artifacts/nginx/conf/'
|
||||
call('mkdir -p {}'.format(conf_catalog))
|
||||
call('sh -c \'cp -r /out_files/conf/nginx/* {}'.format(conf_catalog) + '\'')
|
||||
|
||||
call('sh -c \'sed -i \'s/hosthosthost/{}/g\' {}*.conf\''.format(host_name, conf_catalog))
|
||||
call('sh -c \'sed -i \'s/sitesitesite/site.{}/g\' {}*.conf\''.format(host_name, conf_catalog))
|
||||
call('sh -c \'sed -i \'s/webwebweb/web.{}/g\' {}*.conf\''.format(host_name, conf_catalog))
|
||||
call('sh -c \'sed -i \'s/gategategate/gate.{}/g\' {}*.conf\''.format(host_name, conf_catalog))
|
||||
|
||||
call('sh -c \'sed -i \'s/sitesitesite/site.{}/g\' {}conf.d/*.conf\''.format(host_name, conf_catalog))
|
||||
call('sh -c \'sed -i \'s/hosthosthost/{}/g\' {}conf.d/*.conf\''.format(host_name, conf_catalog))
|
||||
|
||||
def renew_workdir():
|
||||
call('rm -rf /out_files/workdir')
|
||||
call('mkdir -p {}mnt'.format(work_dir))
|
||||
call('mkdir -p {}artifacts'.format(work_dir))
|
||||
call('sh -c "cp /out_files/distr/*.cf {}mnt/"'.format(work_dir))
|
||||
|
||||
def renew_docker_compose():
|
||||
call('cp /out_files/docker-compose.yml /out_files/workdir/docker-compose.yml')
|
||||
call('sh -c "sed -i \'s/HOSTNAMEREPLACE/{}/\' {}/*.yml"'.format(host_name, work_dir))
|
||||
|
||||
def renew_other_files():
|
||||
call('rm -rf ' + work_dir_other)
|
||||
call('cp -r /out_files/other_files/ ' + work_dir_other)
|
||||
call('sh -c "sed -i \'s/HOSTNAMEREPLACE/{}/\' {}vrd/*.vrd"'.format(host_name, work_dir_other))
|
||||
call('sh -c "sed -i \'s/HOSTNAMEREPLACE/{}/\' {}cfe/params.json"'.format(host_name, work_dir_other))
|
||||
|
||||
def publish_sevises():
|
||||
# publish a services
|
||||
call(' '.join(helper.web_publish_command(host_name, 'adm', False, 'zoneless', 'sm')), remote=False)
|
||||
call(' '.join(helper.web_publish_command(host_name, 'smtl', False, 'withzone')), remote=False)
|
||||
call(' '.join(helper.web_publish_command(host_name, 'sa', False, 'zoneless')), remote=False)
|
||||
call(' '.join(helper.web_publish_command(host_name, 'openid', False, 'openid', 'sm')), remote=False)
|
||||
|
||||
# publish int services
|
||||
call(' '.join(helper.web_publish_command(host_name, 'sm', True, 'zoneless')), remote=False)
|
||||
call(' '.join(helper.web_publish_command(host_name, 'smtl', True, 'zoneless')), remote=False)
|
||||
call(' '.join(helper.web_publish_command(host_name, 'sa', True, 'zoneless')), remote=False)
|
||||
call(' '.join(helper.web_publish_command(host_name, 'am', True, 'zoneless')), remote=False)
|
||||
call(' '.join(helper.web_publish_command(host_name, 'sc', True, 'sessioncontrol', 'sm;Usr=SessionControl;Pwd=' + sup_password)), remote=False)
|
||||
call(' '.join(helper.web_publish_command(host_name, 'extreg', True, 'extreg', 'sm;Usr=ExtReg;Pwd=' + sup_password)), remote=False)
|
||||
|
||||
# restart Apache
|
||||
call('docker exec web.' + host_name + ' chown -R usr1cv8:grp1cv8 /var/www', remote=False)
|
||||
call('docker exec web.' + host_name + ' httpd -k graceful', remote=False)
|
||||
|
||||
def set_full_host_name(is_new):
|
||||
global host_name
|
||||
@ -83,60 +134,33 @@ def set_full_host_name(is_new):
|
||||
host_name = part_host_name + host_name
|
||||
print('host name is', host_name)
|
||||
|
||||
|
||||
# Destroy exist conteiners and network
|
||||
call(docker_compose_str + 'down', False)
|
||||
new_server = False
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
new_server = sys.argv[1] == 'new'
|
||||
|
||||
if '-debug' in sys.argv:
|
||||
global_debug = True
|
||||
|
||||
new_server = '-new' in sys.argv
|
||||
global_debug = '-debug' in sys.argv
|
||||
new_server = True
|
||||
if new_server:
|
||||
call('rm -rf /out_files/workdir')
|
||||
call('mkdir -p ' + work_dir + 'mnt')
|
||||
call('sh -c "cp /out_files/distr/*.cf ' + work_dir + 'mnt/"')
|
||||
renew_workdir()
|
||||
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"')
|
||||
|
||||
# renew all nginx conf files
|
||||
call('rm -rf ' + work_dir + 'nginx_conf/')
|
||||
call('cp -r /out_files/images/nginx/conf/ ' + work_dir + 'nginx_conf/')
|
||||
|
||||
# renew other-files
|
||||
call('rm -rf ' + work_dir_other)
|
||||
call('cp -r /out_files/other_files/ ' + work_dir_other)
|
||||
call('sh -c "sed -i \'s/HOSTNAMEREPLACE/' + host_name + '/\' ' + work_dir_other + 'vrd/*.vrd"')
|
||||
call('sh -c "sed -i \'s/HOSTNAMEREPLACE/' + host_name + '/\' ' + work_dir_other + 'cfe/params.json"')
|
||||
|
||||
# start db srv ras web gate
|
||||
if new_server:
|
||||
renew_nginx_files()
|
||||
renew_docker_compose()
|
||||
renew_other_files()
|
||||
|
||||
# start db srv ras web gate conteiners
|
||||
call(docker_compose_str + 'up -d db srv ras web gate', remote=False)
|
||||
|
||||
# publish a services
|
||||
call(' '.join(helper.web_publish_command(host_name, 'adm', False, 'zoneless', 'sm')), remote=False)
|
||||
call(' '.join(helper.web_publish_command(host_name, 'smtl', False, 'withzone')), remote=False)
|
||||
call(' '.join(helper.web_publish_command(host_name, 'sa', False, 'zoneless')), remote=False)
|
||||
call(' '.join(helper.web_publish_command(host_name, 'openid', False, 'openid', 'sm')), remote=False)
|
||||
|
||||
# publish int services
|
||||
call(' '.join(helper.web_publish_command(host_name, 'sm', True, 'zoneless')), remote=False)
|
||||
call(' '.join(helper.web_publish_command(host_name, 'smtl', True, 'zoneless')), remote=False)
|
||||
call(' '.join(helper.web_publish_command(host_name, 'sa', True, 'zoneless')), remote=False)
|
||||
call(' '.join(helper.web_publish_command(host_name, 'am', True, 'zoneless')), remote=False)
|
||||
call(' '.join(helper.web_publish_command(host_name, 'sc', True, 'sessioncontrol', 'sm;Usr=SessionControl;Pwd=' + sup_password)), remote=False)
|
||||
call(' '.join(helper.web_publish_command(host_name, 'extreg', True, 'extreg', 'sm;Usr=ExtReg;Pwd=' + sup_password)), remote=False)
|
||||
|
||||
# restart Apache
|
||||
call('docker exec web.' + host_name + ' chown -R usr1cv8:grp1cv8 /var/www', remote=False)
|
||||
call('docker exec web.' + host_name + ' httpd -k graceful', remote=False)
|
||||
|
||||
if new_server:
|
||||
publish_sevises()
|
||||
prepare_new_ib('smtl')
|
||||
prepare_new_ib('sa')
|
||||
prepare_new_ib('am')
|
||||
prepare_new_ib('sm', post_data='/mnt/other-files/cfe/params.json')
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user