0

I have a best practice question. We have an app running on two servers behind a load balancer. Most data is in a common DB, user uploaded files are in object-storage. So not much to keep in sync, except some YAML config files that are generated by the user via the app backend.

What is the best practice to keep these files in sync? One solution I thought of is to mount a shared volume to host the code and config files. Is there a better solution?

Illes Peter
  • 41
  • 1
  • 8
  • It's very hard to answer this without knowing what those yaml files for and what other engineering practices are there in your org. Everyone's best practice is different. I'd say package those yamls in container using CI/CD and do gradual rollouts. I have no idea if it's applicable in your case though. – rvs Jun 14 '22 at 16:07
  • Questions seeking installation, configuration or diagnostic help must include the desired end state, the specific problem or error, sufficient information about the configuration and environment to reproduce it, and attempted solutions. Questions without a clear problem statement are not useful to other readers and are unlikely to get good answers – djdomi Jun 14 '22 at 16:57

1 Answers1

1

Assuming only one "best practice" is a trap. There always is more than one solution.

Storing the contents of the config files in the database is one option. Blobs managed by some application, possibly written out to disk if that is what some other thing is reading. Or alter the application to use discrete data fields in the DB rather than YAML documents. Takes advantage of the existing central database, but requires that DB to be available first.

Store the config files in the software package or image containing the application. Deploy new ones by upgrading the app. Only makes sense if those files are changed by the same people or process updating the application.

Copy the files from the authoritative copy to each instance on a schedule, or on change. Take your pick of file copy software, rsync, sftp. Would need some extra scripting if the install should be transactional, in that all of the files are installed, or none of them are.

Mount a network file share. Beware that if NFS or SMB shares are disconnected in an unplanned manner, that can cause performance issues.

John Mahowald
  • 30,009
  • 1
  • 17
  • 32