PageRenderTime 29ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/docs/multiserver.txt

https://bitbucket.org/ianb/silverlining/
Plain Text | 138 lines | 112 code | 26 blank | 0 comment | 0 complexity | 32f726a029754fd0e2b22ee98fac1806 MD5 | raw file
Possible License(s): GPL-2.0
  1. Design Notes On Multiple Server Support
  2. =======================================
  3. What should it look like to support multiple servers?
  4. Multiple servers will make up a "set". In particular, a "nodeset". A
  5. configuration file will describe this::
  6. [general]
  7. # Just naming the general setup:
  8. name = my-server-setup
  9. # This is used for filling in node names if they aren't explicitly given:
  10. base_domain = foobar.com
  11. # If you set this to false, then /etc/hosts won't be updated:
  12. set_etc_hosts = false
  13. [provider]
  14. # You can just look up a provider in ~/.silverlining.conf:
  15. name = whatever
  16. # Or specify all the values:
  17. provider = rackspace
  18. username = foobar
  19. secret = XXX
  20. # or:
  21. secret_file = ${HOME}/.rackspace-secret.txt
  22. [appserver]
  23. # This describes the app server
  24. # You can have multiple things setup:
  25. locations =
  26. http://foobar.com/ APP_NAME1
  27. # You can setup multiple nodes:
  28. nodes = 10
  29. # default being 1, of course.
  30. # You can indicate the size of these nodes too:
  31. size = id 1
  32. # You can also give the size in MB of ram (since that generally
  33. # increments):
  34. size = ram 256MB
  35. # This is used to name the nodes:
  36. node_name = app{{n}}.foobar.com
  37. # If not provided, this will be automatically determined by the
  38. # number of nodes (1=no balancing), and the existence of a
  39. # [balancer] section.
  40. load_balancer = true
  41. [service:mysql]
  42. # How many nodes to assign:
  43. nodes = 1
  44. # Without special support, generally just 1 node is supported
  45. # also node_name/size
  46. [balancer]
  47. # Describes the load balancer
  48. node_name = balancer.foobar.com
  49. hostnames = foobar.com
  50. baz.com
  51. This describes a set of nodes/servers, imagine this file is named
  52. ``foobar.conf``. The commands for creating and setting up nodes
  53. will take nodeset configurations, like::
  54. silver create-node foobar.conf
  55. silver setup-node foobar.conf
  56. The command will specifically look for ``.conf`` in the name, then
  57. inferring it is not a domain name.
  58. Then this configuration file will also be a target just like a
  59. "location". E.g., you can do::
  60. silver update myapp/ foobar.conf
  61. This will match the name against the locations in the configuration
  62. file to determine where exactly to upload the application to.
  63. Interpolation will be available anywhere in the configuration file,
  64. using `this pattern
  65. <http://blog.ianbicking.org/2009/04/20/treating-configuration-values-as-templates/>`_.
  66. This way you can extend another file (using buildout-style directives;
  67. these are already built into `INITools
  68. <http://pythonpaste.org/initools/>`_) and abstract out aspects through
  69. various variables (including environmental variables).
  70. When running ``create-node`` and ``setup-node`` all the servers needed
  71. will be enumerated and named. ``create-node`` will create any new
  72. nodes necessary (and can be run to scale up -- not sure how to scale
  73. down except manually deleting nodes, ``delete-node foobar.conf`` won't
  74. really work).
  75. ``setup-node`` will need to support multiple kinds of servers. There
  76. will first be a basic setup (install normal libraries, users,
  77. authentication). Then another layer of setup on top: one for an
  78. appserver (what we are doing now), one for a service (not much more
  79. than the basic setup), and one for the load balancer. All servers
  80. will be updated with configuration pointing to all the other servers,
  81. including ``/etc/hosts`` entries for all the domain names. This
  82. configuration will probably look roughly like::
  83. appserver = app1.foobar.com 10.4.3.2
  84. appserver = app2.foobar.com 10.4.3.3
  85. appserver = app3.foobar.com 10.4.3.4
  86. service.mysql = mysql.foobar.com 10.4.3.5
  87. balancer = balancer.foobar.com 10.4.3.6
  88. The balancer will use this to find the appservers, and the appservers
  89. will use this to configure their services. I guess ssh keys will be
  90. setup for automated ssh'ing between these machines? Not sure if it is
  91. necessary.
  92. The update will be a bit more sophisticated. Imagine you are updating
  93. an application with this ``app.ini``::
  94. [production]
  95. app_name = blog
  96. service.mysql =
  97. update_fetch = /setup-stuff
  98. On update first ``silver`` will connect to ``mysql.foobar.com`` and
  99. setup the service for this application. This mostly just creates the
  100. database if necessary. Then it will half-deploy this application to
  101. all app servers. The application will be deployed but not active.
  102. Then it will activate the first application and do ``update_fetch``,
  103. then activate the rest of the applications. (Maybe running
  104. ``update_fetch`` everywhere, but with a special flag to note it's not
  105. the primary update.)
  106. The service ``app_setup()`` code will run on each app server, but it
  107. will use the configuration to actually fill in some of those values,
  108. now pointing to another server instead of a local server. Also the
  109. ``install()`` function will be run on both the appservers and the
  110. service servers (with a flag to indicate the different environments).
  111. Client libraries still get loaded in the appserver, servers in the
  112. service servers.