This project creates a backup of a MySQL database and uploads it to Google Cloud Storage. It can be run periodically to back up your database in .sql
format. After creating the backup, it uploads the file to Google Cloud Storage and deletes the local copy.
- Backups a MySQL database.
- Uploads the backup file to Google Cloud Storage.
- Deletes the local backup file after uploading it.
- Configurable through environment variables in a
.env
file.
- Deno (This project is written with Deno.js)
- A Google Cloud Storage account and service account key
- A MySQL database
- Go to the Google Cloud Console and create a new project.
- Enable the Google Cloud Storage API.
- Create an API key and download it as a JSON file. Save this file as
gcs_key.json
in your project.
After setting up your Google Cloud API, you need to configure the environment variables.
- In the root directory of your project, rename the
.env.example
file as.env
. - Edit the following environment variables to the
.env
file, replacing the placeholders with your actual values:
# MySQL
DB_HOST=artren.ddns.net:3306
DB_USER=artren
DB_PASSWORD=verysecretpassword
DB_NAME=quiltauth
# Google Cloud Storage
GCS_KEY_FILE=./serviceKey.json
GCS_PROJECT_ID=quilt-anarchy
GCS_BUCKET_NAME=quilt-auth