Git Product home page Git Product logo

notion-backup's Introduction

notion-backup

example workflow name

Automatically backup your Notion workspace to Google Drive, Dropbox, Nextcloud or to your local machine.

Set Credentials

Create a .env file with the following properties (How do I find all these values?):

# Make sure not to use any quotes around these environment variables

# Notion (Required)
NOTION_SPACE_ID=
NOTION_EMAIL=
NOTION_PASSWORD=
# Options: markdown, html (default is markdown)
NOTION_EXPORT_TYPE=markdown

# Google Drive (Optional)
GOOGLE_DRIVE_ROOT_FOLDER_ID=
GOOGLE_DRIVE_SERVICE_ACCOUNT=
# Provide either secret json or the path to the secret file
GOOGLE_DRIVE_SERVICE_ACCOUNT_SECRET_JSON=
GOOGLE_DRIVE_SERVICE_ACCOUNT_SECRET_FILE_PATH=

# Dropbox (Optional)
DROPBOX_ACCESS_TOKEN=

# Nextcloud (Optional)
NEXTCLOUD_EMAIL=
NEXTCLOUD_PASSWORD=
NEXTCLOUD_WEBDAV_URL=

Backup to Cloud With Docker

Once you created your .env file, you can run the following command to start your backup:

docker run \
    --rm=true \
    --env-file=.env \
    jckleiner/notion-backup

The downloaded Notion export file will be saved to the /downloads folder within the Docker container and the container will be removed after the backup is done (because of the --rm=true flag).

If you want automatic backups in regular intervals, you could either set up a cronjob on your local machine or fork this repo and let GitHub Actions do the job.

Local Backup With Docker

If you want to keep the downloaded files locally, you could mount the /downloads folder from the container somewhere on your machine:

docker run \
    --rm=true \
    --env-file=.env \
    -v <backup-dir-absolute-path-on-your-machine>:/downloads \
    jckleiner/notion-backup

If you want automatic backups in regular intervals, you could either set up a cronjob on your local machine or fork this repo and let GitHub Actions do the job.

Fork (GitHub Actions)

Another way to do automated backups is using GitHub Actions. You can simply:

  1. Fork this repository.
  2. Create repository secrets: Go to notion-backup (your forked repo) > Settings > Secrets > Actions and create all the necessary environment variables.
  3. Go to notion-backup (your forked repo) > Actions to see the workflows and make sure the notion-backup-build-run workflow is enabled. This is the workflow which will periodically build and run the application.
  4. You can adjust when the action will be triggered by editing the schedule > cron property in your notion-backup/.github/workflows/build-run.yml workflow file (to convert time values into cron expressions: crontab.guru).

That's it. GitHub Actions will now run your workflow regularly at your defined time interval.

Troubleshooting

Dropbox

If you get the exception: com.dropbox.core.BadResponseException: Bad JSON: expected object value., then try to re-generate your Dropbox access token and run the application again.

notion-backup's People

Contributors

jckleiner avatar

Stargazers

Joseph Hosseini avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.