-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from theanupambista/main
Refactor: Cli configured according to yaml and used vitepress for documentation of each command
- Loading branch information
Showing
39 changed files
with
5,359 additions
and
521 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Deploy VitePress site to Pages | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- "docs/**" # Only trigger when files in the docs/ directory change | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
concurrency: | ||
group: pages | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# Build job | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Not needed if lastUpdated is not enabled | ||
- uses: pnpm/action-setup@v3 # Uncomment this if you're using pnpm | ||
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: pnpm # or pnpm / yarn | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
- name: Install dependencies | ||
run: pnpm install # or pnpm install / yarn install / bun install | ||
- name: Build with VitePress | ||
run: pnpm docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: docs/.vitepress/dist | ||
|
||
# Deployment job | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
needs: build | ||
runs-on: ubuntu-latest | ||
name: Deploy | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,14 +23,11 @@ destinations: | |
smtp_port: 587 | ||
smtp_username: | ||
smtp_password: | ||
|
||
notifications: | ||
email: | ||
enabled: false | ||
from: [email protected] | ||
to: | ||
- [email protected] | ||
|
||
notifications: | ||
slack: | ||
enabled: true | ||
webhook_url: https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXXXXX | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { defineConfig, type DefaultTheme } from "vitepress"; | ||
|
||
// https://vitepress.dev/reference/site-config | ||
export default defineConfig({ | ||
base: "/BackupDBee/", | ||
title: "BackupDBee 🐝", | ||
description: "Automatic CLI Based Advance DB Backup System", | ||
themeConfig: { | ||
// https://vitepress.dev/reference/default-theme-config | ||
nav: [ | ||
{ text: "Home", link: "/" }, | ||
{ | ||
text: "Guide", | ||
link: "/guide/what-is-backupdbee", | ||
activeMatch: "/guide/", | ||
}, | ||
], | ||
|
||
sidebar: { | ||
"/guide/": { base: "/guide/", items: sidebarGuide() }, | ||
}, | ||
|
||
socialLinks: [ | ||
{ icon: "github", link: "https://github.com/28softwares/BackupDBee" }, | ||
], | ||
}, | ||
}); | ||
|
||
function sidebarGuide(): DefaultTheme.SidebarItem[] { | ||
return [ | ||
{ | ||
text: "Introduction", | ||
collapsed: false, | ||
items: [ | ||
{ text: "What is backupdbee?", link: "what-is-backupdbee" }, | ||
{ text: "Getting Started", link: "getting-started" }, | ||
{ text: "Configuration", link: "configuration" }, | ||
], | ||
}, | ||
{ | ||
text: "Cli Commands", | ||
collapsed: false, | ||
items: [ | ||
{ text: "general", link: "cli/general" }, | ||
{ text: "db:list", link: "cli/db-list" }, | ||
{ text: "db:backup", link: "cli/db-backup" }, | ||
], | ||
}, | ||
{ | ||
text: "Automation", | ||
link: "automate-backup", | ||
}, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
outline: deep | ||
--- | ||
|
||
# Runtime API Examples | ||
|
||
This page demonstrates usage of some of the runtime APIs provided by VitePress. | ||
|
||
The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files: | ||
|
||
```md | ||
<script setup> | ||
import { useData } from 'vitepress' | ||
|
||
const { theme, page, frontmatter } = useData() | ||
</script> | ||
|
||
## Results | ||
|
||
### Theme Data | ||
<pre>{{ theme }}</pre> | ||
|
||
### Page Data | ||
<pre>{{ page }}</pre> | ||
|
||
### Page Frontmatter | ||
<pre>{{ frontmatter }}</pre> | ||
``` | ||
|
||
<script setup> | ||
import { useData } from 'vitepress' | ||
|
||
const { site, theme, page, frontmatter } = useData() | ||
</script> | ||
|
||
## Results | ||
|
||
### Theme Data | ||
<pre>{{ theme }}</pre> | ||
|
||
### Page Data | ||
<pre>{{ page }}</pre> | ||
|
||
### Page Frontmatter | ||
<pre>{{ frontmatter }}</pre> | ||
|
||
## More | ||
|
||
Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Automate Backup | ||
|
||
You can use process managers to automate your backup | ||
|
||
```bash | ||
pm2 start ts-node index.ts db:backup --name dbbackup --cron "* * * * *" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# `db:backup` Command Documentation | ||
|
||
The `db:backup` command is used to back up all databases defined in the YAML configuration or specific ones using the `--name` flag. You can pass multiple databases to `--name` flag by providing a comma-separated list of database names. | ||
|
||
## Usage | ||
|
||
### Backup All Databases | ||
|
||
To back up all databases, simply run the following command: | ||
|
||
```bash | ||
ts-node index.ts db:backup | ||
``` | ||
|
||
### Backup Specific Database(s) | ||
|
||
To back up one or more specific databases, use the `--name` flag followed by the database name(s). You can provide a single database name or multiple names separated by commas. | ||
|
||
#### Backup a Single Database: | ||
|
||
```bash | ||
ts-node index.ts db:backup --name <database_name> | ||
``` | ||
|
||
#### Backup Multiple Databases: | ||
|
||
```bash | ||
ts-node index.ts db:backup --name <database_name_1>,<database_name_2>,<database_name_3> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# `db:list` Command Documentation | ||
|
||
The `db:list` command lists all the databases defined in the YAML configuration file and shows the total count of databases. | ||
|
||
## Usage | ||
|
||
Run the following command in your terminal: | ||
|
||
```bash | ||
ts-node index.ts db:list | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# `general` Command Documentation | ||
|
||
The `general` command is used to configure the general settings of your `backupdbee.yaml` file. You can either use flags to update specific settings or use an interactive mode where you'll be prompted to provide input. | ||
|
||
## Command: `general` | ||
|
||
```bash | ||
ts-node index.ts general [options] | ||
``` | ||
|
||
### Description | ||
|
||
The `general` command allows you to modify the following general settings in the `backupdbee.yaml` file: | ||
|
||
- Backup location | ||
- Log location | ||
- Log level (INFO, DEBUG, ERROR) | ||
- Retention policy (number of days) | ||
- Backup schedule (in cron format) | ||
|
||
You can configure each setting individually using the provided flags or choose to use the interactive mode (i.e., no flags) to update settings step-by-step. | ||
|
||
--- | ||
|
||
## Flags | ||
|
||
Below is a table describing each flag you can use with the `general` command. | ||
|
||
| Flag | Description | Example Command | | ||
| -------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------- | | ||
| `--backup-location` | Specify the directory where backups will be stored. | `ts-node index.ts general --backup-location "/path/to/backups"` | | ||
| `--log-location` | Set the directory where logs will be stored. | `ts-node index.ts general --log-location "/path/to/logs"` | | ||
| `--log-level` | Set the log verbosity level. Accepts values: `INFO`, `DEBUG`, `ERROR`. | `ts-node index.ts general --log-level DEBUG` | | ||
| `--retention-policy` | Specify how many days backups will be retained. Takes a number as an input. | `ts-node index.ts general --retention-policy 10` | | ||
| `--backup-schedule` | Set the cron schedule for automatic backups. | `ts-node index.ts general --backup-schedule "0 3 * * *"` | | ||
|
||
--- | ||
|
||
## Interactive Mode | ||
|
||
If no flags are provided, the `general` command will enter an interactive mode, where you will be prompted to input values for each setting. |
Oops, something went wrong.