|
1 | | -# HAProxy Example |
| 1 | +[](https://circleci.com/gh/cloudify-examples/haproxy-blueprint) |
2 | 2 |
|
3 | | -This blueprint deploys a server with HAProxy installed on it. The create operation can be used to add and remove nodes to the haproxy backend. |
| 3 | +# HAProxy Blueprint |
4 | 4 |
|
5 | | -_This example explains how to connect to a MySQL backend using HAProxy. Therefore, initially install the [mariadb example](https://github.com/cloudify-examples/mariadb-blueprint). Once that example is installed, continue below._ |
| 5 | +This blueprint deploys an HAProxy Load Balancer. This blueprint is part of the *End-to-end Solutions Package*, which demonstrates functionality in Cloudify using a Database, Load Balancer, and several front-end applications. Before installing this deployment, install the [MariaDB Blueprint](https://github.com/cloudify-examples/mariadb-blueprint), then continue with the solution package by installing the [Drupal Blueprint](https://github.com/cloudify-examples/drupal-blueprint). |
6 | 6 |
|
7 | 7 |
|
8 | | -## Deploy your HAProxy frontend with the MariaDB backend: |
| 8 | +## Compatibility |
9 | 9 |
|
10 | | -``` |
11 | | -cfy deployments outputs mariadb |
12 | | -Retrieving outputs for deployment mariadb... |
13 | | - - "cluster_addresses": |
14 | | - Description: Cluster Addresses |
15 | | - Value: [u'192.168.121.10'] |
16 | | - - "master": |
17 | | - Description: master node ip |
18 | | - Value: 192.168.121.10 |
19 | | -``` |
20 | | - |
21 | | -Now, install HAProxy: |
| 10 | +Tested with: |
| 11 | + * Cloudify 4.2 |
22 | 12 |
|
23 | | -#### For AWS run: |
24 | | - |
25 | | -```shell |
26 | | -$ cfy install \ |
27 | | - https://github.com/cloudify-examples/haproxy-blueprint/archive/master.zip \ |
28 | | - -b haproxy \ |
29 | | - -n aws-blueprint.yaml |
30 | | -``` |
31 | | - |
32 | | - |
33 | | -#### For Azure run: |
34 | | - |
35 | | -```shell |
36 | | -$ cfy install \ |
37 | | - https://github.com/cloudify-examples/haproxy-blueprint/archive/master.zip \ |
38 | | - -b haproxy \ |
39 | | - -n azure-blueprint.yaml |
40 | | -``` |
41 | | - |
42 | | - |
43 | | -#### For Openstack run: |
44 | | - |
45 | | -```shell |
46 | | -$ cfy install \ |
47 | | - https://github.com/cloudify-examples/haproxy-blueprint/archive/master.zip \ |
48 | | - -b haproxy \ |
49 | | - -n openstack-blueprint.yaml |
50 | | -``` |
51 | | - |
52 | | -#### For GCP run: |
53 | | - |
54 | | -```shell |
55 | | -$ cfy install \ |
56 | | - https://github.com/cloudify-examples/haproxy-blueprint/archive/master.zip \ |
57 | | - -b haproxy \ |
58 | | - -n gcp-blueprint.yaml |
59 | | -``` |
60 | | - |
61 | | -For example, your output should look like this: |
62 | | - |
63 | | -``` |
64 | | -cfy install haproxy-blueprint/openstack-blueprint.yaml -b haproxy -i application_ip=192.168.121.10 |
65 | | -Uploading blueprint haproxy-blueprint/openstack-blueprint.yaml... |
66 | | - openstack-bluepri... |################################################| 100.0% |
67 | | -Blueprint uploaded. The blueprint's id is haproxy |
68 | | -Creating new deployment from blueprint haproxy... |
69 | | -Deployment created. The deployment's id is haproxy |
70 | | -Executing workflow install on deployment haproxy [timeout=900 seconds] |
71 | | -``` |
72 | | - |
73 | | -When install is successful, get the public IP of the load balancer: |
74 | | - |
75 | | -``` |
76 | | -cfy deployments outputs haproxy |
77 | | -Retrieving outputs for deployment haproxy... |
78 | | - - "ip": |
79 | | - Description: Public IP Address |
80 | | - Value: 10.239.2.116 |
81 | | -
|
82 | | -``` |
83 | | - |
84 | | -## Test connection to MySQL: |
85 | | - |
86 | | -``` |
87 | | -telnet -e X 10.239.2.116 3306 |
88 | | -Telnet escape character is 'X'. |
89 | | -Trying 10.239.1.60... |
90 | | -Connected to 10.239.1.60. |
91 | | -Escape character is 'X'. |
92 | | -Y |
93 | | -5.5.5-10.1.26-MariaDB%gW`Z#???e#xX0'mruscsmysql_native_passwordX |
94 | | -telnet> ^C |
95 | | -``` |
96 | | - |
97 | | -## Add Backends: |
98 | | - |
99 | | -Scale the MariaDB Cluster: |
100 | | - |
101 | | -``` |
102 | | - :: cfy executions start scale -d mariadb -p scalable_entity_name=app_group |
103 | | -Executing workflow scale on deployment mariadb [timeout=900 seconds] |
104 | | -2017-09-26 07:54:22.707 CFY <mariadb> Starting 'scale' workflow execution |
105 | | -``` |
106 | | - |
107 | | -When the scale workflow has succeeded, check the updated cluster addresses: |
108 | | - |
109 | | -``` |
110 | | -cfy deployments outputs mariadb |
111 | | -Retrieving outputs for deployment mariadb... |
112 | | - - "cluster_addresses": |
113 | | - Description: Cluster Addresses |
114 | | - Value: [u'192.168.121.10', u'192.168.121.12'] |
115 | | - - "master": |
116 | | - Description: master node ip |
117 | | - Value: 192.168.121.10 |
118 | | -``` |
119 | | - |
120 | | -Next update the inputs/execute-operation.yaml.example file with the haproxy_configuration_updater node instance id, and the next backend private IP. |
121 | | - |
122 | | -Example file: |
123 | | -``` |
124 | | -node_instance_ids: haproxy_configuration_updater_hpjz09 |
125 | | -operation: create |
126 | | -allow_kwargs_override: true |
127 | | -operation_kwargs: |
128 | | - frontend_port: 3306 |
129 | | - update_backends: |
130 | | - server2: |
131 | | - address: 192.168.121.12 |
132 | | - port: 3306 |
133 | | - maxconn: 32 |
134 | | -
|
135 | | -``` |
136 | | - |
137 | | -Now update the backends on the HAProxy configuration: |
138 | | - |
139 | | -``` |
140 | | -cfy executions start execute_operation -vv -d ha -p haproxy-blueprint/inputs/execute-operation.yaml.example |
141 | | -``` |
| 13 | + |
| 14 | +## Pre-installation steps |
| 15 | + |
| 16 | +Upload the required plugins: |
| 17 | + |
| 18 | + * [Openstack Plugin](https://github.com/cloudify-cosmo/cloudify-openstack-plugin/releases). |
| 19 | + * [AWSSDK Plugin](https://github.com/cloudify-incubator/cloudify-awssdk-plugin/releases). |
| 20 | + * [AWS Plugin](https://github.com/cloudify-cosmo/cloudify-aws-plugin/releases). |
| 21 | + * [GCP Plugin](https://github.com/cloudify-incubator/cloudify-gcp-plugin/releases). |
| 22 | + * [Azure Plugin](https://github.com/cloudify-incubator/cloudify-azure-plugin/releases). |
| 23 | + * [Utilities Plugin](https://github.com/cloudify-incubator/cloudify-utilities-plugin/releases). |
| 24 | + |
| 25 | +_Check the relevant blueprint for the latest version of the plugin._ |
| 26 | + |
| 27 | +**Install the relevant example network blueprint for the IaaS that you wish to deploy on:** |
| 28 | + |
| 29 | + * [Openstack Example Network](https://github.com/cloudify-examples/openstack-example-network) |
| 30 | + * [AWS Example Network](https://github.com/cloudify-examples/aws-example-network) |
| 31 | + * [GCP Example Network](https://github.com/cloudify-examples/gcp-example-network) |
| 32 | + * [Azure Example Network](https://github.com/cloudify-examples/azure-example-network) |
| 33 | + |
| 34 | +In addition to the pre-requisites for your example network blueprint, you will need the following secrets: |
| 35 | + |
| 36 | + * `agent_key_private` and `agent_key_public`. If you do not already have these secrets, can generate them with the `keys.yaml` blueprint in the [helpful blueprint](https://github.com/cloudify-examples/helpful-blueprint) repo. |
| 37 | + |
| 38 | +**Install the MariaDB Blueprint** |
| 39 | + |
| 40 | + * After installation is successful, check the deployment outputs. There is a single deployment output called `cluster_addresses`, which is a list of IP addresses. Select a single IP, this will be the value for your `application_ip` input in this blueprint, as a seed-IP. |
| 41 | + |
| 42 | +## Installation |
| 43 | + |
| 44 | +On your Cloudify Manager, navigate to _Local Blueprints_ select _Upload_. |
| 45 | + |
| 46 | +[Right-click and copy URL](https://github.com/cloudify-examples/haproxy-blueprint/archive/master.zip). Paste the URL where it says _Enter blueprint url_. Provide a blueprint name, such as _lb_ in the field labeled _blueprint name_. |
| 47 | + |
| 48 | +Select the blueprint for the relevant IaaS you wish to deploy on, for example _aws.yaml_ from _Blueprint filename_ menu. Click **Upload**. |
| 49 | + |
| 50 | +After the new blueprint has been created, provide the seed `application_ip` input (see Install the MariaDB Blueprint above) click the **Deploy** button. |
| 51 | + |
| 52 | +Navigate to _Deployments_, find your new deployment, select _Install_ from the _workflow_s menu. At this stage, you may provide your own values for any of the default _deployment inputs_. |
| 53 | + |
| 54 | +For example, the _openstack.yaml_ blueprint requires that you provide a value for `image`. This is the ID of a _Centos 7_ image. You may also need to override the default `flavor` as the default value `2` may not be available in your account or appropriate. |
| 55 | + |
| 56 | + |
| 57 | +## Uninstallation |
| 58 | + |
| 59 | +Navigate to the deployment and select `Uninstall`. When the uninstall workflow is finished, select `Delete deployment`. |
0 commit comments