Setting up an on-premise production environment for Polis (Recommended General Guide) #1319
-
My university is currently looking at deploying a local on-premise production environment for Polis. Initially we'll be looking to run it for a couple of pilot research projects but in the longer term we would also like to look at offering it as a common service that can be leveraged by any research group within the university who may want to use Polis. Looking at https://github.com/compdemocracy/polis it suggests that the instructions that are currently available are only suitable to use as a guide for development environments. I was wondering what additional considerations we should be looking at to make an appropriate production level deployment? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Thanks for asking about this. We get this question a lot, so it's great to have a public record here. The answer greatly depends on what scale you're hoping to achieve. Regardless of that, however, you'll need to be running:
For a relatively small deployment (only a single conversation at a time, with only a few hundred participants at a time or so), you can probably get by with a single server and relatively small math worker. The server nodes can be pretty light weight, but the math worker should have at least 1GB of memory (it's possible to run on 0.5GB, but you're likely to end up having to use swap, so performance will not be ideal). For larger conversations (or multiple conversations at a time), you'll need to be able to scale the number of server nodes, and to increase the amount of memory on the math worker (8GB should get you pretty far). If you have multiple conversations running at once, it can help to have multiple cores available on the math worker, which can take advantage of threading to process in parallel. If your participant body is broadly distributed geographically, you might specifically consider a CDN and caching layer (like Cloudflare+AWS S3) for static assets to improve load time. But for something small and/or local, using a basic static file server should be fine (though frankly, setting up a CDN is pretty easy, and may be the better way to go overall). Docker infrastructureWe do have docker infrastructure available for setting up the necessary environments for each of these components, and are currently using them ourselves for the math worker and server components (via Heroku). Additionally, there are dockerfiles for setting up PostgreSQL and file server images, which we don't currently use in production, but which could be used. The README instructions for setting up a development environment make clear that they are not intended for setting up a production deployment, but are probably a bit strongly worded, as they may lead people to believe that the docker infrastructure itself should not be trusted. We should reorganize that a bit to include a "Production Deployment" section, which might highlight some of what I've described above (or even just point to this discussion); If someone wants to submit a PR for that, we'd be very grateful. That having been said, the piece of the "docker infrastructure" writ large which is not fit for production (at the moment) is specifically the docker compose infrastructure. Specifically, the main Right now, we're in the process of splitting out development concerns into a separate In conclusionSo for those looking to set up a production deployment, there are a few potential paths you might take:
For what it's worth, explicit support for production deployment with docker-compose is still somewhat new (just a year or two), so you may find it a bit challenging still to find good documentation and such on this. Our position has been for a while though that this is the right way to go for turnkey deployment support, since sharing as much infrastructure as possible between dev and production is generally a good thing. This picture has gotten a little more complicated of late with the issues around Docker Desktop (necessary if you're on Mac or Windows; Linux is unaffected by this) switching it's licensing model to require payment for large and/or well funded companies; There's been some grumbling and discontent over this in the dev community, and so we're a little more open to alternative approaches or technology, but for now enough of the work is already done that we're unlikely to do the work of making a switch ourselves any time soon unless the situation changes significantly (but if you're inspired to submit a PR, please open an issue so we can discuss). There are some other approaches emerging to replace the need for Docker Desktop (e.g. see #1135), so there may be other ways around this as well. Again, for now the plan is to adapt the docker-compose infrastructure as described above into a turn-key ready deployment option. I hope this gives a good outline of what is needed in the full spectrum of cases; Obviously there's a bit of choose your own adventure here, and again, the details depend quite a bit on your situation. Please respond with comments if you have any further questions which might, and feel free to open up any issues or submit PRs which might help us get closer to our ultimate goal of turn-key deployment as you go. |
Beta Was this translation helpful? Give feedback.
Hi @lochnessgitmonster.
Thanks for asking about this. We get this question a lot, so it's great to have a public record here.
The answer greatly depends on what scale you're hoping to achieve. Regardless of that, however, you'll need to be running:
For a relatively small deployment (only a single conversation at a time, with only a few hundred participants at a time or so), you can probably get by with a single server and relatively small math worker. The server nodes…