A Python script that takes backup of all your Overleaf projects to GitLab.
2.6K
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.
A Docker container is provided that runs the script. The imaged can be fetched from Docker hub.
The image is called mathiasws/overleaf-backup.
To run the script locally, some more steps are required.
git clone https://gitlab.com/mathias_ws/overleaf-backup.git
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
Set the required environment variables
Run the script:
python -m overleaf_backup
All configurations for this script is done through environment variables.
| Variable | Description | Required | Default |
|---|---|---|---|
| OVERLEAF_URL | Url to Overleaf instance. | No | https://www.overleaf.com |
| OVERLEAF_GIT_URL | Git url to Overleaf instance. | No | https://[email protected] |
| OVERLEAF_USERNAME | Overleaf username. | Yes | NA |
| OVERLEAF_PASSWORD | Overleaf password. | Yes | NA |
| OVERLEAF_GIT_TOKEN | Git token provided by Overleaf. | Yes | |
| GITLAB_URL | Url to GitLab instance. | No | https://gitlab.com |
| GITLAB_USERNAME | GitLab username. | Yes | NA |
| GITLAB_ACCESS_TOKEN | Access token to GitLab, must have api rights. | Yes | NA |
| GITLAB_GROUP | Name of GitLab group to use, if not set the default namespace (username) is used. | No | NA |
| LEVEL | The logging level. | No | info |
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.
Content type
Image
Digest
sha256:e8984eb99…
Size
296.4 MB
Last updated
almost 2 years ago
docker pull mathiasws/overleaf-backup