Skip to content
Snippets Groups Projects
Commit 43c6bfdd authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
FROM krallin/ubuntu-tini:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
python \
python2.7 \
libpython2.7 \
python-setuptools \
python-imaging \
python-ldap \
python-urllib3 \
python-pip \
python-memcache \
ffmpeg \
libmemcached-dev \
build-essential \
python-dev \
zlib1g-dev \
wget
RUN pip2 install --upgrade pip && \
pip2 install --upgrade wheel && \
pip2 install --upgrade pillow \
moviepy \
psycopg2 \
pylibmc \
django-pylibmc
RUN wget https://download.seadrive.org/seafile-server_6.2.2_x86-64.tar.gz -O /seafile-server.tar.gz
RUN mkdir /haiwen
RUN tar xzvf /seafile-server.tar.gz
RUN rm /seafile-server.tar.gz
RUN mv /seafile-server-* /haiwen/seafile-server-latest
ADD docker-entrypoint.sh /
ENTRYPOINT ["/usr/local/bin/tini", "--"]
CMD ["/docker-entrypoint.sh"]
README.md 0 → 100644
Seafile Docker Image for k8s
============================
You first need to manually use the normal seafile docker image to generate the mykey.peer,
config files, the superuser, and migrate the databases.
If you additionally wish to use PostgreSQL, you’ll also need to run
`python manage.py createsuperuser` and `python manage.py syncdb` to migrate that database.
Then you can run this image, and mount the configuration files.
Volume Mounts:
--------------
Empty Directory
* /haiwen/logs
* /haiwen/pids
Persistent Volume
* /haiwen/conf
* /haiwen/ccnet
* /haiwen/seafile-data
* /haiwen/seahub-data
Configuration Files
* /haiwen/ccnet/seafile.ini
* /haiwen/conf/ccnet.conf
* /haiwen/conf/seafdav.conf
* /haiwen/conf/seafile.conf
* /haiwen/conf/seahub_settings.py
* /haiwen/ccnet/mykey.peer
For kubernetes, the config would look like this:
```yaml
kind: ConfigMap
apiVersion: v1
metadata:
name: seafile-configs
namespace: default
labels:
app: seafile
data:
ccnet.conf: |-
# Your data here
seafdav.conf: |-
# Your data here
seafile.conf: |-
# Your data here
seahub_settings.py: |-
# Your data here
seafile.ini: |-
# Your data here
```
```yaml
kind: Secret
apiVersion: v1
metadata:
name: seafile-key
namespace: default
labels:
app: seafile
data:
mykey.peer: |-
# Your data here
```
```yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: seafile
namespace: default
labels:
app: seafile
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 300Gi
storageClassName: default
```
```yaml
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: seafile
namespace: default
labels:
app: seafile
spec:
replicas: 1
selector:
matchLabels:
app: seafile
template:
metadata:
name: seafile
labels:
app: seafile
spec:
volumes:
- name: data
persistentVolumeClaim:
claimName: seafile
- name: config
configMap:
name: seafile-configs
- name: key
secret:
secretName: seafile-key
- name: logs
emptyDir: {}
- name: pids
emptyDir: {}
containers:
- name: seafile
image: k8r.eu/justjanne/seafile:latest
ports:
- name: seahub
containerPort: 8000
protocol: TCP
- name: seafhttp
containerPort: 8082
protocol: TCP
volumeMounts:
- name: logs
mountPath: /haiwen/logs
- name: pids
mountPath: /haiwen/pids
- name: data
mountPath: /haiwen/seafile-data
subPath: data
- name: data
mountPath: /haiwen/conf
subPath: config
- name: data
mountPath: /haiwen/ccnet
subPath: ccnet
- name: config
mountPath: /haiwen/ccnet/seafile.ini
subPath: seafile.ini
- name: data
mountPath: /haiwen/seahub-data
subPath: seahub-data
- name: config
mountPath: /haiwen/conf/ccnet.conf
subPath: ccnet.conf
- name: config
mountPath: /haiwen/conf/seafdav.conf
subPath: seafdav.conf
- name: config
mountPath: /haiwen/conf/seafile.conf
subPath: seafile.conf
- name: config
mountPath: /haiwen/conf/seahub_settings.py
subPath: seahub_settings.py
- name: key
mountPath: /haiwen/ccnet/mykey.peer
subPath: mykey.peer
```
```yaml
kind: Service
apiVersion: v1
metadata:
name: seafile
namespace: default
labels:
app: seafile
spec:
ports:
- name: seahub
protocol: TCP
port: 8000
targetPort: 8000
- name: seafhttp
protocol: TCP
port: 8082
targetPort: 8082
selector:
app: seafile
type: ClusterIP
```
```yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: "true"
ingress.kubernetes.io/proxy-body-size: "0"
name: seafile
namespace: default
spec:
rules:
- host: cloud.example.com
http:
paths:
- backend:
serviceName: seafile
servicePort: 8000
path: /
- backend:
serviceName: seafile
servicePort: 8082
path: /seafhttp
tls:
- hosts:
- cloud.example.com
secretName: seafile-tls
#!/bin/bash
ROOTPATH=/haiwen
INSTALLPATH=$ROOTPATH/seafile-server-latest
export CCNET_CONF_DIR=$ROOTPATH/ccnet
export SEAFILE_CENTRAL_CONF_DIR=$ROOTPATH/conf
export SEAFILE_CONF_DIR=$ROOTPATH/seafile-data
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
$INSTALLPATH/seafile.sh start
$INSTALLPATH/seahub.sh start
tail -f $ROOTPATH/logs/ccnet.log &
tail -f $ROOTPATH/logs/seahub.log &
tail -f $ROOTPATH/logs/seafile.log &
tail -f $ROOTPATH/logs/controller.log &
maxretry=4
retry=0
while [ "$retry" -le "$maxretry" ]; do
ps aux | grep seafile-controller | grep -v grep > /dev/null 2> /dev/null || {
retry=$(expr $retry + 1);
}
sleep 5
done
echo "Seafile not running"
exit 1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment