Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dreipol/django-green-grove
Collection of helpers to back up Django projects that use a Postgres database and a S3 bucket as media storage.
https://github.com/dreipol/django-green-grove
Last synced: 7 days ago
JSON representation
Collection of helpers to back up Django projects that use a Postgres database and a S3 bucket as media storage.
- Host: GitHub
- URL: https://github.com/dreipol/django-green-grove
- Owner: dreipol
- License: mit
- Created: 2017-06-28T12:55:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-26T20:29:23.000Z (almost 2 years ago)
- Last Synced: 2024-11-05T18:58:08.345Z (10 days ago)
- Language: Python
- Size: 15.6 KB
- Stars: 2
- Watchers: 6
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
Awesome Lists containing this project
README
==================
django-green-grove
==================Collection of helpers to back up Django projects that use a Postgres database and a S3 bucket as media storage.
Quickstart
----------Install django-green-grove using pip::
pip install django-green-grove
Add the following to your ``settings.py`` module::
BACKUP_BUCKET_AWS_ACCESS_KEY_ID = ''
BACKUP_BUCKET_AWS_SECRET_ACCESS_KEY = '
BACKUP_BUCKET_BUCKET_NAME = ''
BACKUP_BUCKET_LOCATION = ''Backup Project
--------------We suggest to use this management command as a cron tab::
python manage.py backup_project
Tutorial
--------This tutorial covers the steps that are needed to backup and restore a Django project that uses a Dokku hosting with a Postgres database and a S3 Bucket as media storage.
**Backup project**
1. Connect to your server
2. Connect to the docker container: ``dokku enter ``
3. ``python manage.py backup_project``**Restore from backup**
1. Connect to your server
2. Connect to the database: ``dokku postgres:connect db``
3. Drop the database: ``DROP DATABASE ;``
4. Recreate the database: ``CREATE DATABASE ;``
5. Grant privileges: ``GRANT ALL PRIVILEGES ON DATABASE to ;``
6. Exit the postgres console and the session on the server
7. Download the database dump file from the bucket to your local machine: ``s3cmd cp .``
8. Move the dump file to the server: ``scp ``
9. Connect to your server
10. Import the dump: ``cat | sudo docker exec -i dokku.postgres.db psql -U ``
11. Remove the media folder of your bucket (s3cmd or web interface)
12. Open up the terminal on your local machine
13. Copy the backup of the media folder back to the bucket:
``s3cmd cp --recursive --acl-public s3://backups///media/ s3:///media/``Trivia
------This package is named after the fictional retirement community where Tony Soprano, Paulie Gualtieri, and other Mafiosi admit their mothers, in The Sopranos.
Credits
-------Tools used in rendering this package:
* Cookiecutter_
* `cookiecutter-djangopackage`_.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage