# Usage

This documentation will guide you on how to properly set up your **bqckup**.

**Step 1:** Create config for the storages

{% hint style="info" %}
Currently, storage only supports the S3 protocol.
{% endhint %}

Storage Config Stored in `/etc/bqckup/config/storage.yml`

```yaml
storages:
  ojtbackup:
    bucket: ${BUCKET_NAME}
    access_key_id: ${ACCESS_KEY}
    secret_access_key: ${SECRET_KEY}
    region: ${REGION}
    endpoint: ${ENDPOINT_URL}
    primary: yes
```

There is also an option for remote storage, which you can [read it here](/bqckup-documentation/storages/remote-storage.md).

***

**Step 2:** Create config for your backup

{% hint style="info" %}
There are 2 backup methods: conventional and incremental. The conventional method simply compresses your files into a `.tar.gz` archive and uploads it to the server.
{% endhint %}

The configuration can be created in `/etc/bqckup/sites/your-config-name.yml`.

{% code title="/etc/bqckup/sites/mywebsite.yml" %}

```yaml
bqckup:
  name: ${name}
  path:
    - ${path}
  databases:
    - enabled: yes
      type: mysql # Currently only support mysql
      host: localhost
      port: 3306
      user: ${db_user}
      password: ${db_password}
      name: ${db_name}
  options:
    storage: ${storage_name} # can be found at /etc/bqckup/config/storages.yml
    interval: daily # daily | weekly | monthly
    retention: 7
    keep:
      daily: 7
      weekly: 4
      monthly: 4
    save_locally: no # It will not delete your backup after it has been uploaded.
    save_locally_path: /home/user/_backups
    provider: s3
```

{% endcode %}

If it’s incremental, you can append this

```yaml
  incremental:
    enable: yes
    password: mystrongpassword
```

{% hint style="warning" %}
In the background, **bqckup** uses **rustic** for incremental backups, so you need to [install rustic](https://rustic.cli.rs/docs/installation.html) to make the incremental backup work.
{% endhint %}

***

**Step 3:** Run the bqckup

After completing those setups, run **bqckup** using the following command:

```shell
bqckup run
```

***

**Step 4:** Create a cron job to schedule your backup.

If you want it to be executed daily, for example, create a cron job by adding a script inside `/etc/cron.daily/bqckup`.

Command:

```sh
touch /etc/cron.daily/bqckup && chmod +x /etc/cron.daily/bqckup
```

and the content:

{% code title="/etc/cron.daily/bqckup" %}

```sh
/usr/bin/bqckup run >> /var/log/bqckup.log 2>&1
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bqckup.com/bqckup-documentation/getting-started/first-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
