1
0
mirror of https://github.com/1C-Company/docker_fresh.git synced 2024-12-04 10:24:48 +02:00

fixed errors, fix #12

This commit is contained in:
WizaXxX 2020-04-19 21:56:33 +03:00
parent b5f01c95d2
commit d5d832bf2c
5 changed files with 33 additions and 12 deletions

View File

@ -8,6 +8,7 @@ services:
container_name: db.HOSTNAMEREPLACE
volumes:
- ./artifacts/db/data:/var/lib/1c/pgdata
- ./postgres_socket:/tmp/postgresql/socket
- ./mnt:/mnt
- ../images/site/create_db.psql:/create_db_site.psql
- ../images/forum/create_db.psql:/create_db_forum.psql
@ -55,6 +56,7 @@ services:
container_name: srv.HOSTNAMEREPLACE
command: srv+cli
volumes:
- ./postgres_socket:/tmp/postgresql/socket
- ./artifacts/srv/data:/var/lib/1c/data
- ./artifacts/srv/log:/var/log/1c
- ./mnt:/mnt

View File

@ -11,6 +11,7 @@ RUN localedef -f UTF-8 -i ru_RU ru_RU.UTF-8 \
EXPOSE 5432
ENV PGDATA /var/lib/1c/pgdata
ENV PGSOCKET /tmp/postgresql/socket
VOLUME ${PGDATA}

View File

@ -2,12 +2,15 @@
set -e
chown -R postgres:postgres "$PGDATA"
if [ -z "$(ls -A "$PGDATA")" ]; then
gosu postgres ./initdb
echo "synchronous_commit = off" >> $PGDATA/postgresql.conf
if [ "$1" = './postgres' ]; then
if [ ! -s "$PGDATA/PG_VERSION" ]; then
chown -R postgres:postgres "$PGDATA"
gosu postgres ./initdb
echo "synchronous_commit = off" >> "$PGDATA/postgresql.conf"
echo "unix_socket_directories = '/tmp,$PGSOCKET'" >> "$PGDATA/postgresql.conf"
fi
chown postgres $PGSOCKET
exec gosu postgres ./postgres
fi
command=$@
exec gosu postgres $command
exec "$@"

View File

@ -64,7 +64,7 @@ def create_ib_command(host_name, ib_name, file_name, job_block, action):
command.append('srv.' + host_name)
command.append('/opt/1C/v8.3/x86_64/1cv8')
command.append('CREATEINFOBASE')
command.append('\'Srvr="srv";Ref="{0}";DBMS=PostgreSQL;DBSrvr="db";DB="{0}";DBUID="postgres";LicDstr="Y";Locale="ru_RU";CrSQLDB="Y";SchJobDn="{1}";\''.format(
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))

View File

@ -57,6 +57,19 @@ class ProgressThread(threading.Thread):
print(self.desc, t, end='\r')
time.sleep(0.5)
class DoThread(threading.Thread):
is_good = False
def run(self):
try:
threading.Thread.run(self)
except:
self.is_good = False
pass
else:
self.is_good = True
def print_description(function_to_decorate):
def wrapper(*args, **kwargs):
@ -67,8 +80,8 @@ def print_description(function_to_decorate):
desc = ''
all_desc = function_to_decorate.__doc__ + desc
task = threading.Thread(target=function_to_decorate, args=args, kwargs=kwargs)
task = DoThread(target=function_to_decorate, args=args, kwargs=kwargs)
task.start()
progress_thread = ProgressThread(all_desc)
@ -76,10 +89,12 @@ def print_description(function_to_decorate):
task.join()
progress_thread.stop()
while progress_thread.isAlive():
time.sleep(0.2)
if not task.is_good: exit(1)
print(all_desc, '...', '{}done'.format(colors.GREEN), colors.WHITE)
return wrapper
@ -234,7 +249,7 @@ def renew_nginx_files():
@print_description
def renew_workdir():
"""Renew wordir"""
call('rm -rf /out_files/workdir')
call('mkdir -p {}mnt'.format(work_dir))
call('mkdir -p {}artifacts/web/conf'.format(work_dir))