Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
funkypenguin committed May 2, 2019
0 parents commit 71ef1c3
Show file tree
Hide file tree
Showing 68 changed files with 2,816 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
jobs:
build:
docker:
- image: alpine
steps:
- checkout
- add_ssh_keys
- run:
name: deloy-to-helm-repo
environment:
- GITHUB_PAGES_REPO: funkypenguin/helm-charts
command: wget -O - https://raw.githubusercontent.com/funkypenguin/helm-github-pages/master/publish.sh | sh
9 changes: 9 additions & 0 deletions .circleci/prep-unit-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# Execute a few steps to ensure some of the more complex combinations of unit tests can pass

echo "Setting up environment for unit testing..."
pwd

mkdir -p ~/project/helm-chart/docker-mailserver/config/opendkim/keys/example.com
cp ~/project/helm-chart/docker-mailserver/demo-mode-dkim-key-for-example.com.key ~/project/helm-chart/docker-mailserver/config/opendkim/keys/example.com/mail.private
echo "sample data for unit test" > ~/project/helm-chart/docker-mailserver/config/opendkim/ignore.txt
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.DS_Store
docker-compose.yml
.idea
.env
test/config/empty/
test/config/without-accounts/
test/config/without-virtual/
test/config/with-domain/
test/config/postfix-accounts.cf
test/config/letsencrypt/mail.my-domain.com/combined.pem
test/onedir
config/opendkim/
*.secret
helm-chart/docker-mailserver/config/opendkim
myvalues.yml
helm-chart/manifests
1 change: 1 addition & 0 deletions README.md
22 changes: 22 additions & 0 deletions helm-chart/docker-mailserver/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
tests/
17 changes: 17 additions & 0 deletions helm-chart/docker-mailserver/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
appVersion: "6.1.0"
description: A fullstack but simple mailserver (smtp, imap, antispam, antivirus, ssl...) using Docker.
name: docker-mailserver
version: 0.1.0
sources:
- https://github.com/funkypenguin/docker-mailserver
maintainers:
- name: funkypenguin
email: [email protected]
keywords:
- mailserver
- postfix
- dovecot
- amavis
- imap
tillerVersion: ">=2.13.0"
19 changes: 19 additions & 0 deletions helm-chart/docker-mailserver/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
The MIT License (MIT)
Copyright (c) 2016 Andrew Howden <hello[at]andrewhowden.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 changes: 4 additions & 0 deletions helm-chart/docker-mailserver/MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The following document lists the maintainers of the project, as well as the username for each.

# Maintainers
- __AUTHOR_NAME__ (__AUTHOR_GITHUB_USERNAME__)
4 changes: 4 additions & 0 deletions helm-chart/docker-mailserver/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
approvers:
- funkypenguin
reviewers:
- funkypenguin
92 changes: 92 additions & 0 deletions helm-chart/docker-mailserver/PERSISTENCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Persistence

There are two storage APIs in Kubernetes that handle persistence abstraction:

- volume.alpha.kubernetes.io/storage-class
- volume.beta.kubernetes.io/storage-class

These APIs have different behaviours, across different cluster versions. The alpha API will be used if a storage class is not specified in the `storageClass` input, as it defers storage to to the cluster and the cluster will provision some based on its configured defaults. However, if the administrator needs to provision this storage (such as in the local development environment), they should set the `storageClass` attribute to match their configured storage, after which the beta API will be used.

An example PV might look something like the following:

```yaml
---
apiVersion: "v1"
kind: "PersistentVolume"
metadata:
name: "foo-mysql"
annotations:
volume.beta.kubernetes.io/storage-class: "foo-mysql"
spec:
capacity:
storage: "10Gi"
accessModes:
- "ReadWriteOnce"
persistentVolumeReclaimPolicy: "Retain"
hostPath:
path: /mnt/mysql
```
## Backup Strategies
### Google Cloud Persistent Disk
Kubernetes does not come with any facility to automatically snapshot data on a regular basis. However, with the [k8s-snapshots](https://github.com/miracle2k/k8s-snapshots) application we can mark a persistent volume as requiring backup via a Kubernetes annotation:
```yaml
---
apiVersion: "v1"
kind: "PersistentVolume"
metadata:
name: "foo-mysql"
annotations:
backup.kubernetes.io/deltas: 1h 2d 30d 180d # <-- The annotation
# ...
```

For more information, see the [k8s-snapshots](https://github.com/miracle2k/k8s-snapshots) repository.

### Everything Else

This is not a solution that any repository maintainer has had to solve yet, so they are unaware of any solution to this.

## Custom VS Automatic persistence

Kubernetes automating the provisioning and mounting of storage is very handy when first deploying an application. However, it makes all further operations maintaining that application harder as if the application is ever torn down, it cannot be brought back up (easily) with that same persistent volume. Thus, it's a good idea when deploying an application that the developer:

1. Creates the storage class specifically for this application, or
2. Creates the PVC manually so it can be associated with a particular disk

### Existing PersistentVolumeClaims

1. Create the PersistentVolumeClaim
```bash
$ cat <<EOT | kubectl create -f -
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
selector:
matchLabels:
volume_name: test
EOT
```

2. Create the directory, on a worker

```bash
# mkdir -m 1777 /NFS_MOUNT/test
```

3. Install the chart

```bash
$ helm install --name test --set persistence.existingClaim=test .
```
Loading

0 comments on commit 71ef1c3

Please sign in to comment.