title: Dockerizing simple webbapp: how to pick what goes in which container?
body: <p>I have a very simple webapp. You can think that it's a webpage with an input box which sends the user input to the backend, the backend returns a json and then the front end plugs that json into a jinja2 template and serves some html. That's it. (Also there's a MySQL db on the backend)</p>
  
  <p>I want to dockerize this. The reason for that is that this webapp happens to have gotten some traction and I've had before scares where I push something, the website breaks, I try and roll it back and it's still broken and I end up spending a couple of hours sweating to fix it as fast as possible. I'm hoping that Docker solves this.</p>
  
  <p>Question: how should I split the whole thing into different containers? Given what I have planned for the future, the backend will have to be turned into an API to which the frontend connects to. So they will be two independent containers. My question is really how to connect them. Should the API container expose a http:80 endpoint, to which the frontend container GETs from? I guess my confusion comes from the fact that I will then have to have TWO python processes running: one for the API obviously, and then another one which does nothing but sending an input to the API and rendering the returned json into a jinja2 template. (and then one container for the MySQL db).</p>
  
  <p>OR should I keep both the renderer and the API in the same container, but have two pages, for example /search.html which the user knows about and the api /api.html which is "secret" but which I will need in the future?</p>
  
  <p>Does this picture make sense, or am I over complicating it?</p>