how to persist uploaded files with docker deployment?
-
I'm deploying nodebb with docker, but the files uploaded are store in relative path to nodebb application, which is in the docker environment. So, as all of us know, docker environment would be destroyed and the uploaded files, specifically the uploaded favicons and etc admin settings related with assets uploaded would be in a mess, resulting in unreachable image sources or something like that. So, to put it all together, my question is how to deploy with docker and persist all the upload files? Is there any official documentations or guides available? Very much appreciated for your suggestions and actionalble guide. Thanks in advance.
-
I'm gonna answer my own question here. The solution is simple, use other cloud-based upload plugins, for example:
- amazon s3 service: nodebb-plugin-s3-upload
- aliyun oss: nodebb-plugin-ali-oss
NOTE: both of these plugins are somekind of outdated, you may have to modify the code to make it work.
for aliyun oss upload, you can use my modified version:
-
-
By default, admin management panel can be used to upload favicon/site-logo and etc images which are not hooked in the nodebb original source code.
If that's the situation you have to override the default upload behavior, you may have to change the source code. I'll put a simple example below:
- source code to change:
src/controllers/admin/uploads.js
- for example, override the default uploadFavicon behavior with the above plugin:
uploadsController.uploadCategoryPicture = function() { await upload('favicon', req, res, next); }
- source code to change: