Skip to content

Commit 66f2eea

Browse files
committed
use helm chart repo, added CONTRIBUTING, documentation fixes, minor flow fixes
1 parent 7e831a1 commit 66f2eea

File tree

6 files changed

+86
-14
lines changed

6 files changed

+86
-14
lines changed

.travis.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ elif [ "${1}" == "deploy" ]; then
2222
[ "$?" != "0" ] && exit 1
2323
if ! [ -z "${SLACK_TAG_NOTIFICATION_CHANNEL}" ] && ! [ -z "${SLACK_TAG_NOTIFICATION_WEBHOOK_URL}" ]; then
2424
! curl -X POST \
25-
--data-urlencode "payload={\"channel\": \"#${SLACK_TAG_NOTIFICATION_CHANNEL}\", \"username\": \"CKAN Cloud\", \"text\": \"Released ckan-cloud-helm ${TAG}\nhttps://github.com/ViderumGlobal/ckan-cloud-helm/releases/tag/${TAG}\", \"icon_emoji\": \":female-technologist:\"}" \
25+
--data-urlencode "payload={\"channel\": \"#${SLACK_TAG_NOTIFICATION_CHANNEL}\", \"username\": \"CKAN Cloud\", \"text\": \"Released ckan-cloud-helm ${TRAVIS_TAG}\nhttps://github.com/ViderumGlobal/ckan-cloud-helm/releases/tag/${TRAVIS_TAG}\", \"icon_emoji\": \":female-technologist:\"}" \
2626
${SLACK_TAG_NOTIFICATION_WEBHOOK_URL} && exit 1
2727
fi
2828
exit 0

CONTRIBUTING.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Contributing to CKAN Cloud Helm
2+
3+
* Welcome to CKAN Cloud!
4+
* Contributions of any kind are welcome.
5+
* Please [Search for issues across the different CKAN Cloud repositories](https://github.com/search?q=repo%3AViderumGlobal%2Fckan-cloud-docker+repo%3AViderumGlobal%2Fckan-cloud-helm+repo%3AViderumGlobal%2Fckan-cloud-cluster&type=Issues)
6+
7+
## Suggested development flow
8+
9+
You want to make some changes to the helm charts? Great!
10+
11+
Please follow this suggested flow:
12+
13+
* Changes to Docker images should be done in ViderumGlobal/ckan-cloud-docker repo
14+
* Test changes to the Docker images using the `ckan-cloud-docker` docker compose environment
15+
* Use the [Minikube environment](QUICKSTART_MINIKUBE.md) to test and modify the Helm templates
16+
* Finally, test on a [Production environment](QUICKSTART_PRODUCTION.md)
17+
18+
## CI/CD
19+
20+
* Helm chart repository is hosted on the same GitHub branch as the helm charts
21+
* The repository is updated when a new release is published on GitHub

QUICKSTART_DEVELOPMENT.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ kubectl --context minikube --namespace "${CKAN_NAMESPACE}" \
111111
```
112112
export CCA_HELM_FUNCTIONS_KUBECTL_ARGS="--context minikube"
113113
export CCA_HELM_FUNCTIONS_HELM_ARGS="--kube-context minikube"
114+
export CKAN_CHART=ckan
114115
source cca_helm_functions.sh
115116
```
116117

QUICKSTART_PRODUCTION.md

Lines changed: 60 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,32 @@ helm version &&\
1919
helm list
2020
```
2121

22+
## Register the CKAN Cloud Helm charts repository
23+
24+
```
25+
helm repo add ckan-cloud https://raw.githubusercontent.com/ViderumGlobal/ckan-cloud-helm/master/charts_repository
26+
```
27+
2228
## Get the code
2329

2430
Clone from Git or download the source zip.
2531

26-
All the following commands and scripts should run from current working directory: `datagov-ckan-multi/multi-tenant-helm`
32+
All the following commands and scripts should run from the `ckan-cloud-helm` project directory
2733

28-
## Define utility functions
34+
## Define shortcut functions
2935

3036
```
37+
export KUBECONFIG=/etc/ckan-cloud/.kube-config
38+
export CCA_HELM_FUNCTIONS_KUBECTL_ARGS=""
39+
export CCA_HELM_FUNCTIONS_HELM_ARGS=""
40+
export CKAN_CHART=ckan-cloud/ckan
3141
source cca_helm_functions.sh
3242
```
3343

3444
## Create CKAN namespace and RBAC
3545

3646
```
37-
export CKAN_NAMESPACE="test1"
47+
export CKAN_NAMESPACE="test2"
3848
3949
cca_kubectl create ns "${CKAN_NAMESPACE}" &&\
4050
cca_kubectl create serviceaccount "ckan-${CKAN_NAMESPACE}-operator" &&\
@@ -48,7 +58,7 @@ cca_kubectl create rolebinding "ckan-${CKAN_NAMESPACE}-operator-rolebinding" \
4858

4959
## Deploy
5060

51-
Save the values yaml file:
61+
Copy the values yaml file and (optionally) modify:
5262

5363
```
5464
sudo cp aws-values.yaml /etc/ckan-cloud/${CKAN_NAMESPACE}_values.yaml
@@ -86,31 +96,71 @@ cca_helm_upgrade --install --values /etc/ckan-cloud/${CKAN_NAMESPACE}_values.yam
8696

8797
## Login to CKAN
8898

89-
Create an admin user
99+
ensure all pods are running
90100

91101
```
92-
cca_kubectl exec -it $(cca_pod_name ckan) -- bash -c "ckan-paster --plugin=ckan sysadmin -c /etc/ckan/production.ini \
93-
add admin password=12345678 email=admin@localhost"
102+
cca_kubectl get pods
94103
```
95104

96105
Start port forward to the nginx pod
97106

98107
```
99-
cca_kubectl port-forward $(cca_pod_name nginx) 8080:80
108+
cca_kubectl port-forward $(cca_pod_name nginx) 8080
109+
```
110+
111+
Add a hosts entry mapping domain `nginx` to `127.0.0.1`:
112+
113+
```
114+
127.0.0.1 nginx
115+
```
116+
117+
Ensure CKAN availability:
118+
119+
```
120+
curl http://nginx:8080/api/3
121+
```
122+
123+
Create an admin user
124+
125+
```
126+
cca_kubectl exec -it $(cca_pod_name ckan) -- bash -c "ckan-paster --plugin=ckan sysadmin -c /etc/ckan/production.ini \
127+
add admin password=12345678 email=admin@localhost"
100128
```
101129

102-
Login to CKAN at http://localhost:8080 with username `admin` password `12345678`
130+
Login to CKAN at http://nginx:8080 with username `admin` password `12345678`
103131

104132
## Expose via load balancer
105133

106134
see [multi-tenant-cluster](../multi-tenant-cluster/README.md) for creating and configuring the load balancer
107135

108136
Configure the load balancer to direct traffic to `http://nginx.<CKAN_NAMESPACE>:8080`
109137

110-
Duplicate and modify `aws-values.yaml` and set the siteUrl to the relevant external domain.
138+
Modify the instance values and set the siteUrl to the relevant external domain.
111139

112140
Deploy with the modified values:
113141

114142
```
115143
cca_helm_upgrade --install --values /etc/ckan-cloud/${CKAN_NAMESPACE}_values.yaml
116144
```
145+
146+
## Testing different CKAN helm chart releases
147+
148+
The default deploy uses the latest released CKAN Helm chart.
149+
150+
The `cca_helm_upgrade` function uses the `CKAN_CHART` environment variable to determine the chart to install.
151+
152+
Check available chart versions from the repository:
153+
154+
```
155+
helm repo update
156+
helm search ckan-cloud/ckan
157+
```
158+
159+
* Use a specific chart release: `export CKAN_CHART="ckan-cloud/ckan --version v0.0.2"`
160+
* Use the chart from local directory `ckan` for testing local chart changes: `export CKAN_CHART=ckan`
161+
162+
Deploy normally:
163+
164+
```
165+
cca_helm_upgrade --install --values /etc/ckan-cloud/${CKAN_NAMESPACE}_values.yaml
166+
```

aws-values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ registerSubdomain: "cloud-demo5"
1616
# These values are used to populate the CKAN Helm chart values
1717

1818
# Main URL to the CKAN web-app and API
19-
siteUrl: http://localhost:8080
19+
siteUrl: http://nginx:8080
2020

2121
# CKAN pods
2222
replicas: 2

cca_helm_functions.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ cca_helm() {
1515

1616
cca_helm_upgrade() {
1717
[ -z "${CKAN_NAMESPACE}" ] && echo missing CKAN_NAMESPACE env var && return 1
18-
cca_helm upgrade --namespace $CKAN_NAMESPACE "ckan-cloud-${CKAN_NAMESPACE}" ckan --dry-run "$@" &&\
19-
cca_helm upgrade --namespace $CKAN_NAMESPACE "ckan-cloud-${CKAN_NAMESPACE}" ckan "$@"
18+
cca_helm upgrade --namespace $CKAN_NAMESPACE "ckan-cloud-${CKAN_NAMESPACE}" $CKAN_CHART --dry-run "$@" &&\
19+
cca_helm upgrade --namespace $CKAN_NAMESPACE "ckan-cloud-${CKAN_NAMESPACE}" $CKAN_CHART "$@"
2020
}

0 commit comments

Comments
 (0)