logo-color
← Go Back

Maintenance of Your Hudu Instance

Updating to a New Hudu Version

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

  1. Run sudo docker-compose down to bring the instance down.
  2. Run sudo docker-compose pull to pull the latest version.
  3. Run sudo docker-compose up to start the server again.

Storing Your .env File

It is absolutely critical that you store multiple copies of your .env file in secure locations as they contain your encryption keys.

SSL Certificate Renewal

By default, the Hudu server will run a renewal process for your certificate. However, if for some reason this does not work, you can run (in the ~/hudu2 directory)

sudo docker-compose up -d
wait for it to get up and running and then type:
docker exec -it letsencrypt /app/le-renew.sh

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.