Sign inSign up

mathiasws/overleaf-backup

By mathiasws

Updated over 1 year ago

A Python script that takes backup of all your Overleaf projects to GitLab.

Image
0

2.6K

mathiasws/overleaf-backup repository overview

overleaf-backup

release pipeline license docker docker

This script aims to clone and sync all Overleaf projects connected to your account and sync them to GitLab. The script works by using Selenium to log in to Overleaf and fetch the list of projects. The list of projects is then parsed to get the ids and the name of the projects. Using git, the projects are downloaded to a local directory. If a GitLab repository does not exist for the project, one is automatically created. The GitLab repo is then added as a remote and then a push is done to this remote. This creates a backup of all Overleaf projects to GitLab.

Known issues

  • Sometimes captcha is required to log in to Overleaf. (This does not seem to be an issue from the NTNU network)
  • Some shared projects require some manual interaction before it can be cloned.

Installation

Docker

A Docker container is provided that runs the script. The imaged can be fetched from Docker hub. The image is called mathiasws/overleaf-backup.

Local

To run the script locally, some more steps are required.

  1. Clone the repository:

git clone https://gitlab.com/mathias_ws/overleaf-backup.git

  1. Install the required packages:

For the script to work, google chrome and the chromedriver needs to be installed. Additionally, the required python packages must be installed. It is recommended to use a virtual environment.

pip install venv
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
  1. Set the required environment variables

  2. Run the script:

python -m overleaf_backup

Configuration

All configurations for this script is done through environment variables.

VariableDescriptionRequiredDefault
OVERLEAF_URLUrl to Overleaf instance.Nohttps://www.overleaf.com
OVERLEAF_GIT_URLGit url to Overleaf instance.Nohttps://[email protected]
OVERLEAF_USERNAMEOverleaf username.YesNA
OVERLEAF_PASSWORDOverleaf password.YesNA
OVERLEAF_GIT_TOKENGit token provided by Overleaf.Yes
GITLAB_URLUrl to GitLab instance.Nohttps://gitlab.com
GITLAB_USERNAMEGitLab username.YesNA
GITLAB_ACCESS_TOKENAccess token to GitLab, must have api rights.YesNA
GITLAB_GROUPName of GitLab group to use, if not set the default namespace (username) is used.NoNA
LEVELThe logging level.Noinfo

Contribution

All contributions and issues are welcome. When implementing features and creating Merge Requests, please ensure that your commits follows the commit message format required by semantic-release. This will ensure that the version and changelog is automatically updated.

Tag summary

Content type

Image

Digest

sha256:e8984eb99

Size

296.4 MB

Last updated

almost 2 years ago

docker pull mathiasws/overleaf-backup