I programmed an API with nodejs and express like million others out there and it will go live in a few weeks. The API currently runs on a single docker host with one volume for persistent data containing images uploaded by users.
I'm now thinking about scalability and a high availability setup where the question about network volumes come in. I've read a lot about NFS volumes and potentially the S3 Driver for a docker swarm.
From the information I gathered, I sorted out two possible solutions for the swarm setup:
Docker Volume Driver
- I could connect each docker host either to an S3 Bucket or EFS Storage with the compose file
- Connection should work even if I move VPS Provider
- Better security if I put a NFS storage on the private part of the network (no S3 or EFS)
API Multer S3 Middleware
- No attached volume required since the S3 connection is done from within the container
- Easier swarm and docker management
- Things have to be re-programmed and a few files needs to be migrated
- On a GET request, the files will be provided by AWS directly instead of the API
Please, tell me your opposition on this. Am I getting this right or do I miss something? Which route should I take? Is there something to consider with latency or permissions when mounting from different hosts? Tipps on S3, EFS are definitely welcome, since I have no knowledge yet.