Commit 8da91c7c authored by Philippe Pepiot's avatar Philippe Pepiot
Browse files

[deploy] add support for bfss for uploads

We use bfss to store upload of (mostly) pdf files.
Add a persistent volume claim and mount it in /var/lib/cubicweb/instances/fresh/bfss
To make this work with previous instance we have to rename the instance to "fresh".
parent e4e6a0b0719a
ARG CW_INSTANCE_NAME=fresh
FROM hub.extranet.logilab.fr/cubicweb/cubicweb:3.26-onbuild
USER root
RUN pip install -r /src/docker/requirements.txt
RUN cp /src/docker/pyramid.ini.j2 /pyramid.ini.j2
RUN install -d -o cubicweb -g cubicweb /etc/cubicweb.d/fresh/bfss /var/lib/cubicweb/instances/fresh
USER cubicweb
ENV WITH_TRUSTEDAUTH=false
......@@ -11,10 +11,10 @@ can edit the code locally and run it in the container.
Some useful commands::
* ``cubicweb-ctl db-create -a instance`` will create and initialize the
* ``cubicweb-ctl db-create -a fresh`` will create and initialize the
database
* ``cubicweb-ctl pyramid -D -l info instance`` will start the instance on
* ``cubicweb-ctl pyramid -D -l info fresh`` will start the instance on
http://localhost:8080
Deploying on kubernetes
......@@ -28,7 +28,7 @@ To create the initial database from an existing empty database::
--env CW_DB_PASSWORD=pass \
--env CW_DB_NAME=fresh \
--image=hub.extranet.logilab.fr/logilab/fresh --command -- \
cubicweb-ctl db-create --automatic --create-db=n instance
cubicweb-ctl db-create --automatic --create-db=n fresh
kubectl delete deployment fresh-dbcreate
......@@ -51,6 +51,11 @@ Create a file named cwclientlibrc and run::
kubectl create secret generic fresh-cwclientlibrc --from-file=./cwclientlibrc
Create a persistent volume for bfss data::
kubectl apply -f deploy/pvc.yaml
Then deploy fresh with::
kubectl apply -f deployment.yaml
kubectl apply -f deploy/deployment.yaml
......@@ -7,7 +7,7 @@ data:
default.conf: |
server {
listen 8000 default_server;
root /etc/cubicweb.d/instance/data;
root /etc/cubicweb.d/fresh/data;
rewrite ^/fresh/(.*) /$1 last;
location / {
......@@ -23,7 +23,7 @@ data:
}
location /data {
alias /etc/cubicweb.d/instance/data;
alias /etc/cubicweb.d/fresh/data;
expires 30d;
}
}
......@@ -53,6 +53,9 @@ spec:
- name: cwclientlibrc
secret:
secretName: fresh-cwclientlibrc
- name: bfss
persistentVolumeClaim:
claimName: fresh
containers:
- name: fresh
image: hub.extranet.logilab.fr/logilab/fresh
......@@ -62,12 +65,14 @@ spec:
name: fresh-env
volumeMounts:
- name: static
mountPath: /etc/cubicweb.d/instance/data
mountPath: /etc/cubicweb.d/fresh/data
- name: cwclientlibrc
mountPath: /secret
- name: bfss
mountPath: /etc/cubicweb.d/fresh/bfss
command: [
"/bin/sh", "-c",
"install -m 400 /secret/cwclientlibrc /etc/cubicweb.d/instance/cwclientlibrc && exec /entrypoint.sh start"
"install -m 400 /secret/cwclientlibrc /etc/cubicweb.d/fresh/cwclientlibrc && exec /entrypoint.sh start"
]
resources:
requests:
......@@ -83,7 +88,7 @@ spec:
mountPath: /etc/nginx/conf.d/default.conf
subPath: default.conf
- name: static
mountPath: /etc/cubicweb.d/instance/data
mountPath: /etc/cubicweb.d/fresh/data
resources:
requests:
cpu: 100m
......@@ -122,6 +127,9 @@ spec:
- name: cwclientlibrc
secret:
secretName: fresh-cwclientlibrc
- name: bfss
persistentVolumeClaim:
claimName: fresh
containers:
- name: fresh
image: hub.extranet.logilab.fr/logilab/fresh
......@@ -132,9 +140,11 @@ spec:
volumeMounts:
- name: cwclientlibrc
mountPath: /secret
- name: bfss
mountPath: /etc/cubicweb.d/fresh/bfss
command: [
"/bin/sh", "-c",
"install -m 400 /secret/cwclientlibrc /etc/cubicweb.d/instance/cwclientlibrc && exec cubicweb-ctl sheduler instance"
"install -m 400 /secret/cwclientlibrc /etc/cubicweb.d/fresh/cwclientlibrc && exec cubicweb-ctl scheduler fresh"
]
resources:
requests:
......
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: fresh
name: fresh
namespace: intranet
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment