mirror of
https://github.com/ggogel/seafile-containerized.git
synced 2024-11-16 09:01:38 +00:00
Restructure "shared" folder.
shared/seafile => contains ccnet/seafile-data/conf etc. shared/db => contains mysql data shared/ssl => letsencrypt certs shared/logs/seafile => ccnet/seafile/seahub logs shared/logs/var-log => mounted as /var/log in the container
This commit is contained in:
parent
ad97dd85c1
commit
c64dbb972d
|
@ -9,8 +9,7 @@ install:
|
||||||
- echo "Nothing to install"
|
- echo "Nothing to install"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- cd image && make base && make
|
- cd image && make base && make && cd ..
|
||||||
- cd ..
|
|
||||||
- cp samples/server-sqlite3.conf bootstrap/bootstrap.conf
|
- cp samples/server-sqlite3.conf bootstrap/bootstrap.conf
|
||||||
- ./launcher bootstrap
|
- ./launcher bootstrap
|
||||||
- ./launcher start
|
- ./launcher start
|
||||||
|
|
|
@ -5,7 +5,8 @@ ENV SEAFILE_VERSION=6.0.5
|
||||||
|
|
||||||
RUN mkdir -p /opt/seafile/ && \
|
RUN mkdir -p /opt/seafile/ && \
|
||||||
curl -sSL -o - https://bintray.com/artifact/download/seafile-org/seafile/seafile-server_6.0.5_x86-64.tar.gz \
|
curl -sSL -o - https://bintray.com/artifact/download/seafile-org/seafile/seafile-server_6.0.5_x86-64.tar.gz \
|
||||||
| tar xzf - -C /opt/seafile/
|
| tar xzf - -C /opt/seafile/ && \
|
||||||
|
ln -sf /opt/seafile/seafile-server-${SEAFILE_VERSION} /opt/seafile/seafile-server-latest
|
||||||
|
|
||||||
RUN mkdir -p /etc/my_init.d
|
RUN mkdir -p /etc/my_init.d
|
||||||
ADD create_data_links.sh /etc/my_init.d/create_data_links.sh
|
ADD create_data_links.sh /etc/my_init.d/create_data_links.sh
|
||||||
|
|
|
@ -10,19 +10,20 @@ fi
|
||||||
dirs=(
|
dirs=(
|
||||||
conf
|
conf
|
||||||
ccnet
|
ccnet
|
||||||
logs
|
|
||||||
seafile-data
|
seafile-data
|
||||||
seahub-data
|
seahub-data
|
||||||
seahub.db
|
seahub.db
|
||||||
)
|
)
|
||||||
|
|
||||||
for d in ${dirs[*]}; do
|
for d in ${dirs[*]}; do
|
||||||
src=/shared/$d
|
src=/shared/seafile/$d
|
||||||
if [[ -e $src ]]; then
|
if [[ -e $src ]]; then
|
||||||
ln -sf $src /opt/seafile/
|
ln -sf $src /opt/seafile/
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
ln -sf /opt/seafile/seafile-server-${SEAFILE_VERSION} /opt/seafile/seafile-server-latest
|
if [[ -e /shared/logs/seafile ]]; then
|
||||||
|
ln -sf /shared/logs/seafile/ /opt/seafile/logs
|
||||||
|
fi
|
||||||
|
|
||||||
# TODO: create avatars link
|
# TODO: create avatars link
|
||||||
|
|
18
launcher
18
launcher
|
@ -22,18 +22,20 @@ err_and_quit () {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
set_volumes() {
|
init_shared() {
|
||||||
local mounts seahub_db
|
mkdir -p $sharedir/seafile/
|
||||||
|
mkdir -p $sharedir/logs/{seafile,var-log}
|
||||||
seahub_db=$sharedir/seahub.db
|
touch $sharedir/logs/var-log/syslog
|
||||||
if [[ ! -e $seahub_db ]]; then
|
|
||||||
touch $seahub_db
|
|
||||||
fi
|
|
||||||
|
|
||||||
local bash_history=$sharedir/.bash_history
|
local bash_history=$sharedir/.bash_history
|
||||||
if [[ ! -e $bash_history ]]; then
|
if [[ ! -e $bash_history ]]; then
|
||||||
touch $bash_history
|
touch $bash_history
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set_volumes() {
|
||||||
|
local mounts
|
||||||
|
init_shared
|
||||||
|
|
||||||
mounts=(
|
mounts=(
|
||||||
$sharedir:/shared
|
$sharedir:/shared
|
||||||
|
@ -41,7 +43,7 @@ set_volumes() {
|
||||||
$dockerdir/bootstrap:/bootstrap:ro
|
$dockerdir/bootstrap:/bootstrap:ro
|
||||||
$dockerdir/scripts:/scripts:ro
|
$dockerdir/scripts:/scripts:ro
|
||||||
$dockerdir/scripts/tmp/check_init_admin.py:$installdir/check_init_admin.py:ro
|
$dockerdir/scripts/tmp/check_init_admin.py:$installdir/check_init_admin.py:ro
|
||||||
$bash_history:/root/.bash_history
|
$sharedir/.bash_history:/root/.bash_history
|
||||||
)
|
)
|
||||||
volumes=""
|
volumes=""
|
||||||
local m
|
local m
|
||||||
|
|
|
@ -16,8 +16,11 @@ from utils import call, get_conf, get_install_dir, get_script
|
||||||
|
|
||||||
installdir = get_install_dir()
|
installdir = get_install_dir()
|
||||||
topdir = dirname(installdir)
|
topdir = dirname(installdir)
|
||||||
|
shared_seafiledir = '/shared/seafile'
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
if not exists(shared_seafiledir):
|
||||||
|
os.mkdir(shared_seafiledir)
|
||||||
env = {
|
env = {
|
||||||
'SERVER_NAME': 'seafile',
|
'SERVER_NAME': 'seafile',
|
||||||
'SERVER_IP': get_conf("server.hostname"),
|
'SERVER_IP': get_conf("server.hostname"),
|
||||||
|
@ -25,13 +28,9 @@ def main():
|
||||||
call('{} auto'.format(get_script('setup-seafile.sh')), env=env)
|
call('{} auto'.format(get_script('setup-seafile.sh')), env=env)
|
||||||
for fn in ('conf', 'ccnet', 'seafile-data', 'seahub-data', 'seahub.db'):
|
for fn in ('conf', 'ccnet', 'seafile-data', 'seahub-data', 'seahub.db'):
|
||||||
src = join(topdir, fn)
|
src = join(topdir, fn)
|
||||||
dst = join('/shared', fn)
|
dst = join(shared_seafiledir, fn)
|
||||||
if exists(dst):
|
if not exists(dst) and exists(src):
|
||||||
if isdir(dst):
|
shutil.move(src, shared_seafiledir)
|
||||||
shutil.rmtree(dst)
|
|
||||||
else:
|
|
||||||
os.unlink(dst)
|
|
||||||
shutil.move(src, '/shared')
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue