Skip to content

Commit a59bed1

Browse files
hossainemruztamalsaha
authored andcommitted
Finalize doc template (#9)
1 parent 08274c9 commit a59bed1

File tree

2 files changed

+36
-154
lines changed

2 files changed

+36
-154
lines changed

docs/_index.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: PostgreSQL {{ .subproject_version }} Backup Guides | Stash
3+
menu:
4+
product_stash_{{ .version }}:
5+
identifier: stash-postgres-guides-{{ .subproject_version }}
6+
name: {{ .subproject_version }}
7+
parent: stash-postgres-guides
8+
weight: 50
9+
menu_name: product_stash_{{ .version }}
10+
---

docs/postgres.md renamed to docs/standalone.md

Lines changed: 26 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
2-
title: Backup PostgreSQL | Stash
3-
description: Backup PostgreSQL database using Stash
2+
title: PostgreSQL | Stash
3+
description: Backup and restore standalone PostgreSQL database using Stash
44
menu:
5-
product_stash_0.8.3:
6-
identifier: database-postgres
7-
name: PostgreSQL
8-
parent: database
9-
weight: 20
5+
product_stash_{{ .version }}:
6+
identifier: standalone-postgres
7+
name: Standalone PostgreSQL
8+
parent: stash-postgres-guides-{{ .subproject_version }}
9+
weight: 10
1010
product_name: stash
11-
menu_name: product_stash_0.8.3
12-
section_menu_id: guides
11+
menu_name: product_stash_{{ .version }}
12+
section_menu_id: stash-addons
1313
---
1414

1515
# Backup and Restore PostgreSQL database using Stash
@@ -19,21 +19,18 @@ Stash 0.9.0+ supports backup and restoration of PostgreSQL databases. This guide
1919
## Before You Begin
2020

2121
- At first, you need to have a Kubernetes cluster, and the `kubectl` command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using Minikube.
22-
23-
- Install Stash in your cluster following the steps [here](https://appscode.com/products/stash/0.8.3/setup/install/).
24-
25-
- Install [KubeDB](https://kubedb.com) in your cluster following the steps [here](https://kubedb.com/docs/latest/setup/install/). This step is optional. You can deploy your database using any method you want. We are using KubeDB because it automates some tasks that you have to do manually otherwise.
26-
27-
- If you are not familiar with how Stash backup and restore databases, please check the following guide:
28-
- [How Stash backup and restore databases](https://appscode.com/products/stash/0.8.3/guides/databases/overview/).
22+
- Install Stash in your cluster following the steps [here](/docs/setup/install.md).
23+
- Install PostgreSQL addon for Stash following the steps [here](/docs/addons/postgres/setup/install.md)
24+
- Install [KubeDB](https://kubedb.com) in your cluster following the steps [here](https://kubedb.com/docs/setup/install/). This step is optional. You can deploy your database using any method you want. We are using KubeDB because KubeDB simplifies many of the difficult or tedious management tasks of running a production grade databases on private and public clouds.
25+
- If you are not familiar with how Stash backup and restore PostgreSQL databases, please check the following guide [here](/docs/addons/postgres/overview.md):
2926

3027
You have to be familiar with following custom resources:
3128

32-
- [AppBinding](https://appscode.com/products/stash/0.8.3/concepts/crds/appbinding/)
33-
- [Function](https://appscode.com/products/stash/0.8.3/concepts/crds/function/)
34-
- [Task](https://appscode.com/products/stash/0.8.3/concepts/crds/task/)
35-
- [BackupConfiguration](https://appscode.com/products/stash/0.8.3/concepts/crds/backupconfiguration/)
36-
- [RestoreSession](https://appscode.com/products/stash/0.8.3/concepts/crds/restoresession/)
29+
- [AppBinding](/docs/concepts/crds/appbinding.md)
30+
- [Function](/docs/concepts/crds/function.md)
31+
- [Task](/docs/concepts/crds/task.md)
32+
- [BackupConfiguration](/docs/concepts/crds/backupconfiguration.md)
33+
- [RestoreSession](/docs/concepts/crds/restoresession.md)
3734

3835
To keep things isolated, we are going to use a separate namespace called `demo` throughout this tutorial. Create `demo` namespace if you haven't created yet.
3936

@@ -44,91 +41,6 @@ namespace/demo created
4441

4542
> Note: YAML files used in this tutorial are stored [here](https://github.com/stashed/postgres/tree/master/docs/examples).
4643
47-
## Install Postgres Catalog for Stash
48-
49-
Stash uses a `Function-Task` model to backup databases. We have to install Postgres catalogs (`stash-postgres`) for Stash. This catalog creates necessary `Function` and `Task` definitions to backup/restore PostgreSQL databases.
50-
51-
You can install the catalog either as a helm chart or you can create only the YAMLs of the respective resources.
52-
53-
<ul class="nav nav-tabs" id="installerTab" role="tablist">
54-
<li class="nav-item">
55-
<a class="nav-link" id="helm-tab" data-toggle="tab" href="#helm" role="tab" aria-controls="helm" aria-selected="false">Helm</a>
56-
</li>
57-
<li class="nav-item">
58-
<a class="nav-link active" id="script-tab" data-toggle="tab" href="#script" role="tab" aria-controls="script" aria-selected="true">Script</a>
59-
</li>
60-
</ul>
61-
<div class="tab-content" id="installerTabContent">
62-
<!-- ------------ Helm Tab Begins----------- -->
63-
<div class="tab-pane fade" id="helm" role="tabpanel" aria-labelledby="helm-tab">
64-
65-
### Install as chart release
66-
67-
Run the following script to install `stash-postgres` catalog as a Helm chart.
68-
69-
```console
70-
curl -fsSL https://github.com/stashed/catalog/raw/master/deploy/chart.sh | bash -s -- --catalog=stash-postgres
71-
```
72-
73-
</div>
74-
<!-- ------------ Helm Tab Ends----------- -->
75-
76-
<!-- ------------ Script Tab Begins----------- -->
77-
<div class="tab-pane fade show active" id="script" role="tabpanel" aria-labelledby="script-tab">
78-
79-
### Install only YAMLs
80-
81-
Run the following script to install `stash-postgres` catalog as Kubernetes YAMLs.
82-
83-
```console
84-
curl -fsSL https://github.com/stashed/catalog/raw/master/deploy/script.sh | bash -s -- --catalog=stash-postgres
85-
```
86-
87-
</div>
88-
<!-- ------------ Script Tab Ends----------- -->
89-
</div>
90-
91-
Once installed, this will create `postgres-backup-*` and `postgres-restore-*` Functions for all supported PostgreSQL versions. To verify, run the following command:
92-
93-
```console
94-
$ kubectl get functions.stash.appscode.com
95-
NAME AGE
96-
postgres-backup-10.2 20s
97-
postgres-backup-10.6 20s
98-
postgres-backup-11.1 19s
99-
postgres-backup-9.6 20s
100-
postgres-restore-10.2 20s
101-
postgres-restore-10.6 20s
102-
postgres-restore-11.1 19s
103-
postgres-restore-9.6 20s
104-
postgres-backup-11.2 19s
105-
postgres-restore-11.2 19s
106-
pvc-backup 7h6m
107-
pvc-restore 7h6m
108-
update-status 7h6m
109-
```
110-
111-
Also, verify that the necessary `Task` have been created.
112-
113-
```console
114-
$ kubectl get tasks.stash.appscode.com
115-
NAME AGE
116-
postgres-backup-10.2 2m7s
117-
postgres-backup-10.6 2m7s
118-
postgres-backup-11.1 2m6s
119-
postgres-backup-9.6 2m7s
120-
postgres-restore-10.2 2m7s
121-
postgres-restore-10.6 2m7s
122-
postgres-restore-11.1 2m6s
123-
postgres-restore-9.6 m7s
124-
postgres-backup-11.2 2m6s
125-
postgres-restore-11.2 2m6s
126-
pvc-backup 7h7m
127-
pvc-restore 7h7m
128-
```
129-
130-
Now, Stash is ready to backup PostgreSQL database.
131-
13244
## Backup PostgreSQL
13345

13446
This section will demonstrate how to backup PostgreSQL database. Here, we are going to deploy a PostgreSQL database using KubeDB. Then, we are going to backup this database into a GCS bucket. Finally, we are going to restore the backed up data into another PostgreSQL database.
@@ -163,7 +75,7 @@ spec:
16375
Create the above `Postgres` crd,
16476

16577
```console
166-
$ kubectl apply -f ./docs/examples/backup/postgres.yaml
78+
$ kubectl apply -f https://github.com/stashed/postgres/raw/{{< param "info.subproject_version" >}}/docs/examples/backup/postgres.yaml
16779
postgres.kubedb.com/sample-postgres created
16880
```
16981

@@ -190,7 +102,7 @@ sample-postgres ClusterIP 10.106.147.155 <none> 5432/TCP
190102
sample-postgres-replicas ClusterIP 10.96.231.122 <none> 5432/TCP 22h
191103
```
192104

193-
Here, we have to use service `sample-postgres` and secret `sample-postgres-auth` to connect with the database. KubeDB creates an [AppBinding](https://appscode.com/products/stash/0.8.3/concepts/crds/appbinding/) crd that holds the necessary information to connect with the database.
105+
Here, we have to use service `sample-postgres` and secret `sample-postgres-auth` to connect with the database. KubeDB creates an [AppBinding](/docs/concepts/crds/appbinding.md) crd that holds the necessary information to connect with the database.
194106

195107
**Verify AppBinding:**
196108

@@ -331,7 +243,7 @@ Now, we are ready to backup this sample database.
331243

332244
### Prepare Backend
333245

334-
We are going to store our backed up data into a GCS bucket. At first, we need to create a secret with GCS credentials then we need to create a `Repository` crd. If you want to use a different backend, please read the respective backend configuration doc from [here](https://appscode.com/products/stash/0.8.3/guides/backends/overview/).
246+
We are going to store our backed up data into a GCS bucket. At first, we need to create a secret with GCS credentials then we need to create a `Repository` crd. If you want to use a different backend, please read the respective backend configuration doc from [here](/docs/guides/latest/backends/overview.md).
335247

336248
**Create Storage Secret:**
337249

@@ -369,7 +281,7 @@ spec:
369281
Let's create the `Repository` we have shown above,
370282

371283
```console
372-
$ kubectl apply -f ./docs/examples/backup/repository.yaml
284+
$ kubectl apply -f https://github.com/stashed/postgres/raw/{{< param "info.subproject_version" >}}/docs/examples/backup/repository.yaml
373285
repository.stash.appscode.com/gcs-repo created
374286
```
375287

@@ -416,7 +328,7 @@ Here,
416328
Let's create the `BackupConfiguration` crd we have shown above,
417329

418330
```console
419-
$ kubectl apply -f ./docs/examples/backup/backupconfiguration.yaml
331+
$ kubectl apply -f https://github.com/stashed/postgres/raw/{{< param "info.subproject_version" >}}/docs/examples/backup/backupconfiguration.yaml
420332
backupconfiguration.stash.appscode.com/sample-postgres-backup created
421333
```
422334

@@ -463,7 +375,7 @@ gcs-repo true 3.441 KiB 1 31s 17m
463375
Now, if we navigate to the GCS bucket, we are going to see backed up data has been stored in `demo/postgres/sample-postgres` directory as specified by `spec.backend.gcs.prefix` field of Repository crd.
464376

465377
<figure align="center">
466-
  <img alt="Backup data in GCS Bucket" src="/docs/images/sample-postgres-backup.png">
378+
  <img alt="Backup data in GCS Bucket" src="../images/sample-postgres-backup.png">
467379
<figcaption align="center">Fig: Backup data in GCS Bucket</figcaption>
468380
</figure>
469381

@@ -535,7 +447,7 @@ Here,
535447
Let's create the above database,
536448

537449
```console
538-
$ kubectl apply -f ./docs/examples/restore/restored-postgres.yaml
450+
$ kubectl apply -f https://github.com/stashed/postgres/raw/{{< param "info.subproject_version" >}}/docs/examples/restore/restored-postgres.yaml
539451
postgres.kubedb.com/restored-postgres created
540452
```
541453

@@ -598,7 +510,7 @@ Here,
598510
Let's create the `RestoreSession` crd we have shown above,
599511

600512
```console
601-
$ kubectl apply -f ./docs/examples/restore/restoresession.yaml
513+
$ kubectl apply -f https://github.com/stashed/postgres/raw/{{< param "info.subproject_version" >}}/docs/examples/restore/restoresession.yaml
602514
restoresession.stash.appscode.com/sample-postgres-restore created
603515
```
604516

@@ -688,43 +600,3 @@ kubectl delete restoresession -n demo sample-postgres-restore
688600
kubectl delete pg -n demo restored-postgres
689601
kubectl delete pg -n demo sample-postgres
690602
```
691-
692-
To cleanup the Postgres catalogs that we had created earlier, run the following:
693-
694-
<ul class="nav nav-tabs" id="uninstallerTab" role="tablist">
695-
<li class="nav-item">
696-
<a class="nav-link" id="helm-uninstaller-tab" data-toggle="tab" href="#helm-uninstaller" role="tab" aria-controls="helm-uninstaller" aria-selected="false">Helm</a>
697-
</li>
698-
<li class="nav-item">
699-
<a class="nav-link active" id="script-uninstaller-tab" data-toggle="tab" href="#script-uninstaller" role="tab" aria-controls="script-uninstaller" aria-selected="true">Script</a>
700-
</li>
701-
</ul>
702-
<div class="tab-content" id="uninstallerTabContent">
703-
<!-- ------------ Helm Tab Begins----------- -->
704-
<div class="tab-pane fade" id="helm-uninstaller" role="tabpanel" aria-labelledby="helm-uninstaller-tab">
705-
706-
### Uninstall `stash-postgres-*` charts
707-
708-
Run the following script to uninstall `stash-postgres` catalogs that was installed as a Helm chart.
709-
710-
```console
711-
curl -fsSL https://github.com/stashed/catalog/raw/master/deploy/chart.sh | bash -s -- --uninstall --catalog=stash-postgres
712-
```
713-
714-
</div>
715-
<!-- ------------ Helm Tab Ends----------- -->
716-
717-
<!-- ------------ Script Tab Begins----------- -->
718-
<div class="tab-pane fade show active" id="script-uninstaller" role="tabpanel" aria-labelledby="script-uninstaller-tab">
719-
720-
### Uninstall `stash-postgres` catalog YAMLs
721-
722-
Run the following script to uninstall `stash-postgres` catalog that was installed as Kubernetes YAMLs.
723-
724-
```console
725-
curl -fsSL https://github.com/stashed/catalog/raw/master/deploy/script.sh | bash -s -- --uninstall --catalog=stash-postgres
726-
```
727-
728-
</div>
729-
<!-- ------------ Script Tab Ends----------- -->
730-
</div>

0 commit comments

Comments
 (0)