Skip to content

Commit

Permalink
Merge pull request #265 from stakater/add-backup-docs
Browse files Browse the repository at this point in the history
Add backup docs
  • Loading branch information
rasheedamir authored Jun 21, 2024
2 parents c49ad59 + f613882 commit f24d8f1
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 92 deletions.
89 changes: 0 additions & 89 deletions content/for-delivery-engineers/explanation/secrets.md

This file was deleted.

12 changes: 10 additions & 2 deletions content/for-delivery-engineers/overview.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Overview

The "For Delivery Engineer" section focuses on providing information tailored explicitly for delivery engineers involved in GitOps-based application delivery.
The primary goal of this section is to enable the developers to set up their CI-CD workflows. The delivery engineer is expected to have elevated permissions over their organization in their SCM provider to be able to create tokens and SSH keys.
In this section, we will create the two repositories that are required for our CI-CD workflow. Later we will generate Tokens and SSH keys for accessing these repositories.

We manage GitOps with two different kinds of repository with different purpose enlisted below:

- **`Apps GitOps Config`**: Used for delivering applications belonging to tenants.
- **`Infra GitOps Config`**: Used for delivering cluster scoped resources for application tenants or other services.

You can pick any name for these two repositories as long as they explain the purpose well.

This section is divided into three main parts: Explanations, How-to-Guides, and Tutorials.

## Explanation
Expand All @@ -11,8 +21,6 @@ The explanation contains all the required details that answer the obvious querie

- [Stakater Opinionated GitOps Structure](./explanation/gitops-structure.md): This chapter introduces Stakater's opinionated GitOps structure. It explains how Stakater recommends organizing the GitOps repositories, directory structure, and naming conventions for managing infrastructure and application configurations with the deployment manifests.

- [Pipeline Secrets](./explanation/secrets.md): This chapter covers the important secrets that are necessary to have in the Stakater's deployment pipeline process.

- [Types of Environments](./explanation/types-of-environments.md): This chapter explores different environments involved in Stakater's application delivery.

- [Stakater Tekton Chart](./explanation/stakater-tekton-chart.md): This chapter focuses on Stakater's Tekton Chart, which is a Helm chart designed to streamline the configurations and components needed by Tekton pipelines for building efficient CI/CD.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Creating a backup schedule

Creating a backup schedule for an application using the OpenShift ADP (Application Data Protection) Operator involves several steps. This guide will walk you through the process, from installing the ADP Operator to configuring backup schedules.

## Objectives

- Create a backup schedule for your application
- Restore application

## Key Results

- Application successfully restored using the OADP operator

## Tutorial

### Add Namespace to Tenant

You will need create a TENANT-system namespace for Back and Restore functionality to work.
When the system namespace is added, MTO deploys the OADP operator to the TENANT-system namespace.
Let's see how you can create this namespace.

1. Open up the `infra-gitops-config` repository.

1. Navigate to the folder containing the Tenant definitions.

1. Now open the Tenant to which your application belongs.

1. Under the namespaces, add the 'system' namespace. Commit the change

![tenant system namespace](images/tenant-system.png)

1. After a few, the system namespace should start showing in SAAP. You will also see some pods running in the namespace

![system namespace pods](images/tenant-system-pods.png)

### Create a Backup Schedule

For creating a backup schedule, you will need to deploy the Schedule CR to the TENANT-system namespace
Let us deploy a Backup Schedule for our application

1. Navigate to the application GitOps repository. In your application's environments, add a 'system' environment folder.

![system environment](images/system-folder.png)

1. Next, add the ArgoCD application that points to the above folder.

![ArgoCD application](images/argocd-app.png)

1. Now add the Backup Schedule in the system environment folder. Remember to replace the placeholder values.

```yaml
apiVersion: velero.io/v1
kind: Schedule
metadata:
name: [APPNAME]-backup
namespace: [TENANT]-system
spec:
schedule: * 11 * * *
template:
defaultVolumesToRestic: true
excludedResources:
- daemonsets
- statefulsets
- nodes
- apiservices
- events
- resourcequotas
- controllerrevisions.apps
includedNamespaces:
- [TENANT]-dev
includedResources:
- deployments
- services
- persistentvolumeclaims
- secrets
- configmaps
labelSelector:
matchLabels:
app.kubernetes.io/part-of: [APP-NAME] #Replace this with a label present on your application
snapshotVolumes: true
storageLocation: dpa-1
ttl: 1h0m0s

```

!!! note
In the labelSelector field, add a common label that is present on all the resources of your application

1. Once ArgoCD syncs the changes, you should be able to see Schedule CR on the cluster. It should show as 'Enabled'.

![schedule](images/schedule.png)

1. When the scheduled time arrives, a backup will be automatically created and stored in the designated storage location configured by the SAAP Admin. For the purpose of this tutorial, we are using AWS S3 buckets to store the backups.

### Restore Application from Backup

1. To restore the application, you will simply need to deploy the Restore CR to `tenant-system` namespace.
Here's a sample configuration:

```yaml
apiVersion: velero.io/v1
kind: Restore
metadata:
name: arsenal-dev-restore
namespace: arsenal-system
spec:
backupName: ""
includedNamespaces:
- [TENANT]-dev
itemOperationTimeout: 4h0m0s
restorePVs: true
scheduleName: [SCHEDULE-NAME]
```
Remember to replace the placeholder values.
![restore](images/restore-cr.png)
!!! note
When restoring using a schedule, the `backupName` should be empty. OADP will automatically replace it with the latest backup.

1. Once the Restore CR is created, you will see the Restore showing 'InProgress'. After the Backup is complete, the status will show as complete.

![restore](images/restore.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion theme_override/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ nav:
- Explanation:
- for-delivery-engineers/explanation/gitops-intro.md
- for-delivery-engineers/explanation/gitops-structure.md
- for-delivery-engineers/explanation/secrets.md
- for-delivery-engineers/explanation/types-of-environments.md
- for-delivery-engineers/explanation/stakater-tekton-chart.md
- for-delivery-engineers/explanation/faq.md
Expand Down Expand Up @@ -113,6 +112,7 @@ nav:
- for-developers/tutorials/inner-loop/add-grafana-dashboard/add-grafana-dashboard.md
- for-developers/tutorials/inner-loop/scale-app/scale-app.md
- for-developers/tutorials/inner-loop/validate-auto-reload/validate-auto-reload.md
- for-developers/tutorials/inner-loop/add-backup-schedule/backup-restore.md
- for-developers/tutorials/inner-loop/add-pdb/add-pdb.md
- for-developers/tutorials/inner-loop/add-network-policy/add-network-policy.md
- for-developers/tutorials/inner-loop/tilt-zero-to-hero/step-by-step-guide.md
Expand Down

0 comments on commit f24d8f1

Please sign in to comment.