adds osclass chart (#345)

* adds osclass chart

* lock mariadb chart requirement to 0.5.x series

* explicitly set default `imagePullPolicy` to `IfNotPresent`

* osclass: add alpha and beta storageclass annotation support

* osclass: increase resource name truncation and trim - suffix

* update osclass image to `bitnami/osclass:3.7.0-r2`

* osclass: bump image to `bitnami/osclass:3.7.0-r3`

* osclass: updated to image `bitnami/osclass:3.7.0-r4`

Contains fix for https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-5340
This commit is contained in:
Sameer Naik
2017-01-26 09:12:23 -08:00
committed by Adnan Abdulhussein
parent 439fb530df
commit b8d5095056
13 changed files with 542 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
.git
+17
View File
@@ -0,0 +1,17 @@
name: osclass
version: 0.4.0
description: Osclass is a php script that allows you to quickly create and manage your own free classifieds site.
keywords:
- osclass
- classifieds
- http
- web
- php
home: https://osclass.org/
sources:
- https://github.com/bitnami/bitnami-docker-osclass
maintainers:
- name: Bitnami
email: containers@bitnami.com
engine: gotpl
icon: https://bitnami.com/assets/stacks/osclass/img/osclass-stack-110x117.png
+119
View File
@@ -0,0 +1,119 @@
# Osclass
[Osclass](https://osclass.org/) is a php script that allows you to quickly create and manage your own free classifieds site. Using this script, you can provide free advertising for items for sale, real estate, jobs, cars... Hundreds of free classified advertising sites are using Osclass.
## TL;DR;
```console
$ helm install stable/osclass
```
## Introduction
This chart bootstraps a [Osclass](https://github.com/bitnami/bitnami-docker-osclass) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
It also packages the [Bitnami MariaDB chart](https://github.com/kubernetes/charts/tree/master/stable/mariadb) which is required for bootstrapping a MariaDB deployment for the database requirements of the Osclass application.
## Prerequisites
- Kubernetes 1.4+ with Beta APIs enabled
- PV provisioner support in the underlying infrastructure
## Installing the Chart
To install the chart with the release name `my-release`:
```console
$ helm install --name my-release stable/osclass
```
The command deploys Osclass on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.
> **Tip**: List all releases using `helm list`
## Uninstalling the Chart
To uninstall/delete the `my-release` deployment:
```console
$ helm delete my-release
```
The command removes all the Kubernetes components associated with the chart and deletes the release.
## Configuration
The following tables lists the configurable parameters of the Osclass chart and their default values.
| Parameter | Description | Default |
|------------------------------------|------------------------------------------|---------------------------------------------|
| `imageTag` | `bitnami/osclass` image tag. | Osclass image version |
| `imagePullPolicy` | Image pull policy. | `IfNotPresent`. |
| `osclassHost` | Osclass host to create application URLs | `nil` |
| `osclassLoadBalancerIP` | `loadBalancerIP` for the Osclass Service | `nil` |
| `osclassUsername` | User of the application | `user` |
| `osclassPassword` | Application password | `bitnami` |
| `osclassEmail` | Admin email | `user@example.com` |
| `osclassWebTitle` | Application tittle | `Sample Web Page` |
| `osclassPingEngines` | Allow site to appear in search engines | `1` |
| `osclassSaveStats` | Send statistics and reports to Osclass | `1` |
| `smtpHost` | SMTP host | `nil` |
| `smtpPort` | SMTP port | `nil` |
| `smtpUser` | SMTP user | `nil` |
| `smtpPassword` | SMTP password | `nil` |
| `smtpProtocol` | SMTP protocol [`ssl`, `tls`] | `nil` |
| `serviceType` | Kubernetes Service type | `LoadBalancer` |
| `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` |
| `persistence.enabled` | Enable persistence using PVC | `true` |
| `persistence.apache.storageClass` | PVC Storage Class for Apache volume | `nil` (uses alpha storage class annotation) |
| `persistence.apache.accessMode` | PVC Access Mode for Apache volume | `ReadWriteOnce` |
| `persistence.apache.size` | PVC Storage Request for Apache volume | `1Gi` |
| `persistence.moodle.storageClass` | PVC Storage Class for OSClass volume | `nil` (uses alpha storage class annotation) |
| `persistence.moodle.accessMode` | PVC Access Mode for OSClass volume | `ReadWriteOnce` |
| `persistence.moodle.size` | PVC Storage Request for OSClass volume | `8Gi` |
| `mariadb.mariadbRootPassword` | MariaDB admin password | `nil` |
| `mariadb.persistence.enabled` | Enable MariaDB persistence using PVC | `true` |
| `mariadb.persistence.storageClass` | PVC Storage Class for MariaDB volume | `generic` |
| `mariadb.persistence.accessMode` | PVC Access Mode for MariaDB volume | `ReadWriteOnce` |
| `mariadb.persistence.size` | PVC Storage Request for MariaDB volume | `8Gi` |
The above parameters map to the env variables defined in [bitnami/osclass](http://github.com/bitnami/bitnami-docker-osclass). For more information please refer to the [bitnami/osclass](http://github.com/bitnami/bitnami-docker-osclass) image documentation.
> **Note**:
>
> For Osclass to function correctly, you should specify the `osclassHost` parameter to specify the FQDN (recommended) or the public IP address of the Osclass service.
>
> Optionally, you can specify the `osclassLoadBalancerIP` parameter to assign a reserved IP address to the Osclass service of the chart. However please note that this feature is only available on a few cloud providers (f.e. GKE).
>
> To reserve a public IP address on GKE:
>
> ```bash
> $ gcloud compute addresses create osclass-public-ip
> ```
>
> The reserved IP address can be associated to the Osclass service by specifying it as the value of the `osclassLoadBalancerIP` parameter while installing the chart.
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
```console
$ helm install --name my-release \
--set osclassUsername=admin,osclassPassword=password,mariadb.mariadbRootPassword=secretpassword \
stable/osclass
```
The above command sets the Osclass administrator account username and password to `admin` and `password` respectively. Additionally it sets the MariaDB `root` user password to `secretpassword`.
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,
```console
$ helm install --name my-release -f values.yaml stable/osclass
```
> **Tip**: You can use the default [values.yaml](values.yaml)
## Persistence
The [Bitnami Osclass](https://github.com/bitnami/bitnami-docker-osclass) image stores the Osclass data and configurations at the `/bitnami/osclass` and `/bitnami/apache` paths of the container.
Persistent Volume Claims are used to keep the data across deployments. This is known to work in GCE, AWS, and minikube.
See the [Configuration](#configuration) section to configure the PVC or to disable persistence.
+6
View File
@@ -0,0 +1,6 @@
dependencies:
- name: mariadb
repository: https://kubernetes-charts.storage.googleapis.com/
version: 0.5.6
digest: sha256:1b3aad03b4383d1a24dfbfef6ba1beb45f7ace2baa399c66f5a4d56d0f7bc717
generated: 2017-01-06T23:38:08.537627606+05:30
+4
View File
@@ -0,0 +1,4 @@
dependencies:
- name: mariadb
version: 0.5.x
repository: https://kubernetes-charts.storage.googleapis.com/
+50
View File
@@ -0,0 +1,50 @@
{{- if empty (include "host" .) -}}
###############################################################################
### ERROR: You did not provide an external host in your 'helm install' call ###
###############################################################################
This deployment will be incomplete until you configure Osclass with a resolvable
host. To configure Osclass with the URL of your service:
1. Get the Osclass URL by running:
{{- if contains "NodePort" .Values.serviceType }}
export APP_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.spec.ports[0].nodePort}")
export APP_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
{{- else if contains "LoadBalancer" .Values.serviceType }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "fullname" . }}'
export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
export APP_PASSWORD=$(printf $(printf '\%o' `kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.osclass-password[*]}"`))
export APP_DATABASE_PASSWORD=$(printf $(printf '\%o' `kubectl get secret --namespace {{ .Release.Namespace }} {{ template "mariadb.fullname" . }} -o jsonpath="{.data.mariadb-root-password[*]}"`))
{{- end }}
2. Complete your Osclass deployment by running:
helm upgrade {{ .Release.Name }} \
--set osclassHost=$APP_HOST,osclassPassword=$APP_PASSWORD,mariadb.mariadbRootPassword=$APP_DATABASE_PASSWORD stable/osclass
{{- else -}}
1. Get the Osclass URL by running:
{{- if eq .Values.serviceType "ClusterIP" }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}")
echo URL : http://127.0.0.1:8080/
echo Admin URL : http://127.0.0.1:8080/oc-admin/
kubectl port-forward $POD_NAME 8080:80
{{- else }}
echo URL : http://{{ include "host" . }}/
echo Admin URL : http://{{ include "host" . }}/oc-admin/
{{- end }}
2. Get your Osclass login credentials by running:
echo Username : {{ .Values.osclassUsername }}
echo Password : $(printf $(printf '\%o' `kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.osclass-password[*]}"`))
{{- end }}
+45
View File
@@ -0,0 +1,45 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "mariadb.fullname" -}}
{{- printf "%s-%s" .Release.Name "mariadb" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Get the user defined LoadBalancerIP for this release.
Note, returns 127.0.0.1 if using ClusterIP.
*/}}
{{- define "serviceIP" -}}
{{- if eq .Values.serviceType "ClusterIP" -}}
127.0.0.1
{{- else -}}
{{- index .Values (printf "%sLoadBalancerIP" .Chart.Name) | default "" -}}
{{- end -}}
{{- end -}}
{{/*
Gets the host to be used for this application.
If not using ClusterIP, or if a host or LoadBalancerIP is not defined, the value will be empty.
*/}}
{{- define "host" -}}
{{- $host := index .Values (printf "%sHost" .Chart.Name) | default "" -}}
{{- default (include "serviceIP" .) $host -}}
{{- end -}}
+23
View File
@@ -0,0 +1,23 @@
{{- if .Values.persistence.enabled -}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "fullname" . }}-apache
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
annotations:
{{- if .Values.persistence.apache.storageClass }}
volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.apache.storageClass | quote }}
{{- else }}
volume.alpha.kubernetes.io/storage-class: default
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.apache.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.apache.size | quote }}
{{- end -}}
+106
View File
@@ -0,0 +1,106 @@
{{- if include "host" . -}}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
template:
metadata:
labels:
app: {{ template "fullname" . }}
spec:
containers:
- name: {{ template "fullname" . }}
image: "{{ .Values.image }}"
imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }}
env:
- name: MARIADB_HOST
value: {{ template "mariadb.fullname" . }}
- name: MARIADB_PORT
value: "3306"
- name: MARIADB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "mariadb.fullname" . }}
key: mariadb-root-password
- name: OSCLASS_HOST
value: {{ include "host" . | quote }}
- name: OSCLASS_USERNAME
value: {{ default "" .Values.osclassUsername | quote }}
- name: OSCLASS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}
key: osclass-password
- name: OSCLASS_EMAIL
value: {{ default "" .Values.osclassEmail | quote }}
- name: OSCLASS_WEB_TITLE
value: {{ default "" .Values.osclassWebTitle | quote }}
- name: OSCLASS_PING_ENGINES
value: {{ default "" .Values.osclassPingEngines | quote }}
- name: OSCLASS_SAVE_STATS
value: {{ default "" .Values.osclassSaveStats | quote }}
- name: SMTP_HOST
value: {{ default "" .Values.smtpHost | quote }}
- name: SMTP_PORT
value: {{ default "" .Values.smtpPort | quote }}
- name: SMTP_USER
value: {{ default "" .Values.smtpUser | quote }}
- name: SMTP_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}
key: smtp-password
- name: SMTP_PROTOCOL
value: {{ default "" .Values.smtpProtocol | quote }}
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
livenessProbe:
exec:
command:
- nc
- -z
- localhost
- "80"
initialDelaySeconds: 120
timeoutSeconds: 5
readinessProbe:
exec:
command:
- nc
- -z
- localhost
- "80"
initialDelaySeconds: 5
timeoutSeconds: 1
resources:
{{ toYaml .Values.resources | indent 10 }}
volumeMounts:
- name: osclass-data
mountPath: /bitnami/osclass
- name: apache-data
mountPath: /bitnami/apache
volumes:
- name: osclass-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "fullname" . }}-osclass
{{- else }}
emptyDir: {}
{{- end }}
- name: apache-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "fullname" . }}-apache
{{- else }}
emptyDir: {}
{{- end }}
{{- end -}}
+23
View File
@@ -0,0 +1,23 @@
{{- if .Values.persistence.enabled -}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "fullname" . }}-osclass
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
annotations:
{{- if .Values.persistence.osclass.storageClass }}
volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.osclass.storageClass | quote }}
{{- else }}
volume.alpha.kubernetes.io/storage-class: default
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.osclass.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.osclass.size | quote }}
{{- end -}}
+17
View File
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
type: Opaque
data:
{{ if .Values.osclassPassword }}
osclass-password: {{ default "" .Values.osclassPassword | b64enc | quote }}
{{ else }}
osclass-password: {{ randAlphaNum 10 | b64enc | quote }}
{{ end }}
smtp-password: {{ default "" .Values.smtpPassword | b64enc | quote }}
+23
View File
@@ -0,0 +1,23 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
type: {{ .Values.serviceType }}
{{- if eq .Values.serviceType "LoadBalancer" }}
loadBalancerIP: {{ default "" .Values.osclassLoadBalancerIP }}
{{- end }}
ports:
- name: http
port: 80
targetPort: http
- name: https
port: 443
targetPort: https
selector:
app: {{ template "fullname" . }}
+108
View File
@@ -0,0 +1,108 @@
## Bitnami Osclass image version
## ref: https://hub.docker.com/r/bitnami/osclass/tags/
##
image: bitnami/osclass:3.7.0-r4
## Specify a imagePullPolicy
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
imagePullPolicy: IfNotPresent
## Osclass host to create application URLs
## ref: https://github.com/bitnami/bitnami-docker-osclass#configuration
##
# osclassHost:
## loadBalancerIP for the Osclass Service (optional, cloud specific)
## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer
##
# osclassLoadBalancerIP:
## User of the application
## ref: https://github.com/bitnami/bitnami-docker-osclass#configuration
##
osclassUsername: user
## Application password
## Defaults to a random 10-character alphanumeric string if not set
## ref: https://github.com/bitnami/bitnami-docker-osclass#configuration
##
# osclassPassword:
## Admin email
## ref: https://github.com/bitnami/bitnami-docker-osclass#configuration
##
osclassEmail: user@example.com
## Application title
## ref: https://github.com/bitnami/bitnami-docker-osclass#configuration
osclassWebTitle: 'Sample Web Page'
## Allow site to appear in search engines
## ref: https://github.com/bitnami/bitnami-docker-osclass#configuration
osclassPingEngines: 1
## Automatically send usage statistics and crash reports to Osclass
## ref: https://github.com/bitnami/bitnami-docker-osclass#configuration
##
osclassSaveStats: 1
## SMTP mail delivery configuration
## ref: https://github.com/bitnami/bitnami-docker-osclass/#smtp-configuration
##
# smtpHost:
# smtpPort:
# smtpUser:
# smtpPassword:
# smtpProtocol:
##
## MariaDB chart configuration
##
mariadb:
## MariaDB admin password
## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#setting-the-root-password-on-first-run
##
# mariadbRootPassword:
## Enable persistence using Persistent Volume Claims
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
##
persistence:
enabled: true
storageClass: generic
accessMode: ReadWriteOnce
size: 8Gi
## Kubernetes configuration
## For minikube, set this to NodePort, elsewhere use LoadBalancer
##
serviceType: LoadBalancer
## Enable persistence using Persistent Volume Claims
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
##
persistence:
enabled: true
apache:
## If defined, volume.beta.kubernetes.io/storage-class: <storageClass>
## Default: volume.alpha.kubernetes.io/storage-class: default
##
# storageClass: generic
accessMode: ReadWriteOnce
size: 1Gi
osclass:
## If defined, volume.beta.kubernetes.io/storage-class: <storageClass>
## Default: volume.alpha.kubernetes.io/storage-class: default
##
# storageClass: generic
accessMode: ReadWriteOnce
size: 8Gi
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
##
resources:
requests:
memory: 512Mi
cpu: 300m