This is the last in a series of posts about whether you should choose Ubuntu or Windows, Gunicorn or uWSGI, MySQL or PostgreSQL, and Apache or nginx. I bring it all together. The image illustrates the components I propose for a start.
My way of thinking is reflected in my seemingly unorthodox proposal of using SQLite on production. We should start with the simplest and easiest (and therefore most economical) collection of components possible, and only replace these components with something else if needed. Here are some examples of reasons for which you would want to replace a component:
Is your web site going to have many concurrent write requests? Or is the database going to have 100k or more records and/or do complicated queries? Throw out SQLite and use PostgreSQL.
Update: It can be risky to choose SQLite, as it might lead to a nightmarish migration later. Read “Which database should I use in production?” for more information.
Are you stuck with Ubuntu 14.04 which doesn’t have systemd? Use supervisor. systemd is clearly the future, but you will find fewer tutorials on it and its documentation is harder to understand than supervisor’s. My book explains systemd, but you might not want to buy it just for that. If any of these issues is a problem, it means that supervisor is simpler for you, so go with supervisor.
Do you need content negotiation? Do you need to run WordPress on the same server? Use Apache. (You can also run WordPress with nginx, but it’s harder, and it’s not justified just because nginx is more fashionable.)
Are you affected by a Windows-only company policy and are so far unable to get the company to reconsider? Use Windows, Apache, and mod_wsgi.
Start simple, and only replace with something else if it’s really needed.
Related posts:
- Why nginx is faster than Apache, and why you needn’t necessarily care
- How to setup Apache with gunicorn
- Which database should I use in production?
- Which operating system should I choose for deployment?
- Which WSGI server should I use?
Also related: