Skip to content
This repository has been archived by the owner on Mar 1, 2020. It is now read-only.

Commit

Permalink
Merge pull request #8 from cloudify-examples/example-network
Browse files Browse the repository at this point in the history
Example network
  • Loading branch information
EarthmanT authored Feb 5, 2018
2 parents ecd66e6 + 7ad0ac4 commit 267ae34
Show file tree
Hide file tree
Showing 11 changed files with 720 additions and 866 deletions.
138 changes: 30 additions & 108 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,134 +1,56 @@
[![CircleCI](https://circleci.com/gh/cloudify-examples/mariadb-blueprint.svg?style=svg)](https://circleci.com/gh/cloudify-examples/mariadb)
[![CircleCI](https://circleci.com/gh/cloudify-examples/mariadb-blueprint.svg?style=svg)](https://circleci.com/gh/cloudify-examples/mariadb-blueprint)

# MariaDB Blueprint

This blueprint deploys a [MariaDB database cluster with Galera](https://mariadb.com/kb/en/library/what-is-mariadb-galera-cluster/) using Cloudify.
This blueprint deploys a MariaDB/Galera Cluster. 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. After completing this deployment, continue with the solution package by installing the [HAProxy Blueprint](https://github.com/cloudify-examples/haproxy-blueprint).


## prerequisites
## Compatibility

You will need a *Cloudify Manager* running in either AWS, Azure, Openstack, or GCP.
Tested with:
* Cloudify 4.2

If you have not already, set up the [example Cloudify environment](https://github.com/cloudify-examples/cloudify-environment-setup). Installing that blueprint and following all of the configuration instructions will ensure you have all of the prerequisites, including keys, plugins, and secrets.

## Pre-installation steps

### Step 1: Install the MariaDB database cluster with Galera
Upload the required plugins:

In this step, you will run a *Cloudify CLI* command, which uploads the mariadb blueprint to the manager, creates a deployment, and starts an install workflow.
* [Openstack Plugin](https://github.com/cloudify-cosmo/cloudify-openstack-plugin/releases).
* [AWSSDK Plugin](https://github.com/cloudify-incubator/cloudify-awssdk-plugin/releases).
* [AWS Plugin](https://github.com/cloudify-cosmo/cloudify-aws-plugin/releases).
* [GCP Plugin](https://github.com/cloudify-incubator/cloudify-gcp-plugin/releases).
* [Azure Plugin](https://github.com/cloudify-incubator/cloudify-azure-plugin/releases).
* [Utilities Plugin](https://github.com/cloudify-incubator/cloudify-utilities-plugin/releases).

When it is finished, you will be able to play with the wine store application.
_Check the relevant blueprint for the latest version of the plugin._

**Install the relevant example network blueprint for the IaaS that you wish to deploy on:**

#### For AWS run:
* [Openstack Example Network](https://github.com/cloudify-examples/openstack-example-network)
* [AWS Example Network](https://github.com/cloudify-examples/aws-example-network)
* [GCP Example Network](https://github.com/cloudify-examples/gcp-example-network)
* [Azure Example Network](https://github.com/cloudify-examples/azure-example-network)

```shell
$ cfy install \
https://github.com/cloudify-examples/mariadb-blueprint/archive/master.zip \
-b mariadb \
-n aws-blueprint.yaml
```
In addition to the pre-requisites for your example network blueprint, you will need the following secrets:

* `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.

#### For Azure run:

```shell
$ cfy install \
https://github.com/cloudify-examples/mariadb-blueprint/archive/master.zip \
-b mariadb \
-n azure-blueprint.yaml
```
## Installation

On your Cloudify Manager, navigate to _Local Blueprints_ select _Upload_.

#### For Openstack run:
[Right-click and copy URL](https://github.com/cloudify-examples/mariadb-blueprint/archive/master.zip). Paste the URL where it says _Enter blueprint url_. Provide a blueprint name, such as _db_ in the field labeled _blueprint name_.

```shell
$ cfy install \
https://github.com/cloudify-examples/mariadb-blueprint/archive/master.zip \
-b mariadb \
-n openstack-blueprint.yaml
```
Select the blueprint for the relevant IaaS you wish to deploy on, for example _aws.yaml_ from _Blueprint filename_ menu. Click **Upload**.

#### For GCP run:
After the new blueprint has been created, click the **Deploy** button.

```shell
$ cfy install \
https://github.com/cloudify-examples/mariadb-blueprint/archive/master.zip \
-b mariadb \
-n gcp-blueprint.yaml
```
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_.

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.

You should see something like this when you execute the command:

## Uninstallation

```shell
:: cfy install mariadb-blueprint/openstack-blueprint.yaml -b mariadb
Uploading blueprint mariadb-blueprint/openstack-blueprint.yaml...
openstack-bluepri... |################################################| 100.0%
Blueprint uploaded. The blueprint's id is mariadb
Creating new deployment from blueprint mariadb...
Deployment created. The deployment's id is mariadb
Executing workflow install on deployment mariadb [timeout=900 seconds]
```


### Step 2: Verify the demo installed and started.

Once the workflow execution is complete, we can view the application endpoint by running: <br>

```shell
cfy deployments outputs mariadb
Retrieving outputs for deployment mariadb...
- "cluster_addresses":
Description: Cluster Addresses
Value: [u'192.168.121.11']
- "master":
Description: master node ip
Value: 192.168.121.11
```


### Step 3: Verify the cluster has started:

SSH into the VM and execute `mysql -u root -p -e "SHOW STATUS LIKE 'wsrep_cluster_size'"`:

```
[centos@cloudify ~]$ ssh -i ~/.ssh/agent.key [email protected]
The authenticity of host '192.168.121.11 (192.168.121.11)' can't be established.
ECDSA key fingerprint is f1:35:95:b9:57:51:5a:b8:ac:13:79:6e:1a:80:c2:ed.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.121.11' (ECDSA) to the list of known hosts.
Last login: Tue Sep 26 10:14:39 2017
[centos@server-galera-host-7ituuu ~]$ mysql -u root -p -e "SHOW STATUS LIKE 'wsrep_cluster_size'"
Enter password:
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| wsrep_cluster_size | 1 |
+--------------------+-------+
```

__The default password is `new_password`.__

__Hint: Modify the MySQL command to see more info about the cluster, example: `SHOW STATUS LIKE 'wsrep%'`.__


### Step 4: Scale the cluster:

```
cfy executions start scale -d mariadb -p scalable_entity_name=app_group
```

When the scale workflow has succeeded, you can follow Step 3 again to see the cluster size has increased.

```
[centos@cloudify ~]$ ssh -i ~/.ssh/agent.key [email protected]
Last login: Tue Sep 26 10:24:02 2017 from 192.168.120.5
[centos@server-galera-host-7ituuu ~]$ mysql -u root -p -e "SHOW STATUS LIKE 'wsrep_cluster_size'"
Enter password:
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| wsrep_cluster_size | 2 |
+--------------------+-------+
```
Navigate to the deployment and select `Uninstall`. When the uninstall workflow is finished, select `Delete deployment`.
Loading

0 comments on commit 267ae34

Please sign in to comment.