Updating, Backups, Restores

Updating to a New Hudu Version

Before updating, always make sure you have a current backup. Plan for about 5-10 minutes of downtime. You can update your Hudu instance to a new version by:

Run cd ~/hudu2 && sudo docker-compose down && sudo docker-compose pull && sudo docker-compose up -d

Backups

There are two aspects of Hudu you will need to backup. The first is your database. There are multiple ways to automatically backup Postgres databases. One simple way is to add to the end of your docker-compose.yml:

  pgbackups3:
    image: hududocker/postgresql-backup-s3
    restart: unless-stopped
    links:
      - db
    environment:
      SCHEDULE: '@every 6h'
      S3_PREFIX: 'backup'
      S3_ENDPOINT: 'https://s3.us-west-1.wasabisys.com'
      S3_REGION: 'us-west-1'
      S3_ACCESS_KEY_ID: 'XXXX'
      S3_SECRET_ACCESS_KEY: 'XXXXXXXX'
      S3_BUCKET: 'bucketname'
      POSTGRES_DATABASE: 'hudu_production'
      POSTGRES_USER: 'postgres'
      POSTGRES_PASSWORD:
      POSTGRES_HOST: 'db'
      POSTGRES_EXTRA_OPTS: '--schema=public --blobs'

You will need to manually verify the integrity of these backups.

The other aspect you need to backup is object storage for your uploaded files. You can use s3cmd, awscli, and more to do this. Here is an example that will backup your files to your local system, using awscli:

  aws s3 sync s3://your-bucket-name /home/ubuntu/s3/your-bucket-name/

Restoring a database backup

Once you have a database backup, you can restore your Hudu instance to the old backup by following these steps:

  1. Make sure you have an up-to-date backup of your documentation before you begin.
  2. Move the .sql database dump file into the ~/hudu2 directory. Typically, the easiest way to move files is via SCP or SFTP.
  3. Run sudo docker-compose down to bring your instance down.
  4. Run sudo docker-compose up -d db
  5. Run the command: sudo docker-compose exec db dropdb hudu_production -U postgres
  6. Run the command: sudo docker-compose exec db createdb hudu_production -U postgres
  7. Run the command: cat NAME-OF-DUMP.sql | sudo docker-compose exec -T db psql -d hudu_production -U postgres
  8. Run sudo docker-compose down
  9. Run sudo docker-compose up -d to get your instance back up and running!

Lock Down Your Instance

Create firewall rules to only allow ports 80 and 443. You can also use a service like Cloudflare to further lock down your instance and protect from outside threats.

Scaling

As the number of documentation and integrations utilized grows, the #1 cause of slowness in your Hudu instance on your instance is memory. If you want to speed up your instance, increase the memory.