Skip to content

Commit

Permalink
Add "Supported Backends" doc to new guides (#756)
Browse files Browse the repository at this point in the history
  • Loading branch information
hossainemruz authored and tamalsaha committed May 12, 2019
1 parent 4370029 commit 84be8e6
Show file tree
Hide file tree
Showing 33 changed files with 1,660 additions and 13 deletions.
11 changes: 11 additions & 0 deletions docs/examples/guides/v1beta1/backends/azure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: azure-repo
namespace: demo
spec:
backend:
azure:
container: stash-backup
prefix: /demo/deployment/my-deploy
storageSecretName: azure-secret
11 changes: 11 additions & 0 deletions docs/examples/guides/v1beta1/backends/b2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: b2-repo
namespace: demo
spec:
backend:
b2:
bucket: stash-backup
prefix: /demo/deployment/my-deploy
storageSecretName: b2-secret
11 changes: 11 additions & 0 deletions docs/examples/guides/v1beta1/backends/gcs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: gcs-repo
namespace: demo
spec:
backend:
gcs:
bucket: stash-backup
prefix: /demo/deployment/my-deploy
storageSecretName: gcs-secret
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: local-repo-with-awsebs
namespace: demo
spec:
backend:
local:
mountPath: /safe/data
awsElasticBlockStore: # This AWS EBS volume must already exist.
volumeID: <volume-id>
fsType: ext4
storageSecretName: local-secret
13 changes: 13 additions & 0 deletions docs/examples/guides/v1beta1/backends/local_azureDisk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: local-repo-with-azuredisk
namespace: demo
spec:
backend:
local:
mountPath: /safe/data
azureDisk:
diskName: stash.vhd
diskURI: https://someaccount.blob.microsoft.net/vhds/stash.vhd
storageSecretName: local-secret
11 changes: 11 additions & 0 deletions docs/examples/guides/v1beta1/backends/local_emptyDir.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: local-repo-with-emptydir
namespace: demo
spec:
backend:
local:
mountPath: /safe/data
emptyDir: {}
storageSecretName: local-secret
13 changes: 13 additions & 0 deletions docs/examples/guides/v1beta1/backends/local_gcePersistentDisk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: local-repo-with-gcepersistentdisk
namespace: demo
spec:
backend:
local:
mountPath: /safe/data
gcePersistentDisk:
pdName: stash-repo
fsType: ext4
storageSecretName: local-secret
12 changes: 12 additions & 0 deletions docs/examples/guides/v1beta1/backends/local_hostPath.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: local-repo-with-hostpath
namespace: demo
spec:
backend:
local:
mountPath: /safe/data
hostPath:
path: /data/stash-test/repo
storageSecretName: local-secret
13 changes: 13 additions & 0 deletions docs/examples/guides/v1beta1/backends/local_nfs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: local-repo-with-nfs
namespace: demo
spec:
backend:
local:
mountPath: /safe/data
nfs:
server: "nfs-service.storage.svc.cluster.local" # use you own NFS server address
path: "/" # this path is relative to "/exports" path of NFS server
storageSecretName: local-secret
12 changes: 12 additions & 0 deletions docs/examples/guides/v1beta1/backends/local_pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: local-repo-with-pvc
namespace: demo
spec:
backend:
local:
mountPath: /safe/data
persistentVolumeClaim:
claimName: repo-pvc
storageSecretName: local-secret
13 changes: 13 additions & 0 deletions docs/examples/guides/v1beta1/backends/local_storageOS.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: local-repo-with-storageos
namespace: demo
spec:
backend:
local:
mountPath: /safe/data
storageos:
volumeName: stash-vol01 # The `stash-vol01` volume must already exist within StorageOS in the `demo` namespace.
fsType: ext4
storageSecretName: local-secret
10 changes: 10 additions & 0 deletions docs/examples/guides/v1beta1/backends/rest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: rest-repo
namespace: demo
spec:
backend:
rest:
url: http://rest-server.demo.svc:8000/stash-backup-demo
storageSecretName: rest-secret
12 changes: 12 additions & 0 deletions docs/examples/guides/v1beta1/backends/s3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: s3-repo
namespace: demo
spec:
backend:
s3:
endpoint: s3.amazonaws.com # use server URL for s3 compatible other storage service
bucket: stash-demo
prefix: /backup/demo/deployment/stash-demo
storageSecretName: s3-secret
11 changes: 11 additions & 0 deletions docs/examples/guides/v1beta1/backends/swift.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: swift-repo
namespace: demo
spec:
backend:
swift:
container: stash-backup
prefix: /demo/deployment/my-deploy
storageSecretName: swift-secret
27 changes: 23 additions & 4 deletions docs/examples/rest/repo.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: rest-pvc
namespace: demo
spec:
storageClassName: standard
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Pod
metadata:
Expand All @@ -12,6 +25,13 @@ spec:
ports:
- name: http-1
containerPort: 8000
volumeMounts:
- name: storage
mountPath: /data
volumes:
- name: storage
persistentVolumeClaim:
claimName: rest-pvc
# kubectl logs -f -n demo rest-server
# kubectl exec -it -n demo rest-server create_user myuser
# kubectl create secret generic rest-secret -n demo --from-file=./RESTIC_PASSWORD --from-file=./REST_SERVER_USERNAME --from-file=./REST_SERVER_PASSWORD
Expand All @@ -29,17 +49,16 @@ spec:
name: http-1
protocol: TCP
targetPort: 8000
type: NodePort
selector:
app: rest-server
---
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: hello-repo
name: rest-repo
namespace: demo
spec:
backend:
rest:
url: http://172.17.0.4:8000/hello-prefix
storageSecretName: rest-secret
url: http://rest-server.demo.svc:8000/stash/backup/demo
storageSecretName: rest-secret
10 changes: 10 additions & 0 deletions docs/guides/latest/backends/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Backends | Stash
menu:
product_stash_0.8.3:
identifier: backend
name: Supported Backends
parent: latest-guides
weight: 10
menu_name: product_stash_0.8.3
---
85 changes: 85 additions & 0 deletions docs/guides/latest/backends/azure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
title: Azure Backend | Stash
description: Configure Stash to use Microsoft Azure Storage as Backend.
menu:
product_stash_0.8.3:
identifier: backend-azure
name: Azure Blob Storage
parent: backend
weight: 40
product_name: stash
menu_name: product_stash_0.8.3
section_menu_id: guides
---

# Microsoft Azure Storage

Stash supports Microsoft's [Azure Blob Storage](https://azure.microsoft.com/en-us/services/storage/blobs/) as a backend. This tutorial will show you how to use this backend.

In order to use Azure Blob Storage as backend, you have to create a `Secret` and a `Repository` object pointing to the desired blob container.

#### Create Storage Secret

To configure storage secret for this backend, following secret keys are needed:

| Key | Type | Description |
| -------------------- | ---------- | ---------------------------------------------------------- |
| `RESTIC_PASSWORD` | `Required` | Password that will be used to encrypt the backup snapshots |
| `AZURE_ACCOUNT_NAME` | `Required` | Azure Storage account name |
| `AZURE_ACCOUNT_KEY` | `Required` | Azure Storage account key |

Create storage secret as below,

```console
$ echo -n 'changeit' > RESTIC_PASSWORD
$ echo -n '<your-azure-storage-account-name>' > AZURE_ACCOUNT_NAME
$ echo -n '<your-azure-storage-account-key>' > AZURE_ACCOUNT_KEY
$ kubectl create secret generic -n demo azure-secret \
--from-file=./RESTIC_PASSWORD \
--from-file=./AZURE_ACCOUNT_NAME \
--from-file=./AZURE_ACCOUNT_KEY
secret/azure-secret created
```

### Create Repository

Now, you have to create a `Repository` crd. You have to provide the storage secret that we have created earlier in `spec.backend.storageSecretName` field.

Following parameters are available for `azure` backend.

| Parameter | Type | Description |
| ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `azure.container` | `Required` | Name of Storage container. |
| `azure.prefix` | `Optional` | Path prefix inside the container where backed up data will be stored. |
| `azure.maxConnections` | `Optional` | Maximum number of parallel connections to use for uploading backup data. By default, Stash will use maximum 5 parallel connections. |

Below, the YAML of a sample `Repository` crd that uses an Azure Blob container as a backend.

```yaml
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: azure-repo
namespace: demo
spec:
backend:
azure:
container: stash-backup
prefix: /demo/deployment/my-deploy
storageSecretName: azure-secret
```
Create the `Repository` we have shown above using the following command,

```console
$ kubectl apply -f https://raw.githubusercontent.com/appscode/stash/0.8.3/docs/examples/guides/v1beta1/backends/azure.yaml
repository/azure-repo created
```

Now, we are ready to use this backend to backup our desired data using Stash.

## Next Steps

- Learn how to use Stash to backup workloads data from [here](/docs/guides/latest/workloads/backup.md).
- Learn how to use Stash to backup databases from [here](/docs/guides/latest/databases/backup.md).
- Learn how to use Stash to backup stand-alone PVC from [here](/docs/guides/latest/volumes/backup.md).
Loading

0 comments on commit 84be8e6

Please sign in to comment.