mirror of
https://github.com/ggogel/seafile-containerized.git
synced 2024-11-16 17:05:32 +00:00
Merge pull request #188 from haiwen/seafile-logs-nginx-conf
mv seafile/logs to /shared/seafile/logs and persistence nginx's confi…
This commit is contained in:
commit
2f74f30ee0
|
@ -1,4 +1,4 @@
|
||||||
server_version=7.0.9
|
server_version=7.0.11
|
||||||
|
|
||||||
base_image=seafileltd/base-mc:18.04
|
base_image=seafileltd/base-mc:18.04
|
||||||
base_image_squashed=seafileltd/base-mc:18.04-squashed
|
base_image_squashed=seafileltd/base-mc:18.04-squashed
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
FROM seafileltd/pro-base-mc:18.04
|
FROM seafileltd/pro-base-mc:18.04
|
||||||
WORKDIR /opt/seafile
|
WORKDIR /opt/seafile
|
||||||
|
|
||||||
ENV SEAFILE_VERSION=7.0.9 SEAFILE_SERVER=seafile-pro-server
|
ENV SEAFILE_VERSION=7.0.11 SEAFILE_SERVER=seafile-pro-server
|
||||||
|
|
||||||
RUN mkdir -p /etc/my_init.d
|
RUN mkdir -p /etc/my_init.d
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ def init_letsencrypt():
|
||||||
'https': False,
|
'https': False,
|
||||||
'domain': domain,
|
'domain': domain,
|
||||||
}
|
}
|
||||||
|
if not os.path.isfile('/shared/nginx/conf/seafile.nginx.conf'):
|
||||||
render_template('/templates/seafile.nginx.conf.template',
|
render_template('/templates/seafile.nginx.conf.template',
|
||||||
'/etc/nginx/sites-enabled/seafile.nginx.conf', context)
|
'/etc/nginx/sites-enabled/seafile.nginx.conf', context)
|
||||||
|
|
||||||
|
@ -84,12 +85,16 @@ def generate_local_nginx_conf():
|
||||||
'https': is_https(),
|
'https': is_https(),
|
||||||
'domain': domain,
|
'domain': domain,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if not os.path.isfile('/shared/nginx/conf/seafile.nginx.conf'):
|
||||||
render_template(
|
render_template(
|
||||||
'/templates/seafile.nginx.conf.template',
|
'/templates/seafile.nginx.conf.template',
|
||||||
'/etc/nginx/sites-enabled/seafile.nginx.conf',
|
'/etc/nginx/sites-enabled/seafile.nginx.conf',
|
||||||
context
|
context
|
||||||
)
|
)
|
||||||
|
nginx_etc_file = '/etc/nginx/sites-enabled/seafile.nginx.conf'
|
||||||
|
nginx_shared_file = '/shared/nginx/conf/seafile.nginx.conf'
|
||||||
|
call('mv {0} {1} && ln -sf {1} {0}'.format(nginx_etc_file, nginx_shared_file))
|
||||||
|
|
||||||
def is_https():
|
def is_https():
|
||||||
return get_conf('SEAFILE_SERVER_LETSENCRYPT', 'false').lower() == 'true'
|
return get_conf('SEAFILE_SERVER_LETSENCRYPT', 'false').lower() == 'true'
|
||||||
|
@ -189,7 +194,7 @@ COMPRESS_CACHE_BACKEND = 'locmem'""")
|
||||||
# container, we need to move them to the shared volume
|
# container, we need to move them to the shared volume
|
||||||
#
|
#
|
||||||
# e.g move "/opt/seafile/seafile-data" to "/shared/seafile/seafile-data"
|
# e.g move "/opt/seafile/seafile-data" to "/shared/seafile/seafile-data"
|
||||||
files_to_copy = ['conf', 'ccnet', 'seafile-data', 'seahub-data', 'pro-data']
|
files_to_copy = ['conf', 'ccnet', 'seafile-data', 'seahub-data', 'pro-data', 'logs']
|
||||||
for fn in files_to_copy:
|
for fn in files_to_copy:
|
||||||
src = join(topdir, fn)
|
src = join(topdir, fn)
|
||||||
dst = join(shared_seafiledir, fn)
|
dst = join(shared_seafiledir, fn)
|
||||||
|
|
|
@ -18,12 +18,17 @@ if [[ $TIME_ZONE != "" ]]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -e /shared/logs/seafile ]]; then
|
||||||
|
mv /shared/logs/seafile /shared/seafile/logs
|
||||||
|
fi
|
||||||
|
|
||||||
dirs=(
|
dirs=(
|
||||||
conf
|
conf
|
||||||
ccnet
|
ccnet
|
||||||
seafile-data
|
seafile-data
|
||||||
seahub-data
|
seahub-data
|
||||||
pro-data
|
pro-data
|
||||||
|
logs
|
||||||
seafile-license.txt
|
seafile-license.txt
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -34,12 +39,14 @@ for d in ${dirs[*]}; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ ! -e /shared/logs/seafile ]]; then
|
|
||||||
mkdir -p /shared/logs/seafile
|
|
||||||
fi
|
|
||||||
rm -rf /opt/seafile/logs && ln -sf /shared/logs/seafile/ /opt/seafile/logs
|
|
||||||
|
|
||||||
if [[ ! -e /shared/logs/var-log ]]; then
|
if [[ ! -e /shared/logs/var-log ]]; then
|
||||||
mv /var/log /shared/logs/var-log
|
mv /var/log /shared/logs/var-log
|
||||||
fi
|
fi
|
||||||
rm -rf /var/log && ln -sf /shared/logs/var-log /var/log
|
rm -rf /var/log && ln -sf /shared/logs/var-log /var/log
|
||||||
|
|
||||||
|
mkdir -p /shared/nginx/conf/
|
||||||
|
|
||||||
|
if [[ -e /shared/nginx/conf/seafile.nginx.conf ]]; then
|
||||||
|
rm -rf /etc/nginx/sites-enabled/seafile.nginx.conf && \
|
||||||
|
ln -sf /shared/nginx/conf/seafile.nginx.conf /etc/nginx/sites-enabled
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue