Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
templates: use hostPath for DB deployment
Browse files Browse the repository at this point in the history
* Makes DB persistence path configurable. A reana-cluster.yaml file
  should be created and configured correctly.

* Prevents DB to be destroyed when running locally or deploying on
  a single node cluster. This is NOT save when deploying on a multi
  node deplyoment since DB pod could be redeployed for different
  reasons to other VMs, loosing all database content. This is ok
  since multi node setups will be in production and they will use
  DBoD (closes reanahub/reana-workflow-controller#52).
  • Loading branch information
Diego Rodriguez committed Jul 25, 2018
1 parent ea95cf3 commit 77555c1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions reana_cluster/backends/kubernetes/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ def generate_configuration(cls, cluster_spec, production=False):
backend_conf_parameters['CEPHFS_MONITORS'] = \
cluster_spec['cluster'].get('cephfs_monitors')

if cluster_spec['cluster'].get('db_persistence_path'):
backend_conf_parameters['DB_PERSISTENCE_PATH'] = \
cluster_spec['cluster'].get('db_persistence_path')

# Would it be better to combine templates or populated
# templates in Python code for improved extensibility?
# Just drop a .yaml template and add necessary to config.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ spec:
value: reana
volumeMounts:
- name: data
mountPath: /var/lib/pgsql/data
mountPath: /var/lib/postgresql/data
volumes:
- name: data
emptyDir: {}
hostPath:
path: {{DB_PERSISTENCE_PATH}}
1 change: 1 addition & 0 deletions reana_cluster/configurations/reana-cluster-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ cluster:
version: "v1.9.4"
db_config: &db_base_config
- REANA_SQLALCHEMY_DATABASE_URI: "postgresql+psycopg2://reana:reana@db:5432/reana"
db_persistence_path: "/reanadb"

components:
reana-workflow-controller:
Expand Down
2 changes: 1 addition & 1 deletion reana_cluster/configurations/reana-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cluster:
version: "v1.9.4"
db_config: &db_base_config
- REANA_SQLALCHEMY_DATABASE_URI: "postgresql+psycopg2://reana:reana@db:5432/reana"
root_path: "/tmp/reana"
root_path: "/reana"

components:
reana-workflow-controller:
Expand Down

0 comments on commit 77555c1

Please sign in to comment.