Skip to content
FEMNET

Back up and restore data

Back up the database and media, and restore them.

IT teamDone in: Server4 steps
  1. 1

    Back up the database

    From /opt/femnet-lms-drf:

    docker compose exec postgres pg_dump -U femnet -d femnet > dumps/femnet-$(date +%Y%m%d).sql

    Schedule this daily with cron and copy the files off the server.

  2. 2

    Back up media and settings

    Copy the media folder (/opt/femnet-lms-drf/media) and the .env file. Without the media folder, course pictures and packages are lost.

  3. 3

    Restore the database

    Stop the app containers: docker compose stop drf celery_worker celery_beat. Then load the dump:

    docker compose exec -T postgres psql -U femnet -d femnet < dumps/<file>.sql

    Restore into an empty database to avoid conflicts, then start the containers again.

  4. 4

    Test your backups

    Every few months, restore a backup onto a test machine and sign in to prove it works.

Related how-tos