You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create additional users through the admin interface (/admin).
71
+
## Database Backup and Restore
72
+
73
+
COSMOS provides dedicated management commands for backing up and restoring your PostgreSQL database. These commands handle both compressed and uncompressed backups and work seamlessly in both local and production environments using Docker.
74
+
75
+
### Backup Directory Structure
72
76
73
-
### Database Backup and Restore
77
+
All backups are stored in the `/backups` directory at the root of your project. This directory is mounted as a volume in both local and production Docker configurations, making it easy to manage backups across different environments.
74
78
75
-
COSMOS provides dedicated management commands for backing up and restoring your PostgreSQL database. These commands handle both compressed and uncompressed backups and automatically detect your server environment from your configuration.
docker-compose -f local.yml run --rm django python manage.py database_restore local-backup.sql.gz
148
+
docker-compose -f local.yml run --rm django python manage.py database_restore backups/backup_name.sql.gz
142
149
```
143
150
144
-
#### Alternative Methods
145
-
146
-
While the database_backup and database_restore commands are the recommended approach, there are alternative methods available:
151
+
### Alternative Methods
147
152
148
-
##### Using JSON Fixtures (for smaller datasets)
149
-
If you're working with a smaller dataset, you can use Django's built-in fixtures:
153
+
While the database_backup and database_restore commands are the recommended approach, you can also use Django's built-in fixtures for smaller datasets:
docker-compose -f local.yml run --rm django python manage.py loaddata /path/to/backup.json
164
+
docker-compose -f local.yml run --rm django python manage.py loaddata backups/backup_name.json
161
165
```
162
166
163
167
Note: For large databases (>1.5GB), the database_backup and database_restore commands are strongly recommended over JSON fixtures as they handle large datasets more efficiently.
0 commit comments