title: Choosing deployment options for aiohttp low level server
body: <p>Im absolutely lost with deployment options for my aiohttp server;
  There are multiple ways to move service in production and I can't choose correct one:</p>
  
  <ol>
  <li>systemd script/supervisord + api hour
  Cons: i don't understand how api hour works, it seems like ah take control of server's daemon coroutine, but my server's coro run (low lelev aiohttp server/connection handler)in asyncio.gather function with other coro (supervisor/states keeper's class forever run method) and it could be problematic to handle second coroutine with api hour</li>
  <li>gunicorn same thoughs like at 1</li>
  <li>nginx + unix socket +systemd script
  Cons: looking damn hard to deploy and support;</li>
  <li>pure aiohttp server under systemd script:
  Cons: handling pid files, low performance(?)
  I'll be happy to see any thoughts about my problem, thanx!</li>
  </ol>
  
  <p>My run function looks like:</p>
  
  <pre><code>def run():
      startTime = time.time()
      logging.basicConfig(level=logging.INFO, format="%(asctime)s [ %(levelname)s ]: %(message)s")
      cfg = ConfigStore("server_config.cfg")
      loop = asyncio.get_event_loop()
      logging.info("Starting server")
      db = DBProxyLayer.fabric(cfg("dbCredentials"))
      logging.info("DBLayer initialized {}".format(db))
      try:
          supervisor = QPSServerSupervisor(loop=loop, db=db, config=cfg)
          srvCoro = loop.create_server(lambda: QPSServer(
                      supervisor=supervisor, debug=False, keep_alive_on=False, loop=loop),
                      host=cfg("command_host"), port=cfg("command_port"))
          loop.run_until_complete(asyncio.gather(*(srvCoro, supervisor.startToServe())))
      except Exception as e:
          logging.critical("Server start failure {}\n{}".format(e, traceback.print_exc()))
          sys.exit(-1)
      else:
          logging.info("Server started for {0:.2f} seconds".format(time.time()-startTime))
      try:
          loop.run_forever()
      except Exception as e:
          logging.info(e)
          loop.close()
          sys.exit(-1)
  </code></pre>