2020-07-02 15:22:52 +00:00
|
|
|
# Minio Guide for HedgeDoc
|
2018-01-23 10:47:47 +00:00
|
|
|
|
2021-01-13 18:36:45 +00:00
|
|
|
**Note:** *This guide was written before the renaming. Just replace `HackMD` with `HedgeDoc` in your mind 😃 thanks!*
|
2018-06-24 12:04:35 +00:00
|
|
|
|
2018-01-23 10:47:47 +00:00
|
|
|
1. First of all you need to setup Minio itself.
|
|
|
|
|
|
|
|
Please refer to the [official Minio docs](https://docs.minio.io/) for an
|
|
|
|
production setup.
|
|
|
|
|
|
|
|
For checking it out and development purposes a non-persistent setup is enough:
|
2019-03-31 18:10:32 +00:00
|
|
|
```sh
|
2018-01-23 10:47:47 +00:00
|
|
|
docker run --name test-minio --rm -d -p 9000:9000 minio/minio server /data
|
|
|
|
```
|
|
|
|
|
|
|
|
*Please notice this is not for productive use as all your data gets lost
|
|
|
|
when you stop this container*
|
|
|
|
|
|
|
|
2. Next step is to get the credentials form the container:
|
|
|
|
|
2019-03-31 18:10:32 +00:00
|
|
|
```sh
|
2018-01-23 10:47:47 +00:00
|
|
|
docker logs test-minio
|
|
|
|
```
|
|
|
|
|
2019-03-31 14:02:05 +00:00
|
|
|

|
2018-01-23 10:47:47 +00:00
|
|
|
|
2020-07-01 09:52:17 +00:00
|
|
|
3. Open <http://localhost:9000> and login with the shown credentials.
|
2018-01-23 10:47:47 +00:00
|
|
|
|
2019-03-31 14:02:05 +00:00
|
|
|

|
2018-01-23 10:47:47 +00:00
|
|
|
|
2020-07-02 15:22:52 +00:00
|
|
|
4. Create a bucket for HedgeDoc
|
2018-01-23 10:47:47 +00:00
|
|
|
|
2019-03-31 14:02:05 +00:00
|
|
|

|
2018-01-23 10:47:47 +00:00
|
|
|
|
|
|
|
5. Add a policy for the prefix `uploads` and make it read-only.
|
|
|
|
|
2019-03-31 14:02:05 +00:00
|
|
|

|
2018-01-23 10:47:47 +00:00
|
|
|
*Open policy editor*
|
|
|
|
|
2019-03-31 14:02:05 +00:00
|
|
|

|
2018-01-23 10:47:47 +00:00
|
|
|
*Add policy for uploads*
|
|
|
|
|
2020-07-02 15:22:52 +00:00
|
|
|
6. Set credentials and configs for Minio in HedgeDoc's `config.json`
|
2018-01-23 10:47:47 +00:00
|
|
|
|
|
|
|
```JSON
|
|
|
|
"minio": {
|
|
|
|
"accessKey": "888MXJ7EP4XXXXXXXXX",
|
|
|
|
"secretKey": "yQS2EbM1Y6IJrp/1BUKWq2/XXXXXXXXXXXXXXX",
|
|
|
|
"endPoint": "localhost",
|
|
|
|
"port": 9000,
|
|
|
|
"secure": false
|
|
|
|
}
|
|
|
|
```
|
|
|
|
*You have to use different values for `endpoint` and `port` for a production
|
|
|
|
setup. Keep in mind the `endpoint`-address has to be public accessible from
|
|
|
|
your browser.*
|
|
|
|
|
|
|
|
7. Set bucket name
|
|
|
|
|
|
|
|
```JSON
|
2020-07-02 15:22:52 +00:00
|
|
|
"s3bucket": "hedgedoc"
|
2018-01-23 10:47:47 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
8. Set upload type.
|
|
|
|
|
|
|
|
```JSON
|
2018-01-26 13:00:48 +00:00
|
|
|
"imageuploadtype": "minio"
|
2018-01-23 10:47:47 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
9. Review your config.
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
// all your other config…
|
|
|
|
"minio": {
|
|
|
|
"accessKey": "888MXJ7EP4XXXXXXXXX",
|
|
|
|
"secretKey": "yQS2EbM1Y6IJrp/1BUKWq2/XXXXXXXXXXXXXXX",
|
|
|
|
"endPoint": "localhost",
|
|
|
|
"port": 9000,
|
|
|
|
"secure": false
|
|
|
|
},
|
2020-07-02 15:22:52 +00:00
|
|
|
"s3bucket": "hedgedoc",
|
2018-01-26 13:00:48 +00:00
|
|
|
"imageuploadtype": "minio"
|
2018-01-23 10:47:47 +00:00
|
|
|
}
|
|
|
|
```
|
2020-09-22 17:41:15 +00:00
|
|
|
|
|
|
|
10. If you were using filesystem before
|
|
|
|
|
|
|
|
and you want to migrate assets to minio.
|
|
|
|
|
|
|
|
You could use a convenience script located in `bin/migrate_from_fs_to_minio`.
|
|
|
|
|
|
|
|
Be careful, read carefully what it does, it was not tested in all environments.
|
|
|
|
|
2021-01-11 10:54:22 +00:00
|
|
|
Take it as an inspiration to make your own migration script.
|