README.rst 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. Mico: a monkey in the cloud
  2. ===========================
  3. Mico is a tool-toy to manage a number of hosts deployed in cloud services
  4. (currently only support Amazon AWS), and also allows you to deploy new hosts
  5. with specified template or create autoscaling groups and manage them easily.
  6. .. image:: https://img.shields.io/pypi/v/mico.svg
  7. :target: https://crate.io/packages/mico/
  8. :alt: Latest PyPI version
  9. .. image:: https://img.shields.io/pypi/dm/mico.svg
  10. :target: https://crate.io/packages/mico/
  11. :alt: Number of PyPI downloads
  12. Installation
  13. ------------
  14. As usual, mico is available from pypi_, and can be installed using ``pip``::
  15. pip install mico
  16. .. _pypi: http://pypi.python.org/pypi
  17. Mico just need an AWS key ID and AWS secret key to run. By default mico just
  18. take this variables from the OS environment::
  19. export AWS_ACCESS_KEY_ID="*foo*"
  20. export AWS_SECRET_ACCESS_KEY="*bar*"
  21. QuickStart
  22. ----------
  23. Mico works using the concept of template. A template is just a python code
  24. (with steroids which we call *libraries*), the template can implements
  25. a number of actions to perform in the cloud. In this example we just create
  26. a new host in AWS and install some packages there.
  27. .. code-block:: python
  28. from mico.lib.aws import *
  29. from mico.lib.core import *
  30. def deploy(*args):
  31. for host in args:
  32. instance = ec2_ensure(
  33. ami = "ami-3d4ff254",
  34. name = host,
  35. instance_type = "t1.micro",
  36. key_name = "root-us-east-virginia",
  37. security_groups = "sec-test"
  38. )
  39. package_ensure("python") # of course :)
  40. package_ensure("apache")
  41. Once, your template is created, you need to put it into a mico template path
  42. (by default uses ``/etc/mico`` and ``~/.config/mico/``, and the current
  43. working directory.
  44. Then you can just run mico
  45. .. code-block:: bash
  46. $ mico template:deploy myhost1.mydomain.com myhost2.mydomain.com
  47. mico:cloud:deploy:create security group: sec-test
  48. mico:cloud:deploy:create instance: i-4543123
  49. mico:cloud:deploy:use existent security group: sec-test
  50. mico:cloud:deploy:create instance: i-2291281
  51. You can see more complex (and useful!) templates in `examples directory`_.
  52. .. _`examples directory`: tree/master/examples
  53. .. raw:: html
  54. <button class="tpl"><a href="https://github.com/ajdiaz/mico/tree/master/examples">View template
  55. examples</a></button>