Skip to content

Commit

Permalink
New format of repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Juanma committed Mar 1, 2018
1 parent 2c1b399 commit 20ca03a
Show file tree
Hide file tree
Showing 23 changed files with 1,401 additions and 146 deletions.
96 changes: 13 additions & 83 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,83 +1,13 @@
# Slug Containers Tools <img src="https://raw.githubusercontent.com/tedezed/slug-containers/master/docs/img/slug.png" width="100">

## [Slug StatefulSet autoscaler](https://github.com/Tedezed/slug-containers/tree/master/statefulset_autoscaler) - [#44033](https://github.com/kubernetes/kubernetes/issues/44033)

Example of usage: https://gist.github.com/Tedezed/29b2efe5aab0beb1809d5fbb82745b47

Image `tedezed/slug-statefulset-autoscaler:latest`

- [x] Docker build
- [x] Docker image in Docker Hub
- [x] Autoscaler StatefulSet
- [x] Autoscaler using CPU
- [x] Autoscaler using max/min replicas
- [x] Autoreduce StatefulSet Normal (Simple containers)
- [ ] Autoscaler StatefulSet crunchy-containers
- [ ] Autoreduce StatefulSet crunchy-containers

## [SFTP multiuser](https://github.com/Tedezed/slug-containers/tree/master/sftp-share)

SFTP for multiple users

Image `tedezed/sftpd-multiuser`

- [x] Docker build
- [x] Docker image in Docker Hub
- [x] Modes: one user, list users.
- [x] Support buckets storage of GCP.
- [x] Security improvements for only one user.
- [ ] Security improvements for multiuser.

## [Slug backup/snapshot ](https://github.com/Tedezed/slug-containers/tree/master/backup-db-cron)

Slug backup for all databases and snapshot for all disks using cron of Kubernetes

Image `tedezed/slug-backup-db-cron`

- [x] Docker build
- [x] Docker image in Docker Hub
- [x] Support PostgreSQL
- [x] Support MySQL
- [ ] Support MariaDB
- [ ] Support MongoDB
- [ ] Support Oracle
- [x] Date for drop
- [x] Auto backup rotation
- [x] Support snapshot GCP
- [ ] Support snapshot AWS

## [Slug emailing ](https://github.com/Tedezed/slug-containers/tree/master/emailing)

Solution to send emails in the cloud

Image `tedezed/emailing`

- [x] Docker build
- [x] Docker image in Docker Hub
- [x] Test with Mailjet
- [x] Test in GCP
- [ ] Test in AWS

## [Slug phpBB](https://github.com/Tedezed/slug-containers/tree/master/phpbb)

Personal image for mount phpBB

Image `tedezed/slug-phpbb`

- [x] Docker build
- [x] Docker image in Docker Hub
- [x] Language EN
- [x] Language ES


## [Slug StatefulSet load balancer](https://github.com/Tedezed/slug-containers/tree/master/dynamic_loadbalancer)

Dynamic load balancer for StatefulSet autoscaler "Test"

Image `tedezed/slug-statefulset-dynamic-loadbalancer`

- [x] Docker build
- [x] Docker image in Docker Hub
- [x] Dynamic load balancer, using number of replicas of StatefulSet
- [x] Support replication controller.
- [ ] Load balancing for all StatefulSet with labels: `slug_loadbalancing: "true"`
# > Slug Containers Tools <img src="https://raw.githubusercontent.com/tedezed/slug-containers/master/docs/img/slug.png" width="100">

Containers of the project:

* [slug-statefulset-autoscaler](https://github.com/Tedezed/slug-containers/tree/master/statefulset_autoscaler) - [kubernetes/kubernetes [#44033]](https://github.com/kubernetes/kubernetes/issues/44033) - Autoscaler for the statefulset of Kubernetes.
* [sftpd-multiuser](https://github.com/Tedezed/slug-containers/tree/master/sftp-share) - SFTP for volumes and buckets.
* [slug-backup-snapshot](https://github.com/Tedezed/slug-containers/tree/master/backup-db-cron) - Container to make backups and snapshots in Kubernetes.
* [liberty-dynamic-ingress](https://github.com/Tedezed/slug-containers/tree/master/liberty) - Ingres with Nginx thought-out for Odoo, Wordperss and PrestaShop.
* [pgpool-centos](https://github.com/Tedezed/slug-containers/tree/master/pgpool) - Container pgpool.
* [pgbouncer](https://github.com/Tedezed/slug-containers/tree/master/pgbouncer) - Container pgbouncer.
* [emailing](https://github.com/Tedezed/slug-containers/tree/master/emailing) - Emailing Gateway for cluster of Kubernetes in Google Cloud.
* [slug-phpbb](https://github.com/Tedezed/slug-containers/tree/master/phpbb) - Container phpbb.
* [slug-dynamic-loadbalancer](https://github.com/Tedezed/slug-containers/tree/master/dynamic_loadbalancer) - Loadbalancer in test for statefulset.
228 changes: 224 additions & 4 deletions backup-db-cron/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,228 @@
# Slug backup

* Mode 1 > Backup
* Mode 2 > Snapshot
* Mode 3 > Backup + Snapshot
## Sug backup/snapshot

Configuration modes:
Slug backup for all databases and snapshot for all disks using cron of Kubernetes

Image `tedezed/slug-backup-db-cron`

- [x] Docker build
- [x] Docker image in Docker Hub
- [x] Support PostgreSQL
- [x] Support MySQL
- [ ] Support MariaDB
- [ ] Support MongoDB
- [ ] Support Oracle
- [x] Date for drop
- [x] Auto backup rotation
- [x] Support snapshot GCP
- [ ] Support snapshot AWS

### Description:

Path of the backups: `/slug-backup-db-cron/backups`

#### Docker variables

* **MODE**:
* `1`: Backup
* `2`: Snapshot
* `3`: Backup + Snapshot
* **CONF_MODE**
* `secret`: Configuration in file on secrets.
* `conf-map`: Configuration in ConfigMap.
* **PROJECT**: Proyect of Google Cloud.
* **ZONE**: Zone of the disk in Google CLoud.
* **TIME**: Time in format for crontab.
* **DAYS_TO_DROP**
* **DAYS_TO_DROP_SNAPSHOT**


### Configuration modes:

#### CONF_MODE: `secret`

Configure secrets:

`nano kube-backup-cron-configmap.yaml`

```
backup-db-cron: v1
data:
service-name1: |
POSTGRES_USER=root
POSTGRES_PASSWORD=rootpass
namespace=default
type=postgres
port=5432
service-name2: |
POSTGRES_USER=root
POSTGRES_PASSWORD=rootpass
namespace=production
type=postgres
port=2345
```

`nano kube-snapshot-cron-configmap.yam`

```
backup-db-cron: v1
data:
disk-test1: |
zone=europe-west1-b
disk-test2: |
zone=europe-west1-b
```

Create secrets:
```
kubectl create secret generic backup-conf --from-file=kube-backup-cron-configmap.yaml=kube-backup-cron-configmap.yaml -n kube-system
kubectl create secret generic snapshot-conf --from-file=kube-snapshot-cron-configmap.yaml=kube-snapshot-cron-configmap.yam -n kube-system
```

Create container:

```
apiVersion: v1
kind: ServiceAccount
metadata:
name: slug-backup-database
namespace: kube-system
---
apiVersion: v1
kind: ReplicationController
metadata:
name: slug-backup-database
namespace: kube-system
labels:
app: slug-backup-database
spec:
replicas: 1
selector:
name: slug-backup-database
template:
metadata:
labels:
name: slug-backup-database
spec:
serviceAccountName: slug-backup-database
containers:
- name: slug-backup-database
image: tedezed/slug-backup-db-cron:latest
env:
- name: DAYS_TO_DROP
value: "15"
- name: DAYS_TO_DROP_SNAPSHOT
value: "5"
- name: TIME
value: "10 3 * * *"
- name: MODE
value: "3"
- name: PROJECT
value: "name-pro"
- name: ZONE
value: "europe-west1-b"
- name: CONF_MODE
value: "secret"
volumeMounts:
- mountPath: /slug-backup-db-cron/backups
name: vol-slug-backup-db-cron
subPath: slug-backup-db-cron
# Secrets
- name: backup-conf
mountPath: /secrets/backup
readOnly: false
- name: snapshot-conf
mountPath: /secrets/snapshot
readOnly: false
volumes:
- name: vol-slug-backup-db-cron
persistentVolumeClaim:
claimName: pvc-backups
# Secrets
- name: backup-conf
secret:
secretName: backup-conf
- name: snapshot-conf
secret:
secretName: snapshot-conf
```

#### CONF_MODE: `conf-map`

Create ConfigMap:

```
apiVersion: v1
kind: ConfigMap
metadata:
name: kube-backup-cron-configmap
namespace: kube-system
data:
# Split database_list &
service-name1: |
mode=secret
POSTGRES_USER=root
POSTGRES_PASSWORD=rootpass
namespace=default
type=postgres
port=5432
service-name2: |
POSTGRES_USER=pguser
POSTGRES_PASSWORD=pgpass
namespace=production
type=postgres
port=2345
```

Create container:

```
apiVersion: v1
kind: ServiceAccount
metadata:
name: slug-backup
namespace: kube-system
---
apiVersion: v1
kind: ReplicationController
metadata:
name: slug-backup
namespace: kube-system
labels:
app: slug-backup
spec:
replicas: 1
selector:
name: slug-backup
template:
metadata:
labels:
name: slug-backup
spec:
serviceAccountName: slug-backup
containers:
- name: slug-backup
image: tedezed/slug-backup-db-cron
env:
- name: DAYS_TO_DROP
value: "30"
- name: DAYS_TO_DROP_SNAPSHOT
value: "10"
- name: TIME
value: "10 12 * * *"
- name: MODE
value: "3"
- name: PROJECT
value: "pepperoni-xxxx"
- name: ZONE
value: "europe-xxxx"
volumeMounts:
- mountPath: /slug-backup-db-cron/backups
name: vol-slug-backup
subPath: slug-backup
volumes:
- name: vol-slug-backup
persistentVolumeClaim:
claimName: pvc-slug-backup
```
10 changes: 5 additions & 5 deletions backup-db-cron/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ RUN apt-get install -y \
python-setuptools

RUN pip install kubernetes deepdiff psycopg2 mysql-connector \
&& pip install google-api-python-client \
&& pip install google-auth google-auth-httplib2
&& pip install google-api-python-client
RUN pip install google-auth google-auth-httplib2 psycopg2-binary

RUN apt-get remove --purge -y \
build-essential \
Expand Down Expand Up @@ -99,9 +99,9 @@ ENV DAYS_TO_DROP=15 \
# Mode 3 > Backup + Snapshot

ENV MODE="1" \
CONF_MODE="kubernetes" \
PROJECT="test" \
ZONE="test"
CONF_MODE="conf-map" \
PROJECT="project-name-test" \
ZONE="europe-west1-b"

## ----- END ----- ##

Expand Down
Loading

0 comments on commit 20ca03a

Please sign in to comment.