mirror of
https://github.com/amkartashov/gf-k8s.git
synced 2026-01-11 09:59:43 +00:00
seafile: moved container build to another repo + now using image from hub.docker.com
This commit is contained in:
parent
2f9f7339ec
commit
a428b42912
4 changed files with 9 additions and 187 deletions
|
|
@ -20,11 +20,7 @@ Note: passwords in these files are used only at deployment stage and changed man
|
|||
* confluence.yaml
|
||||
* jira.yaml
|
||||
* gitea.yaml
|
||||
* Seafile
|
||||
|
||||
SeafileCT/ - common docker image ccnet, seafile and seahub
|
||||
|
||||
seafile.yaml - set of resources for seafile.
|
||||
* seafile.yaml - set of resources for seafile.
|
||||
|
||||
Pod consists of 4 containers: ccnet, seaf, seahub and seahubstatic (on nginx image).
|
||||
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
FROM debian:9
|
||||
|
||||
VOLUME /seafile
|
||||
# Seafile Web UI
|
||||
EXPOSE 8000
|
||||
# Seafile File server
|
||||
EXPOSE 8082
|
||||
|
||||
ENV SEAFILE_VERSION 6.2.3
|
||||
ENV SERVER_NAME seafile
|
||||
ENV SERVER_HOSTNAME seafile.com
|
||||
ENV MYSQL_HOST mysql
|
||||
ENV MYSQL_USER root
|
||||
ENV MYSQL_PASSWORD secret
|
||||
ENV CCNETDB ccnet
|
||||
ENV SEAFILEDB seafile
|
||||
ENV SEAHUBDB seahub
|
||||
ENV ADMINEMAIL admin@seafile.com
|
||||
ENV ADMINASSWORD secret
|
||||
|
||||
ENTRYPOINT ["/bin/entrypoint"]
|
||||
|
||||
RUN apt-get update -y && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
python2.7 libpython2.7 python-setuptools \
|
||||
python-imaging python-ldap python-urllib3 ffmpeg python-pip python-mysqldb python-memcache wget
|
||||
|
||||
RUN pip install pillow moviepy
|
||||
|
||||
RUN mkdir -p /seafile
|
||||
|
||||
ADD entrypoint.sh /bin/entrypoint
|
||||
RUN chmod +x /bin/entrypoint
|
||||
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -o errexit
|
||||
|
||||
command=$1
|
||||
|
||||
upgrade () {
|
||||
|
||||
echo Upgrade ...
|
||||
|
||||
if [ ! -L /seafile/seafile-server-latest ]; then
|
||||
echo No /seafile/seafile-server-latest!
|
||||
exit 1
|
||||
fi
|
||||
|
||||
curdir=$(readlink /seafile/seafile-server-latest) # like seafile-server-5.1.1
|
||||
curver=${curdir##*-} # 5.1.1
|
||||
curverm=${curver%.*} # 5.1
|
||||
|
||||
# download and unpack
|
||||
cd /seafile
|
||||
wget -c https://download.seadrive.org/seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz
|
||||
tar xf seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz
|
||||
|
||||
cd seafile-server-${SEAFILE_VERSION}
|
||||
|
||||
# run major (4.x -> 5.x) and minor (5.x -> 5.y) upgrade scripts
|
||||
upgrade_sh=$(ls upgrade/upgrade_${curverm}* || true)
|
||||
while [ -n "$upgrade_sh" ]; do
|
||||
echo Upgrade from $curverm ...
|
||||
yes | $upgrade_sh
|
||||
# get next
|
||||
curverm=${upgrade_sh##*_}
|
||||
curverm=${curverm%.sh}
|
||||
upgrade_sh=$(ls upgrade/upgrade_${curverm}* || true)
|
||||
done
|
||||
|
||||
# run maintenance (5.x.y -> 5.x.z) upgrade script
|
||||
echo Maintenance upgrade ...
|
||||
yes | upgrade/minor-upgrade.sh
|
||||
|
||||
# seahub (gunicorn) to run in foreground
|
||||
sed -i 's/daemon = True/daemon = False/' /seafile/seafile-server-latest/runtime/seahub.conf
|
||||
|
||||
}
|
||||
|
||||
|
||||
init () {
|
||||
|
||||
echo Init ...
|
||||
if [ -L /seafile/seafile-server-latest ]; then
|
||||
echo /seafile/seafile-server-latest exists. Init was done already?
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# download and unpack
|
||||
cd /seafile
|
||||
wget -c https://download.seadrive.org/seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz
|
||||
tar xf seafile-server_${SEAFILE_VERSION}_x86-64.tar.gz
|
||||
|
||||
# this directory is used to exchange upload files between seahub and seaf-server
|
||||
mkdir -p /seafile/tmp
|
||||
|
||||
# generate configuration files
|
||||
env -i PYTHON=python2.7 python /seafile/seafile-server-${SEAFILE_VERSION}/setup-seafile-mysql.py auto \
|
||||
--server-name ${SERVER_NAME} --server-ip ${SERVER_HOSTNAME} \
|
||||
--seafile-dir /seafile/data \
|
||||
--use-existing-db 1 \
|
||||
--mysql-host ${MYSQL_HOST} \
|
||||
--mysql-user ${MYSQL_USER} --mysql-user-passwd ${MYSQL_PASSWORD} \
|
||||
--ccnet-db ${CCNETDB} --seafile-db ${SEAFILEDB} --seahub-db ${SEAHUBDB}
|
||||
|
||||
# put correct urls
|
||||
sed -i 's|SERVICE_URL.*|SERVICE_URL = https://'$SERVER_HOSTNAME'|' /seafile/conf/ccnet.conf
|
||||
echo "FILE_SERVER_ROOT = 'https://$SERVER_HOSTNAME/seafhttp'" >> /seafile/conf/seahub_settings.py
|
||||
|
||||
# seahub (gunicorn) to run in foreground
|
||||
sed -i 's/daemon = True/daemon = False/' /seafile/seafile-server-latest/runtime/seahub.conf
|
||||
# seahub to log to stdout
|
||||
echo 'LOGGING = {}' >> /seafile/conf/seahub_settings.py
|
||||
|
||||
# put admin account creds into a file
|
||||
echo "{ \"email\": \"$ADMINEMAIL\", \"password\": \"$ADMINPASSWORD\" }" > /seafile/conf/admin.txt
|
||||
|
||||
}
|
||||
|
||||
|
||||
ccnet () {
|
||||
|
||||
echo Starting ccnet ...
|
||||
exe=/seafile/seafile-server-latest/seafile/bin/ccnet-server
|
||||
SEAFILE_LD_LIBRARY_PATH=/seafile/seafile-server-latest/seafile/lib/:/seafile/seafile-server-latest/seafile/lib64
|
||||
exec env -i LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH \
|
||||
$exe -F /seafile/conf -c /seafile/ccnet --logfile -
|
||||
|
||||
}
|
||||
|
||||
|
||||
seaf () {
|
||||
|
||||
echo Starting seaf ...
|
||||
exe=/seafile/seafile-server-latest/seafile/bin/seaf-server
|
||||
SEAFILE_LD_LIBRARY_PATH=/seafile/seafile-server-latest/seafile/lib/:/seafile/seafile-server-latest/seafile/lib64
|
||||
exec env -i LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH \
|
||||
$exe -F /seafile/conf -c /seafile/ccnet --foreground --seafdir /seafile/data --log -
|
||||
|
||||
}
|
||||
|
||||
|
||||
seahub () {
|
||||
|
||||
echo Starting seahub ...
|
||||
gunicorn_conf=/seafile/seafile-server-latest/runtime/seahub.conf
|
||||
gunicorn_exe=/seafile/seafile-server-latest/seahub/thirdpart/gunicorn
|
||||
PYTHONPATH=/seafile/seafile-server-latest/seafile/lib/python2.7/site-packages:/seafile/seafile-server-latest/seafile/lib64/python2.7/site-packages:/seafile/seafile-server-latest/seahub:/seafile/seafile-server-latest/seahub/thirdpart
|
||||
if [ -f /seafile/conf/admin.txt ]; then
|
||||
# let's wait for ccnet and seaf
|
||||
sleep 10
|
||||
env -i PYTHONPATH=$PYTHONPATH CCNET_CONF_DIR=/seafile/ccnet SEAFILE_CENTRAL_CONF_DIR=/seafile/conf \
|
||||
python /seafile/seafile-server-latest/check_init_admin.py
|
||||
fi
|
||||
exec env -i PYTHONPATH=$PYTHONPATH TMPDIR=/seafile/tmp \
|
||||
SEAFILE_CONF_DIR=/seafile/data CCNET_CONF_DIR=/seafile/ccnet SEAFILE_CENTRAL_CONF_DIR=/seafile/conf \
|
||||
python $gunicorn_exe seahub.wsgi:application -c "${gunicorn_conf}" -b "0.0.0.0:8000" --preload
|
||||
}
|
||||
|
||||
|
||||
case $command in
|
||||
init) init ;;
|
||||
upgrade) upgrade ;;
|
||||
ccnet) ccnet ;;
|
||||
seaf) seaf ;;
|
||||
seahub) seahub ;;
|
||||
*)
|
||||
echo "specify command argument, one of: init ccnet seaf seahub"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
15
seafile.yaml
15
seafile.yaml
|
|
@ -60,14 +60,14 @@ spec:
|
|||
type:
|
||||
containers:
|
||||
- name: ccnet
|
||||
image: seafile
|
||||
image: gorilych/seafile:6.3.2
|
||||
imagePullPolicy: IfNotPresent
|
||||
command: [ "/bin/entrypoint", "ccnet"]
|
||||
volumeMounts:
|
||||
- mountPath: /seafile
|
||||
name: seafile
|
||||
- name: seaf
|
||||
image: seafile
|
||||
image: gorilych/seafile:6.3.2
|
||||
imagePullPolicy: IfNotPresent
|
||||
command: [ "/bin/entrypoint", "seaf"]
|
||||
ports:
|
||||
|
|
@ -77,7 +77,7 @@ spec:
|
|||
- mountPath: /seafile
|
||||
name: seafile
|
||||
- name: seahub
|
||||
image: seafile
|
||||
image: gorilych/seafile:6.3.2
|
||||
imagePullPolicy: IfNotPresent
|
||||
command: [ "/bin/entrypoint", "seahub"]
|
||||
ports:
|
||||
|
|
@ -98,21 +98,22 @@ spec:
|
|||
name: seahubavatars
|
||||
initContainers:
|
||||
- name: init
|
||||
image: seafile
|
||||
image: gorilych/seafile:6.3.2
|
||||
imagePullPolicy: IfNotPresent
|
||||
command: [ "/bin/entrypoint", "init"]
|
||||
volumeMounts:
|
||||
- mountPath: /seafile
|
||||
name: seafile
|
||||
env:
|
||||
- name: SEAFILE_VERSION
|
||||
value: "6.2.3"
|
||||
# commented to use default value from image
|
||||
#- name: SEAFILE_VERSION
|
||||
# value: "6.2.3"
|
||||
- name: SERVER_NAME
|
||||
value: gullfaxi
|
||||
- name: SERVER_HOSTNAME
|
||||
value: seafile.gorilych.ru
|
||||
- name: MYSQL_HOST
|
||||
value: mysql.default.svc.cluster.local
|
||||
value: mysql
|
||||
- name: MYSQL_USER
|
||||
value: seafile
|
||||
- name: MYSQL_PASSWORD
|
||||
|
|
|
|||
Loading…
Reference in a new issue