We’re running Discourse using AWS Elastic Beanstalk’s Docker environment, with a single Docker container running on each of 2 (or more) servers.
We noticed that the main stylesheet is 404ing about 50% of the time. I think this is because of the stylesheet cache implementation:
A rebuild of the main stylesheet is triggered by e.g. adding a new category.
One of the servers recompiles the stylesheet, writes it to its local filesystem, and updates the stylesheet path in the distributed cache.
Both servers now serve the updated stylesheet path, but only one of the servers has the updated stylesheet in its filesystem.
Is my understanding of the issue correct? If so, it seems like this could potentially be solved by writing the stylesheet to the distributed cache, or a shared storage service like S3, rather than the local filesystem.
It would be great to see this resolved in Discourse itself.
Eliminating ad-hoc local filesystem writes in favor of persisting to well-defined backing services along the lines of http://12factor.net/backing-services would allowing easier deployments and horizontal scaling across different platforms. AWS Elastic Beanstalk may be a little less common, but the ability to run on Heroku seems a good litmus test for the deployability of an app.
Also, depending on this single local filesystem seems to be throwing out much of the benefit of the docker-by-default approach that I’ve been impressed Discourse is taking.
Given Discourse already depends on Redis, that seems like a decent candidate for storing runtime-rendered stylesheets. Or since S3 is already supported for uploads, that would be another option that doesn’t introduce new dependencies.
This is very temporary, we are having all sorts of nightmarish issues with this, edge cases where it is failing and so on. We are going to be dropping support for it in our next release.
I am curious to see a template that add ceph or some other distributed fs into discourse docker, it would be an interesting thing to play with and gives for way better isolation of infrastructure