Install ALTERNATIVE CKAN Environment on K8S¶
Overview¶
The Alternative platform is a comprehensive cloud-based solution designed to facilitate data sharing, analysis, and collaboration in scientific research. This guide provides detailed instructions for installing and configuring the platform's core components.
Platform Architecture¶
The Alternative platform consists of several key building blocks:
- CKAN (Comprehensive Knowledge Archive Network): For data management and sharing
- Keycloak: For identity and access management
- JupyterHub: For interactive data analysis and development
- Kubernetes: For orchestrating and managing containerized applications
- PostgreSQL: As the primary database for CKAN and Keycloak
- Cloud Storage (S3): For storing large datasets
- AI/ML APIs: For integrating machine learning models
These components interact to provide a seamless experience for researchers, data scientists, and administrators.
Requirements¶
You will need a cluster with:
- Ingress controller configured
- Cert-Manager configured
- Domain name resolving to ingress-controller's service external IP
- GCP bucket and credentials json file for that project
- Kubeconfig file for interaction with the cluster (set environment variable
KUBECONFIG
to point to it)
You also need to clone platform-deployment repository and all the CKAN extension ones.
Create Certificate¶
- Navigate to the
platform-deployment
repository - Update
dnsNames
andissuerRef
params indeployment/manifest/certificate.yaml
- Create the certificate resource
Create Ingress¶
- Update
tls
andrules
params indeployment/manifest/ingress.yaml
- Create the ingress resource
Install Keycloak¶
- Install helm chart
- Get admin credentials (username is
user
) - Create alternative realm from json file
deployment/charts/keycloak/realms/alternative-realm.json
- Update URL parameters in
ckan-backend
,ckan-frontend
andjupyterhub
clients (add jupyterhub URL) - Generate new client credentials secret for
ckan-backend
andjupyterhub
clients - Configure realm email settings
- Enable
Forgot password
functionality
Restore Keycloak Backup¶
-
Install the helm chart and wait for the pods to be ready and running
-
Copy the
.dump
file to the Keycloak DB pod -
Remove Keycloak pod
-
Get PostgreSQL password
-
Enter Keycloak DB pod
-
Set environment variables (replace
pass
with the PostgreSQL password) -
Recreate the DB from the backup file
-
Restoring from the backup recreates the main user of Keycloak so the password in the secret will no longer be correct, to fix that:
- Start PostgreSQL console with
psql
- Get the user ID of user with username
user
- Run these queries (replace
usr_id
) -
Exit DB pod, delete it with the below command and wait for it to be recreated, ready and running again
-
Recreate Keycloak pod
-
Enter Keycloak with username
user
and password from this commandkubectl get secret keycloak -o jsonpath='{.data.admin-password}' | base64 --decode
and check if everything got recovered
Build ALTERNATIVE CKAN Docker Image¶
- Update configs in
ckan-alternative-theme/keycloak_auth-config
andckan-alternative-theme/cloudstorage-config
- Copy the CKAN extensions into
ckan-alternative-theme
- Build the image
- Upload the image to the registry
Install CKAN¶
- Add chart repo
- Update
deployment/manifests/ckan_values.yaml
- Install helm chart
- Wait for the ckan pod to become ready
Create Users¶
Add users in Keycloak, sysadmin users should be in the group admins
Change Settings¶
From sysadmin settings, change the logo with ../ckanext-alternative_theme/ckanext/alternative_theme/public/images/fulllogo_transparent.png
and update the rest of the options as you wish
Restore CKAN PostgreSQL Backup¶
-
Copy the
.dump
file to the DB pod -
Get PostgreSQL password
-
Enter DB pod
-
Set environment variables (replace
pass
with the PostgreSQL password) -
Restore the DB from the backup file
-
Exit the DB pod with
exit
and enter the CKAN pod (replaceckan-pod
with the actual pod name) -
Rebuild the search index for datasets to be listed correctly
Install Jupyterhub¶
Create Certificate¶
- Update
dnsNames
andissuerRef
params injupyterhub/manifests/certificate.yaml
- Create the certificate resource
Create Ingress¶
- Update
tls
andrules
params injupyterhub/manifests/ingress.yaml
- Create the ingress resource
Create Shared Jupyter Volume¶
- Create NFS required pvc resource
- Create NFS resources
- Create Persistent volume required for shared PVC
- Create shared PVC
Build Custom Image¶
- Build a new docker image
- Push the new image
Install Helm Chart¶
- Update the parameters in
jupyterhub/config.yaml
- Install helm chart
Backup Jobs¶
- Update the configurations in
deployment/manifests/backup_job.yaml
anddeployment/manifests/backup_credentials.yaml
- Apply the files