Skip to content

Commit 6dae85f

Browse files
authored
Merge pull request #698 from SISheogorath/docs/minio
Adding some docs for new Minio Feature
2 parents e52d7db + 587a6e2 commit 6dae85f

8 files changed

Lines changed: 97 additions & 1 deletion

File tree

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ There are some configs you need to change in the files below
193193
| HMD_S3_SECRET_ACCESS_KEY | no example | AWS secret key |
194194
| HMD_S3_REGION | `ap-northeast-1` | AWS S3 region |
195195
| HMD_S3_BUCKET | no example | AWS S3 bucket name |
196+
| HMD_MINIO_ACCESS_KEY | no example | Minio access key |
197+
| HMD_MINIO_SECRET_KEY | no example | Minio secret key |
198+
| HMD_MINIO_ENDPOINT | `minio.example.org` | Address of your Minio endpoint/instance |
199+
| HMD_MINIO_PORT | `9000` | Port that is used for your minio instance |
200+
| HMD_MINIO_SECURE | `true` | If set to true HTTPS is used for minio |
196201
| HMD_HSTS_ENABLE | ` true` | set to enable [HSTS](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security) if HTTPS is also enabled (default is ` true`) |
197202
| HMD_HSTS_INCLUDE_SUBDOMAINS | `true` | set to include subdomains in HSTS (default is `true`) |
198203
| HMD_HSTS_MAX_AGE | `31536000` | max duration in seconds to tell clients to keep HSTS status (default is a year) |
@@ -242,8 +247,9 @@ There are some configs you need to change in the files below
242247
| email | `true` or `false` | set to allow email signin |
243248
| allowemailregister | `true` or `false` | set to allow email register (only applied when email is set, default is `true`) |
244249
| imageUploadType | `imgur`(default), `s3` or `filesystem` | Where to upload image
250+
| minio | `{ "accessKey": "YOUR_MINIO_ACCESS_KEY", "secretKey": "YOUR_MINIO_SECRET_KEY", "endpoint": "YOUR_MINIO_HOST", port: 9000, secure: true }` | When `imageUploadType` is set to `minio`, you need to set this key. Also checkout our [Minio Image Upload Guide](docs/guides/minio-image-upload.md) |
245251
| s3 | `{ "accessKeyId": "YOUR_S3_ACCESS_KEY_ID", "secretAccessKey": "YOUR_S3_ACCESS_KEY", "region": "YOUR_S3_REGION" }` | When `imageUploadType` be set to `s3`, you would also need to setup this key, check our [S3 Image Upload Guide](docs/guides/s3-image-upload.md) |
246-
| s3bucket | `YOUR_S3_BUCKET_NAME` | bucket name when `imageUploadType` is set to `s3` |
252+
| s3bucket | `YOUR_S3_BUCKET_NAME` | bucket name when `imageUploadType` is set to `s3` or `minio` |
247253

248254
## Third-party integration api key settings
249255

config.json.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@
100100
"imgur": {
101101
"clientID": "change this"
102102
},
103+
"minio": {
104+
"accessKey": "change this",
105+
"secretKey": "change this",
106+
"endPoint": "change this",
107+
"secure": true,
108+
"port": 9000
109+
},
103110
"s3": {
104111
"accessKeyId": "change this",
105112
"secretAccessKey": "change this",
14.9 KB
Loading
20.7 KB
Loading
12.8 KB
Loading
71.5 KB
Loading
17.1 KB
Loading

docs/guides/minio-image-upload.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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+
![docker logs](images/minio-image-upload/docker-logs.png)
24+
25+
3. Open http://localhost:9000 and login with the shown credentials.
26+
27+
![minio default view](images/minio-image-upload/default-view.png)
28+
29+
4. Create a bucket for HackMD
30+
31+
![minio create bucket](images/minio-image-upload/create-bucket.png)
32+
33+
5. Add a policy for the prefix `uploads` and make it read-only.
34+
35+
![minio edit policy](images/minio-image-upload/open-edit-policy.png)
36+
*Open policy editor*
37+
38+
![minio policy adding](images/minio-image-upload/create-policy.png)
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

Comments
 (0)