Use Google Cloud Storage Instead of S3

I saw another post about this from '14 - but no answer and it seemed like they were making this harder than it should be…

I would like some pointers to see if there is an AWS endpoint configuration within app.yml which could be changed to allow use of google cloud storage instead of s3 - GCS has a compatability mode where all - as I understand it - would need to happen is to change the AWS endpoint:

In your existing tools or libraries, make the following changes:
Change the request endpoint to use the Google Cloud Storage request endpoint.
Replace the Amazon Web Services (AWS) access and secret key with the corresponding Google Cloud Storage access key and secret key (collectively called your Google developer key).

This could be added as an option under /admin/site_settings/category/files and option for AWS endpoint along with the access keys? or can it be done in the app.yml? [AWS_ENDPOINT = “/xxxx/xxx”] already?

Thanks!

2 „Gefällt mir“

I ended up doing this, just to get it working:

/bin/bash
 This script will copy the latest discourse backup to google cloud
 Then it will remove the previous backup from google cloud

LATESTBACKUP=`ls /var/discourse/shared/standalone/backups/default/*.gz -t1 | head -n1`
PREVBACKUPWDIR=`ls /var/discourse/shared/standalone/backups/default/*.gz -1tr | head -1`
PREVBACKUP=`find $PREVBACKUPWDIR -exec basename {} \;`

/home/user/gsutil/gsutil cp $LATESTBACKUP gs://yyh-community-backups
/home/user/gsutil/gsutil rm gs://your-backup-bucket/$PREVBACKUP

Which works, but I still think greater use of google cloud storage could be used with the s3 compatibility mode as described above. But maybe I’m the only one who wants to use non amazon tools.

3 „Gefällt mir“

It’d be great to have a few options “out of the box”!

Hallo

Ich teste das GCS-Backup mit der Standardkonfiguration.

DISCOURSE_S3_BACKUP_BUCKET: falcoland-files/backup
DISCOURSE_BACKUP_LOCATION: s3

und füge eine spezielle Richtlinie für GCS hinzu:

policy = {
    "serviceAccount:${google_service_account.discourse.email}" = [
      "roles/storage.legacyBucketOwner"
    ]
  }

Es funktioniert erfolgreich, das Backup an GCS zu senden.

Ich hoffe, das hilft jemandem wie mir, der eine Woche damit verbracht hat, dies einzurichten.

GCS Storage

6 „Gefällt mir“

Das klingt vielleicht etwas paranoide, aber ich speichere Discourse-Backups auf AWS S3 (was von Haus aus unterstützt wird) und synchronisiere diese dann von S3 zu GCS mit:

Keine Programmierung erforderlich. Das erhöht zwar deine Speicherkosten geringfügig, hilft also nicht, wenn du Geld sparen möchtest. Ich bewahre die letzten 10 Backups auf, jedes hat 10 GB, und das kostet mich bei Google 3 $ pro Monat.