Developer Guidelines: DeploymentTools
The coapp needs to allow users to deploy Eden on Linux Servers that may be EC2 instances (preferred). We also need to support features such as:
- 3-tier Deployment
- Amazon AutoScaling
- Management Tasks (Clean Tables/Pull Eden)
- Allow edition of configuration files
The requirements demand the need of a library which allows us to communicate with servers and install packages and issue commands remotely. We're using Ansible http://ansible.com/ for this task.
- Deploy the coapp using the instructions at http://eden.sahanafoundation.org/wiki/InstallationGuidelines/Amazon#InstallingDeploymentCoapponEC2
- Access the coapp, register a user and create a new Deployment
- User may add a signle role (all) or multiple roles (db, webserver, eden)
- User may only associate a single instance (prod/demo) while creating the deployment. Others may be added after succesful deployment of the first one.
- On form submit, a YML file is generated in the yaml/ directory of the application (examples https://github.com/sahana/eden_playbook/tree/master/examples and ansible is ran using the web2py scheduler.
- The success/failure is reported once the scheduler task is completed.
- If successful, the user may further add instances (eg. demo/test) to the same deployment or issue management tasks using tabs/buttons in the rheader
The setup_deployment table is used to store various attributes related to the deployment.
The setup_instance table is used to store the type of instances along with its URL and a FK to scheduler_id. Each time an instance is added to the deployment, a YAML file is created in the background and ansible is called using the web2py scheduler.
The setup_server table is used to store the role (all/db/webserver/eden) of a particular host in the deployment along with its IP and hostname.
- S3SQLInlineComponent/S3SQLInlineLink allows addition of entries in setup_server and setup_instance.
- After form submission and record creation, an entry is added to the scheduler_task table to run ansible (row id of scheduler_task is stored in setup_instance table). Ansible playbook (yaml file) takes in the values of variables from the user input in the create form.
- Success/Failure of the deployment is displayed on the "read" method of the deployment