|
| 1 | +Minio Guide for HackMD |
| 2 | +=== |
| 3 | + |
| 4 | +1. First of all you need to setup Minio itself. |
| 5 | + |
| 6 | + Please refer to the [official Minio docs](https://docs.minio.io/) for an |
| 7 | + production setup. |
| 8 | + |
| 9 | + For checking it out and development purposes a non-persistent setup is enough: |
| 10 | + ```console |
| 11 | + docker run --name test-minio --rm -d -p 9000:9000 minio/minio server /data |
| 12 | + ``` |
| 13 | + |
| 14 | + *Please notice this is not for productive use as all your data gets lost |
| 15 | + when you stop this container* |
| 16 | + |
| 17 | +2. Next step is to get the credentials form the container: |
| 18 | + |
| 19 | + ``` |
| 20 | + docker logs test-minio |
| 21 | + ``` |
| 22 | + |
| 23 | +  |
| 24 | + |
| 25 | +3. Open http://localhost:9000 and login with the shown credentials. |
| 26 | + |
| 27 | +  |
| 28 | + |
| 29 | +4. Create a bucket for HackMD |
| 30 | + |
| 31 | +  |
| 32 | + |
| 33 | +5. Add a policy for the prefix `uploads` and make it read-only. |
| 34 | + |
| 35 | +  |
| 36 | + *Open policy editor* |
| 37 | + |
| 38 | +  |
| 39 | + *Add policy for uploads* |
| 40 | + |
| 41 | +6. Set credentials and configs for Minio in HackMD's `config.json` |
| 42 | + |
| 43 | + ```JSON |
| 44 | + "minio": { |
| 45 | + "accessKey": "888MXJ7EP4XXXXXXXXX", |
| 46 | + "secretKey": "yQS2EbM1Y6IJrp/1BUKWq2/XXXXXXXXXXXXXXX", |
| 47 | + "endPoint": "localhost", |
| 48 | + "port": 9000, |
| 49 | + "secure": false |
| 50 | + } |
| 51 | + ``` |
| 52 | + *You have to use different values for `endpoint` and `port` for a production |
| 53 | + setup. Keep in mind the `endpoint`-address has to be public accessible from |
| 54 | + your browser.* |
| 55 | + |
| 56 | +7. Set bucket name |
| 57 | + |
| 58 | + ```JSON |
| 59 | + "s3bucket": "hackmd" |
| 60 | + ``` |
| 61 | + |
| 62 | +8. Set upload type. |
| 63 | + |
| 64 | + ```JSON |
| 65 | + "imageUploadType": "minio" |
| 66 | + ``` |
| 67 | + |
| 68 | +9. Review your config. |
| 69 | + |
| 70 | + ```json |
| 71 | + { |
| 72 | + // all your other config… |
| 73 | + "minio": { |
| 74 | + "accessKey": "888MXJ7EP4XXXXXXXXX", |
| 75 | + "secretKey": "yQS2EbM1Y6IJrp/1BUKWq2/XXXXXXXXXXXXXXX", |
| 76 | + "endPoint": "localhost", |
| 77 | + "port": 9000, |
| 78 | + "secure": false |
| 79 | + }, |
| 80 | + "s3bucket": "hackmd", |
| 81 | + "imageUploadType": "minio" |
| 82 | + } |
| 83 | + ``` |
0 commit comments