Merge pull request #975 from hedgedoc/docs/mediaBackends

Docs: Add Azure, Filesystem, Imgur and S3
This commit is contained in:
Yannick Bungers 2021-03-06 17:59:13 +01:00 committed by GitHub
commit 32a6823314
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 71 additions and 0 deletions

View file

@ -0,0 +1,21 @@
# Azure Blob Storage
You can use [Microsoft Azure Blob Storage](https://azure.microsoft.com/services/storage/blobs/) to handle your image uploads in HedgeDoc.
All you need to do is to get the [connection string](https://docs.microsoft.com/azure/storage/common/storage-account-keys-manage) for your storage account and create a storage container with public access set to 'blob'.
It's possible to create the container with the [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli), using your connection string, with the following command:
```
az storage container create --name <NAME> --public-access blob --connection-string "<CONNECTION_STRING>"
```
You can of course also create the container in the Azure portal if you prefer.
Then you just add the following lines to your configuration:
<small>(with the appropriate substitution for `<CONNECTION_STRING>` and `<NAME>` of course)</small>
```
HD_MEDIA_BACKEND="azure"
HD_MEDIA_BACKEND_AZURE_CONNECTION_STRING="<CONNECTION_STRING>"
HD_MEDIA_BACKEND_AZURE_CONTAINER="<NAME>"
```

View file

@ -0,0 +1,12 @@
# Filesystem
You can use your local filesystem to handle your image uploads in HedgeDoc.
You just add the following lines to your configuration:
<small>(with the appropriate substitution for `<DIRECTORY>` of course)</small>
```
HD_MEDIA_BACKEND="filesystem"
HD_MEDIA_BACKEND_FILESYSTEM_UPLOAD_PATH="<DIRECTORY>"
```
Please make sure that the user that runs HedgeDoc is able to write to the uploads directory.

View file

@ -0,0 +1,19 @@
# Imgur
You can use [Imgur](https://imgur.com) to handle your image uploads in HedgeDoc.
All you need for that is to register an application with Imgur and get a client id:
1. Create an account on imgur.com and log in.
2. Go to <https://api.imgur.com/oauth2/addclient>
3. Fill out the form and choose "Anonymous usage without user authorization" as the authorization type.
4. Imgur will then show you your client id.
Then you just add the following lines to your configuration:
<small>(with the appropriate substitution for `<IMGUR_CLIENT_ID>` of course)</small>
```
HD_MEDIA_BACKEND="imgur"
HD_MEDIA_BACKEND_IMGUR_CLIENT_ID="<IMGUR_CLIENT_ID>"
```
All uploads are saved in the `media_uploads` database table and contain the deletion token ([see here](https://apidocs.imgur.com/#949d6cb0-5e55-45f7-8853-8c44a108399c)) in the column `backendData`.

19
docs/content/media/s3.md Normal file
View file

@ -0,0 +1,19 @@
# S3-compatible
You can use [Amazon S3](https://aws.amazon.com/s3/) or any other S3-compatible storage (like [MinIO](https://min.io) or [Ceph Object Gateway](https://docs.ceph.com/en/latest/radosgw/)) to handle your image uploads in HedgeDoc.
Your S3 bucket must be configured to be writeable.
You just add the following lines to your configuration:
<small>(with the appropriate substitution for `<ACCESS_KEY>`, `<SECRET_KEY>`, `<BUCKET>`, and `<ENDPOINT>` of course)</small>
```
HD_MEDIA_BACKEND="s3"
HD_MEDIA_BACKEND_S3_ACCESS_KEY="<ACCESS_KEY>"
HD_MEDIA_BACKEND_S3_SECRET_KEY="<SECRET_KEY>"
HD_MEDIA_BACKEND_S3_BUCKET="<BUCKET>"
HD_MEDIA_BACKEND_S3_ENDPOINT="<ENDPOINT>"
```
If you use Amazon S3, `<ENDPOINT>` should contain your [Amazon Region](https://docs.aws.amazon.com/general/latest/gr/s3.html).
For example: If your Amazon Region is `us-east-2`, your endpoint `<ENDPOINT>` should be `s3.us-east-2.amazonaws.com`.