Trouble with multisite backups on S3--backups stored in root

I’ve got a multisite instance on an AWS EC2. I have backups configured like this:


Backups for the multisite instances are being stored in the bucket root, but not showing up in the list in the UX. Backups for the main site are stored under default as expected. This means that backups are invisible from restore and not pruned according to settings.

The multisite stanza looks ike this:

           adapter: postgresql
           database: site
           pool: 25
           timeout: 5000
           host: data
           password: secret

Could it be that if DISCOURE_USE_S3 isnt’ set that backups end up in the wrong place? (I tried setting use_s3 in discourse.conf, but didn’t restart unicorn, but instead ran a command line backup and it still stuck it in the root, not in the name of the sub-site).

There was some issue with uploads on S3 (bucket misconfiguration, perhaps), so S3 is for backups only.

1 Like

I spent another hour and a half on this.

One of the multisite sites is correctly putting its uploads backups in the correct directory, but two aren’t.

The ones that are not going the right place had databases restored from a single-site instance, so my guess is that there is something in the database that is forcing the backup to go in the root of the backup folder rather than the site name (or default for the default site).

@gerhard sorry to bother you, but would you mind giving this a quick look to see if there’s something glaringly silly that I’m overlooking?

Yes, the upload storage is by design , if a backup was from a single site instance it is restored differently.

      was_multisite = BackupMetadata.value_for("multisite") == "t"
      upload_path = "/#{}/"
      uploads_folder = was_multisite ? "/" : upload_path

But wasn’t this about where the backups were put, not about where images are restored?

1 Like


That is right.

But oops:

As I (corretly) said earlier this instance is (currently?) using S3 for backups only and not uploads.

It’s the backups for 2 of 3 sub-sites that are being put in the root of the backup bucket. The primary site is pushing them to default as expected, and one of the multisite instances is pushing them to th e sitename directory.

1 Like

Hmm, that’s a weird behavior. Do you mean backups which are uploaded from within the browser or backups created by the system?

I don’t see a reason why backups created by the system would end up at the wrong place. The code looks quite straightforward.

s3_helper gets configured with the correct bucket and multisite name.

I mean that making a backup from either the web interface or the rake task for two of the 3 multisite hosts (that were both migrated from another server) uploads the backup to the root of the backup s3 bucket rather than into sitename/backupname.

It seems bizarre to me too.

I’ll try adding some puts to those functions to see if I can track it down.

I think that I did puts the source_path and it had the correct full path in the OS, but when it gets uploaded to S3, the sitename is no longer in the path.

I’ll look more closely again next week. The backups are there, they just aren’t where Discourse will find them.