diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..b92d650 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "submodules/solace-kubernetes-quickstart"] + path = submodules/solace-kubernetes-quickstart + url = https://github.com/SolaceProducts/solace-kubernetes-quickstart + branch = 68545 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..2abc067 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,115 @@ +# How to contribute to a Solace Project + +We'd love for you to contribute and welcome your help. Here are some guidelines to follow: + +- [Issues and Bugs](#issue) +- [Submitting a fix](#submitting) +- [Feature Requests](#features) +- [Questions](#questions) + +## Did you find a issue? + +* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/SolaceProducts/solace-gke-quickstart/issues). + +* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/SolaceProducts/solace-gke-quickstart/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring. + +## Did you write a patch that fixes a bug? + +Open a new GitHub pull request with the patch following the steps outlined below. Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable. + +Before you submit your pull request consider the following guidelines: + +* Search [GitHub](https://github.com/SolaceProducts/solace-gke-quickstart/pulls) for an open or closed Pull Request + that relates to your submission. You don't want to duplicate effort. + +### Submitting a Pull Request + +Please follow these steps for all pull requests. These steps are derived from the [GitHub flow](https://help.github.com/articles/github-flow/). + +#### Step 1: Fork + +Fork the project and clone your fork +locally. + +```sh +git clone https://github.com/SolaceProducts/solace-gke-quickstart +``` + +#### Step 2: Branch + +Make your changes on a new git branch in your fork of the repository. + +```sh +git checkout -b my-fix-branch master +``` + +#### Step 3: Commit + +Commit your changes using a descriptive commit message. + +```sh +git commit -a -m "Your Commit Message" +``` + +Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files. + +#### Step 4a: Rebase (if you have not yet pushed your branch to origin, else goto step 4b.) + +Assuming you have not yet pushed your branch to origin, use `git rebase` (not `git merge`) to synchronize your work with the main +repository. + +If you have not set the upstream, do so as follows: + +```sh +$ git remote add upstream https://github.com/SolaceProducts/solace-gke-quickstart +``` + +then: + +```sh +$ git fetch upstream +$ git rebase upstream/master +``` + +#### Step 4b: Merge (if you have already pushed our branch to origin) + +Assuming you have already pushed your branch to origin, use `git merge` (not `git rebase`) to synchronize your work with the main +repository. + +First ensure there are not any changes to master that you need to pick up, then merge in your changes. +You may need to resolve any conflicts on either of the merge steps. + +```sh +$ git merge master +$ git checkout master +$ git merge my-fix-branch +``` + + +#### Step 5: Push + +Push your branch to your fork in GitHub: + +```sh +git push origin my-fix-branch +``` + +#### Step 6: Pull Request + +In GitHub, send a pull request to `solace-samples-semp:master`. + +When fixing an existing issue, use the [commit message keywords](https://help.github.com/articles/closing-issues-via-commit-messages/) to close the associated GitHub issue. + +* If we suggest changes then: + * Make the required updates. + * Commit these changes to your branch (ex: my-fix-branch) + +That's it! Thank you for your contribution! + +## **Do you have an ideas for a new feature or a change to an existing one?** + +* Open a GitHub [enhancement request issue](https://github.com/SolaceProducts/solace-gke-quickstart/issues/new) and describe the new functionality. + +## Do you have questions about the source code? + +* Ask any question about the code or how to use Solace messaging in the [Solace community](http://dev.solace.com/community/). diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8dada3e --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index afd1bff..fe80a35 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,204 @@ -# solace-gke-quickstart -Quickstart to lauch a Solace VMR in Google Container Engine for Kubernetes +# Install a Solace Message Router onto a Google Container Engine (gke), cluster + +## Purpose of this repository + +This repository expands on [Solace Kubernetes Quickstart](https://github.com/SolaceProducts/solace-kubernetes-quickstart) to provide a concrete example of how to deploy a Solace VMR in standalone non-HA configuration on Google Container Engine on a single node GKE cluster. + +## Description of Solace VMR + +The Solace Virtual Message Router (VMR) provides enterprise-grade messaging capabilities deployable in any computing environment. The VMR provides the same rich feature set as Solace’s proven hardware appliances, with the same open protocol support, APIs and common management. The VMR can be deployed in the datacenter or natively within all popular private and public clouds. + +## How to Deploy a VMR onto GKE + +This is a 5 step process: + +[//]:# (Section 1 prereq is direct copy from here: https://cloud.google.com/container-registry/docs/quickstart) + +1. Create a project in Google Cloud Platform and enable prerequisites: +* In the Cloud Platform Console, go to the Manage resources page and select or create a new project. + + [GO TO THE MANAGE RESOURCES PAGE](https://console.cloud.google.com/cloud-resource-manager) + +* Enable billing for your project. Follow the guide from the below link. + + [ENABLE BILLING](https://support.google.com/cloud/answer/6293499#enable-billing) + +* Enable the Container Registry API. Follow the below link and select the project you created from above. + + [ENABLE THE API](https://console.cloud.google.com/flows/enableapi?apiid=containerregistry.googleapis.com) + + +
+
+ +2. Use the button below to go to the Solace Developer portal and request a Solace Community edition VMR. This process will return an email with a Download link. Do a right click "Copy Hyperlink" on the "Download the VMR Community Edition for Docker" hyperlink. This link is of the form "http://em.solace.com/???" and will be needed in the following section. + + + + + +3. Place Solace VMR in Google Container Registry: + +* Open a Google Cloud Shell from the Cloud Platform Console used to create the project, like this: + +![alt text](https://raw.githubusercontent.com/SolaceProducts/solace-gke-quickstart/68545/images/launch_google_cloud_shell.png "Google Cloud Shell") + +
+
+ +* In the Cloud Shell paste the following, (replace http://em.solace.com/??? with the link recieved in email from step 2.) + +```sh +wget https://raw.githubusercontent.com/SolaceProducts/solace-gke-quickstart/68545/scripts/copy_vmr_to_gkr.sh +chmod 755 copy_vmr_to_gkr.sh +./copy_vmr_to_gkr.sh -u http://em.solace.com/??? +``` + +
+
+ +* The script will end with a link required for next step. You can view the new entry on the google container registry in the Cloud Platform Console. + + +![alt text](https://raw.githubusercontent.com/SolaceProducts/solace-gke-quickstart/68545/images/google_container_registry.png "Google Container Registry") + +
+
+ +4. Use Google Cloud Shell to create GKE cluster of one node. + +* Download and execute the cluster create script in the Google Cloud Shell. All argument defaults should be ok for this example: + +```sh +wget https://raw.githubusercontent.com/SolaceProducts/solace-gke-quickstart/68545/scripts/create_cluster.sh +chmod 755 create_cluster.sh +./create_cluster.sh +``` + +
+
+ +5. Use Google Cloud Shell to deploy Pod and Service to that cluster. This will finish with a Solace VMR deployed to GKE. + +* Download and execute the cluster create and deployment script in the Google Cloud Shell. Replace `` with the desired password for the management `admin` user. Replace `` with the release tag of the image in the container registry. + +```sh +wget https://raw.githubusercontent.com/SolaceProducts/solace-kubernetes-quickstart/68545/scripts/start_vmr.sh +chmod 755 start_vmr.sh +./start_vmr.sh -p -i gcr.io/${DEVSHELL_PROJECT_ID}/solos-vmr: +``` + +
+
+ +#### Using other VMR deployment configurations + +In current configuration above script has created and started a small size non-HA VMR deployment with simple local non-persistent storage. + +For other deployment configuration options refer to the [Solace Kubernetes Quickstart](https://github.com/SolaceProducts/solace-kubernetes-quickstart). + +### Validate the Deployment + +Now you can validate your deployment in the Google Cloud Shell: + +```sh +prompt:~$kubectl get statefulset,services,pods,pvc +NAME DESIRED CURRENT AGE +statefulsets/XXX-XXX-solace-kubernetes 1 1 2m +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +svc/kubernetes ClusterIP 10.19.240.1 443/TCP 26m +svc/XXX-XXX-solace-kubernetes LoadBalancer 10.19.245.131 104.154.136.44 22:31061/TCP,8080:30037/TCP,55555:31723/TCP 2m +NAME READY STATUS RESTARTS AGE +po/XXX-XXX-solace-kubernetes-0 1/1 Running 0 2m +NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE +pvc/data-XXX-XXX-solace-kubernetes-0 Bound pvc-63ce3ad3-cae1-11e7-ae62-42010a800120 30Gi RWO XXX-XXX-standard 2 + + +prompt:~$ kubectl describe service XXX-XXX-solace-kubernetes +Name: XXX-XXX-solace-kubernetes +Namespace: default +Labels: app=solace-kubernetes + chart=solace-kubernetes-0.1.0 + heritage=Tiller + release=XXX-XXX +Annotations: +Selector: app=solace-kubernetes,release=XXX-XXX +Type: LoadBalancer +IP: 10.19.245.131 +LoadBalancer Ingress: 104.154.54.154 +Port: ssh 22/TCP +TargetPort: 22/TCP +NodePort: ssh 31061/TCP +Endpoints: 10.16.0.12:22 +: +: +``` + +
+ +Note here serveral IPs and port. In this example 104.154.54.154 is the external IP to use, This can also be seen from the google cloud console: + +![alt text](https://raw.githubusercontent.com/SolaceProducts/solace-gke-quickstart/68545/images/google_container_loadbalancer.png "GKE Load Balancer") + +### Viewing bringup logs + +It is possible to watch the VMR come up via logs in the Google Cloud Platform log stack. Inside Logging look for GKE Container, solace-vmr-cluster. In the example below the Solace admin password was not set, therefore the container would not come up and exited. + +![alt text](https://raw.githubusercontent.com/SolaceProducts/solace-gke-quickstart/68545/images/gke_log_stack.png "GKE Log Stack") + +
+
+ +## Gaining admin access to the VMR + +For persons used to working with Solace message router console access, this is still available with standard ssh session from any internet at port 22 by default: + +```sh +$ssh -p 22 admin@104.154.54.154 +Solace - Virtual Message Router (VMR) +Password: + +System Software. SolOS-TR Version 8.6.0.1010 + +Virtual Message Router (Message Routing Node) + +Copyright 2004-2017 Solace Corporation. All rights reserved. + +This is the Community Edition of the Solace VMR. + +XXX-XXX-solace-kubernetes-0> +``` + +For persons who are unfamiliar with the Solace mesage router or would prefer an administration application the SolAdmin management application is available. For more information on SolAdmin see the [SolAdmin page](http://dev.solace.com/tech/soladmin/). To get SolAdmin, visit the Solace [download page](http://dev.solace.com/downloads/) and select OS version desired. Management IP will be the Public IP associated with youe GCE instance and port will be 8080 by default. + +![alt text](https://raw.githubusercontent.com/SolaceProducts/solace-gke-quickstart/68545/images/gce_soladmin.png "soladmin connection to gce") + +
+ +## Testing data access to the VMR + +To test data traffic though the newly created VMR instance, visit the Solace developer portal and select your preferred programming langauge to [send and receive messages](http://dev.solace.com/get-started/send-receive-messages/). Under each language there is a Publish/Subscribe tutorial that will help you get started. + +![alt text](https://raw.githubusercontent.com/SolaceProducts/solace-gke-quickstart/68545/images/solace_tutorial.png "getting started publish/subscribe") + +
+ +## Contributing + +Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us. + +## Authors + +See the list of [contributors](https://github.com/SolaceProducts/solace-gke-quickstart/graphs/contributors) who participated in this project. + +## License + +This project is licensed under the Apache License, Version 2.0. - See the [LICENSE](LICENSE) file for details. + +## Resources + +For more information about Solace technology in general please visit these resources: + +* The Solace Developer Portal website at: http://dev.solace.com +* Understanding [Solace technology.](http://dev.solace.com/tech/) +* Ask the [Solace community](http://dev.solace.com/community/). diff --git a/images/gce_soladmin.png b/images/gce_soladmin.png new file mode 100644 index 0000000..210d5b8 Binary files /dev/null and b/images/gce_soladmin.png differ diff --git a/images/gke_log_stack.png b/images/gke_log_stack.png new file mode 100644 index 0000000..131f39d Binary files /dev/null and b/images/gke_log_stack.png differ diff --git a/images/google_container_loadbalancer.png b/images/google_container_loadbalancer.png new file mode 100644 index 0000000..ad20957 Binary files /dev/null and b/images/google_container_loadbalancer.png differ diff --git a/images/google_container_registry.png b/images/google_container_registry.png new file mode 100644 index 0000000..0e9bc6b Binary files /dev/null and b/images/google_container_registry.png differ diff --git a/images/launch_google_cloud_shell.png b/images/launch_google_cloud_shell.png new file mode 100644 index 0000000..36cba40 Binary files /dev/null and b/images/launch_google_cloud_shell.png differ diff --git a/images/solace_console.png b/images/solace_console.png new file mode 100644 index 0000000..eb99855 Binary files /dev/null and b/images/solace_console.png differ diff --git a/images/solace_tutorial.png b/images/solace_tutorial.png new file mode 100644 index 0000000..e359c02 Binary files /dev/null and b/images/solace_tutorial.png differ diff --git a/scripts/copy_vmr_to_gkr.sh b/scripts/copy_vmr_to_gkr.sh new file mode 100644 index 0000000..705ea80 --- /dev/null +++ b/scripts/copy_vmr_to_gkr.sh @@ -0,0 +1,93 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# The purpose of this script is to: +# - take a URL to a Solace VMR docker container +# - validate the container against known MD5 +# - load the container to create a local instance +# - upload the instance into google container registery +# - clean up load docker + +OPTIND=1 # Reset in case getopts has been used previously in the shell. + +# Initialize our own variables: +solace_url="" + +verbose=0 + +while getopts "u:" opt; do + case "$opt" in + u) solace_url=$OPTARG + ;; + esac +done + +shift $((OPTIND-1)) +[ "$1" = "--" ] && shift + +verbose=1 +echo "`date` INFO: solace_url=$solace_url ,Leftovers: $@" + +solace_directory=. + +echo "`date` INFO: RETRIEVE SOLACE DOCKER IMAGE" +echo "#############################################################" +echo "`date` INFO: check to make sure we have a complete load" +wget -O ${solace_directory}/solos.info -nv https://products.solace.com/download/VMR_DOCKER_COMM_MD5 +IFS=' ' read -ra SOLOS_INFO <<< `cat ${solace_directory}/solos.info` +MD5_SUM=${SOLOS_INFO[0]} +SolOS_LOAD=${SOLOS_INFO[1]} +echo "`date` INFO: Reference md5sum is: ${MD5_SUM}" + +wget -q -O solace-redirect ${solace_url} +REAL_LINK=`egrep -o "https://[a-zA-Z0-9\.\/\_\?\=]*" ${solace_directory}/solace-redirect` +wget -q -O ${solace_directory}/${SolOS_LOAD} ${REAL_LINK} +cd ${solace_directory} +LOCAL_OS_INFO=`md5sum ${SolOS_LOAD}` +IFS=' ' read -ra SOLOS_INFO <<< ${LOCAL_OS_INFO} +LOCAL_MD5_SUM=${SOLOS_INFO[0]} +if [ ${LOCAL_MD5_SUM} != ${MD5_SUM} ]; then + echo "`date` WARN: Possible corrupt SolOS load, md5sum do not match" +else + echo "`date` INFO: Successfully downloaded ${SolOS_LOAD}" +fi + +echo "`date` INFO: LOAD DOCKER IMAGE INTO LOCALLY" +echo "##################################################################" +docker load -i ${solace_directory}/${SolOS_LOAD} + +local_repo=`docker images solace-app | grep solace-app` +echo "`date` INFO: Current docker images are:" +echo ${local_repo} + +tag=`echo $local_repo | awk '{print$2}'` +imageId=`echo $local_repo | awk '{print$3}'` + +echo "`date` INFO: PUSH SOLACE VMR INSTANCE INTO GOOGLE CONTAINER REGISTRY" +echo "####################################################################################" +docker tag ${imageId} gcr.io/${DEVSHELL_PROJECT_ID}/solos-vmr:${tag} +gcloud docker -- push gcr.io/${DEVSHELL_PROJECT_ID}/solos-vmr:${tag} + +echo "`date` INFO: Cleanup" +echo "#################################" + +docker rmi gcr.io/${DEVSHELL_PROJECT_ID}/solos-vmr:${tag} +docker rmi ${imageId} + +export SOLACE_IMAGE=gcr.io/${DEVSHELL_PROJECT_ID}/solos-vmr:${tag} +echo "`date` INFO: Record the image reference in the GCR you will need to for next steps" +echo "SOLACE_IMAGE=gcr.io/${DEVSHELL_PROJECT_ID}/solos-vmr:${tag}" \ No newline at end of file diff --git a/scripts/create_cluster.sh b/scripts/create_cluster.sh new file mode 100644 index 0000000..3a6403d --- /dev/null +++ b/scripts/create_cluster.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# The purpose of this script is to: +# - take a URL to a Solace VMR docker container +# - validate the container against known MD5 +# - load the container to create a local instance +# - upload the instance into google container registery +# - clean up load docker + + +OPTIND=1 # Reset in case getopts has been used previously in the shell. + +# Initialize our own variables: +cluster_name="solace-vmr-cluster" +machine_type="n1-standard-4" +number_of_nodes="1" +zone="us-central1-b" +verbose=0 + +while getopts "c:m:n:z:" opt; do + case "$opt" in + c) cluster_name=$OPTARG + ;; + m) machine_type=$OPTARG + ;; + n) number_of_nodes=$OPTARG + ;; + z) zone=$OPTARG + ;; + esac +done + +shift $((OPTIND-1)) +[ "$1" = "--" ] && shift + +verbose=1 +echo "`date` INFO: cluster_name=${cluster_name}, machine_type=${machine_type}, number_of_nodes=${number_of_nodes} zone=${zone} ,Leftovers: $@" + +echo "`date` INFO: INITIALIZE GCLOUD" +echo "#############################################################" +gcloud components install kubectl +gcloud config set compute/zone ${zone} + +echo "`date` INFO: CREATE CLUSTER" +echo "#############################################################" +gcloud container clusters create ${cluster_name} --machine-type=${machine_type} --num-nodes=${number_of_nodes} +gcloud container clusters get-credentials ${cluster_name} \ No newline at end of file diff --git a/submodules/solace-kubernetes-quickstart b/submodules/solace-kubernetes-quickstart new file mode 160000 index 0000000..acf1804 --- /dev/null +++ b/submodules/solace-kubernetes-quickstart @@ -0,0 +1 @@ +Subproject commit acf18046da0914b385b104f755edd3898b5eb97a