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.
Use /haiwen/seafile-server-latest/seahub/setenv.sh
to load the environment variables
needed by manage.py
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:
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
kind: Secret
apiVersion: v1
metadata:
name: seafile-key
namespace: default
labels:
app: seafile
data:
mykey.peer: |-
# Your data here
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: seafile
namespace: default
labels:
app: seafile
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 300Gi
storageClassName: default
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
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
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