├── .bluemix ├── deploy.json ├── icon.svg ├── pipeline.yml ├── toolchain.svg └── toolchain.yml ├── .travis.yml ├── ACKNOWLEDGEMENTS.md ├── CONTRIBUTING.md ├── LICENSE ├── MAINTAINERS.md ├── README-cn.md ├── README-ko.md ├── README.md ├── containers ├── gameon-proxy │ ├── Dockerfile │ ├── haproxy-dev.cfg │ ├── haproxy-ics.cfg │ ├── haproxy.cfg │ ├── icsBuild.sh │ ├── icsDeploy.sh │ ├── idsBuild.sh │ ├── proxy.pem │ └── startup.sh └── setup │ ├── Dockerfile │ ├── README.md │ └── gen-keystore.sh ├── core ├── auth.yaml ├── map.yaml ├── mediator.yaml ├── player.yaml ├── proxy.yaml ├── room.yaml └── webapp.yaml ├── gameon-configmap.yaml ├── images ├── addroom1.png ├── addroom2.png ├── addroom3.png ├── game.png ├── gameon-microservices-code.png ├── gameon-microservices-code2.png ├── gameon-microservices.png ├── github.png ├── home.png ├── twitter.png └── user.png ├── local-volume.yaml ├── platform ├── controller.yaml ├── couchdb.yaml ├── kafka.yaml ├── redis.yaml └── registry.yaml ├── sample-room └── javaroom.yaml ├── scripts ├── README.md ├── deploy-to-bluemix │ ├── bx_login.sh │ ├── deploy.sh │ └── install_bx.sh └── install.sh └── setup.yaml /.bluemix/deploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "title": "Sample Deploy Stage", 4 | "description": "sample toolchain", 5 | "longDescription": "The Delivery Pipeline automates continuous deployment.", 6 | "type": "object", 7 | "properties": { 8 | "prod-region": { 9 | "description": "The bluemix region", 10 | "type": "string" 11 | }, 12 | "prod-organization": { 13 | "description": "The bluemix org", 14 | "type": "string" 15 | }, 16 | "prod-space": { 17 | "description": "The bluemix space", 18 | "type": "string" 19 | }, 20 | "prod-app-name": { 21 | "description": "The name of your Hello World app", 22 | "type": "string" 23 | } 24 | }, 25 | "required": ["prod-region", "prod-organization", "prod-space", "prod-app-name"], 26 | "form": [ 27 | { 28 | "type": "validator", 29 | "url": "/devops/setup/bm-helper/helper.html" 30 | }, 31 | { 32 | "type": "text", 33 | "readonly": false, 34 | "title": "App name", 35 | "key": "prod-app-name" 36 | }, 37 | { 38 | "type": "table", 39 | "columnCount": 4, 40 | "widths": ["15%", "28%", "28%", "28%"], 41 | "items": [ 42 | { 43 | "type": "label", 44 | "title": "" 45 | }, 46 | { 47 | "type": "label", 48 | "title": "Region" 49 | }, 50 | { 51 | "type": "label", 52 | "title": "Organization" 53 | }, 54 | { 55 | "type": "label", 56 | "title": "Space" 57 | }, 58 | { 59 | "type": "label", 60 | "title": "Production stage" 61 | }, 62 | { 63 | "type": "select", 64 | "key": "prod-region" 65 | }, 66 | { 67 | "type": "select", 68 | "key": "prod-organization" 69 | }, 70 | { 71 | "type": "select", 72 | "key": "prod-space", 73 | "readonly": false 74 | } 75 | ] 76 | } 77 | ] 78 | } 79 | -------------------------------------------------------------------------------- /.bluemix/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 24 | 25 | 26 | 27 | 28 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /.bluemix/pipeline.yml: -------------------------------------------------------------------------------- 1 | --- 2 | stages: 3 | - name: BUILD 4 | inputs: 5 | - type: git 6 | branch: master 7 | service: ${SAMPLE_REPO} 8 | triggers: 9 | - type: commit 10 | jobs: 11 | - name: Build 12 | type: builder 13 | artifact_dir: '' 14 | build_type: shell 15 | script: |- 16 | #!/bin/bash 17 | bash -n *.sh 18 | - name: DEPLOY 19 | inputs: 20 | - type: job 21 | stage: BUILD 22 | job: Build 23 | dir_name: null 24 | triggers: 25 | - type: stage 26 | properties: 27 | - name: BLUEMIX_USER 28 | type: text 29 | - name: BLUEMIX_PASSWORD 30 | type: secure 31 | - name: BLUEMIX_ACCOUNT 32 | type: secure 33 | - name: CLUSTER_NAME 34 | type: text 35 | - name: API_KEY 36 | type: secure 37 | jobs: 38 | - name: Deploy 39 | type: deployer 40 | target: 41 | region_id: ${PROD_REGION_ID} 42 | organization: ${PROD_ORG_NAME} 43 | space: ${PROD_SPACE_NAME} 44 | application: Pipeline 45 | script: | 46 | #!/bin/bash 47 | . ./scripts/deploy-to-bluemix/install_bx.sh 48 | ./scripts/deploy-to-bluemix/bx_login.sh 49 | ./scripts/deploy-to-bluemix/deploy.sh 50 | hooks: 51 | - enabled: true 52 | label: null 53 | ssl_enabled: false 54 | url: https://devops-api-integration.stage1.ng.bluemix.net/v1/messaging/webhook/publish 55 | -------------------------------------------------------------------------------- /.bluemix/toolchain.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 36 | 37 | background 38 | 39 | 40 | 41 | Layer 1 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 83 | 84 | 85 | 86 | 88 | 89 | 90 | 91 | 92 | 93 | 96 | 97 | 98 | 99 | 101 | 102 | 103 | 104 | 105 | 107 | 108 | 109 | 110 | 112 | 116 | 118 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 135 | 138 | 139 | 140 | 142 | 143 | 144 | 145 | 148 | 151 | 152 | 168 | 169 | 170 | 173 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 203 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 225 | 226 | 228 | 231 | 232 | 233 | 235 | 236 | 237 | 238 | 241 | 244 | 245 | 261 | 262 | 263 | 266 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 279 | 280 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | ISSUE TRACKER 317 | GitHub 318 | THINK 319 | CODE 320 | DELIVER 321 | RUN 322 | REPOSITORY 323 | GitHub 324 | PIPELINE 325 | BLUEMIX 326 | WEB IDE 327 | 328 | 329 | -------------------------------------------------------------------------------- /.bluemix/toolchain.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Deploy GameOn! Java Microservices sample to Bluemix" 3 | description: "Toolchain to deploy GameOn! Java Microservices on Kubernetes Cluster to Bluemix" 4 | version: 0.1 5 | image: data:image/svg+xml;base64,$file(toolchain.svg,base64) 6 | icon: data:image/svg+xml;base64,$file(icon.svg,base64) 7 | required: 8 | - deploy 9 | - sample-repo 10 | 11 | # Github repos 12 | sample-repo: 13 | service_id: githubpublic 14 | parameters: 15 | repo_name: "{{name}}" 16 | repo_url: https://github.com/IBM/GameOn-Java-Microservices-on-Kubernetes.git 17 | type: fork 18 | has_issues: false 19 | 20 | # Pipelines 21 | sample-build: 22 | service_id: pipeline 23 | parameters: 24 | name: "{{name}}" 25 | ui-pipeline: true 26 | configuration: 27 | content: $file(pipeline.yml) 28 | env: 29 | SAMPLE_REPO: "sample-repo" 30 | CF_APP_NAME: "{{deploy.parameters.prod-app-name}}" 31 | PROD_SPACE_NAME: "{{deploy.parameters.prod-space}}" 32 | PROD_ORG_NAME: "{{deploy.parameters.prod-organization}}" 33 | PROD_REGION_ID: "{{deploy.parameters.prod-region}}" 34 | execute: true 35 | services: ["sample-repo"] 36 | hidden: [form, description] 37 | 38 | #Deployment 39 | deploy: 40 | schema: 41 | $ref: deploy.json 42 | service-category: pipeline 43 | parameters: 44 | prod-app-name: "{{sample-repo.parameters.repo_name}}" 45 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: bash 2 | script: true 3 | sudo: required 4 | before_install: 5 | - bash scripts/install.sh 6 | group: stable 7 | dist: precise 8 | os: linux 9 | notifications: 10 | slack: 11 | secure: hDrr73QN8Fyay6o/ByGgECUdf9BxW2jYgyULFGgF+0OW0zerfG91ASuflUkd60z1hpQcV3PRPMHtw0HBEx4GRSV/CsKNdaOFML3K70pcHn8wcXDiq1RSbInhwfFIkJpssBkJgk1XMAapCfDot+wdd8WhA5Pa1RT5UbvSjg9Xi/sIrKLdnBvKGaOKVSkLLuMmC7U99Yl4U/oYpCCqQys838ZCegbNDgn1ZhomRBBKi02d4wk9xBdiE6CtdmfDrKMZKdvuLN4bUDAXN9DVxV8o6kY1F1Y9ufiAxLC0cThxpwGYebE8Tv1EvinuNNqkhxyKTS5PqNIEiI9vRti4BQ5qYR7kilQGcAy7AZ24YJO7TxtiVpI/pyHanFcgu7Z6bUcETpB1wzl/gP/AA2l0TzY/39mnuWihiH+nWkfcBMNW4mJbvHXlzAkZ7mzHqMKaHSQjxuEDWz6jzdy7xIO5mPLEH83x7ciQ9xQFmhBjg0glXieaINcdkNdC5hnWjBUwkFaoopN5o+1MX2j/0Y7fJNwVd6bbelHhbghkRNcL7wXxk7OnB3ekQfRmHgmjtE0wOTCCJhOHEZdNu7XMi6FRItgBD0cv1wiImdiBX3HwtXO9bVV20KqKLb6lYuUT/rbASg53OqGBFky/5PblZpbJ9vl8gFi3ELmfv3/PtEjduWeZ4Eg= 12 | on_failure: always 13 | on_success: change 14 | -------------------------------------------------------------------------------- /ACKNOWLEDGEMENTS.md: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | Original Developers of [GameOn](https://gameontext.org) app. 3 | * [Erin Schnabel](https://github.com/ebullient) 4 | * [Ozzy Osborne](https://github.com/BarDweller) 5 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | This is an open source project, and we appreciate your help! 4 | 5 | We use the GitHub issue tracker to discuss new features and non-trivial bugs. 6 | 7 | In addition to the issue tracker, [#journeys on 8 | Slack](https://dwopen.slack.com) is the best way to get into contact with the 9 | project's maintainers. 10 | 11 | To contribute code, documentation, or tests, please submit a pull request to 12 | the GitHub repository. Generally, we expect two maintainers to review your pull 13 | request before it is approved for merging. For more details, see the 14 | [MAINTAINERS](MAINTAINERS.md) page. 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | # Maintainers Guide 2 | 3 | This guide is intended for maintainers - anybody with commit access to one or 4 | more Code Pattern repositories. 5 | 6 | ## Methodology 7 | 8 | This repository does not have a traditional release management cycle, but 9 | should instead be maintained as as a useful, working, and polished reference at 10 | all times. While all work can therefore be focused on the master branch, the 11 | quality of this branch should never be compromised. 12 | 13 | The remainder of this document details how to merge pull requests to the 14 | repositories. 15 | 16 | ## Merge approval 17 | 18 | The project maintainers use LGTM (Looks Good To Me) in comments on the pull 19 | request to indicate acceptance prior to merging. A change requires LGTMs from 20 | two project maintainers. If the code is written by a maintainer, the change 21 | only requires one additional LGTM. 22 | 23 | ## Reviewing Pull Requests 24 | 25 | We recommend reviewing pull requests directly within GitHub. This allows a 26 | public commentary on changes, providing transparency for all users. When 27 | providing feedback be civil, courteous, and kind. Disagreement is fine, so long 28 | as the discourse is carried out politely. If we see a record of uncivil or 29 | abusive comments, we will revoke your commit privileges and invite you to leave 30 | the project. 31 | 32 | During your review, consider the following points: 33 | 34 | ### Does the change have positive impact? 35 | 36 | Some proposed changes may not represent a positive impact to the project. Ask 37 | whether or not the change will make understanding the code easier, or if it 38 | could simply be a personal preference on the part of the author (see 39 | [bikeshedding](https://en.wiktionary.org/wiki/bikeshedding)). 40 | 41 | Pull requests that do not have a clear positive impact should be closed without 42 | merging. 43 | 44 | ### Do the changes make sense? 45 | 46 | If you do not understand what the changes are or what they accomplish, ask the 47 | author for clarification. Ask the author to add comments and/or clarify test 48 | case names to make the intentions clear. 49 | 50 | At times, such clarification will reveal that the author may not be using the 51 | code correctly, or is unaware of features that accommodate their needs. If you 52 | feel this is the case, work up a code sample that would address the pull 53 | request for them, and feel free to close the pull request once they confirm. 54 | 55 | ### Does the change introduce a new feature? 56 | 57 | For any given pull request, ask yourself "is this a new feature?" If so, does 58 | the pull request (or associated issue) contain narrative indicating the need 59 | for the feature? If not, ask them to provide that information. 60 | 61 | Are new unit tests in place that test all new behaviors introduced? If not, do 62 | not merge the feature until they are! Is documentation in place for the new 63 | feature? (See the documentation guidelines). If not do not merge the feature 64 | until it is! Is the feature necessary for general use cases? Try and keep the 65 | scope of any given component narrow. If a proposed feature does not fit that 66 | scope, recommend to the user that they maintain the feature on their own, and 67 | close the request. You may also recommend that they see if the feature gains 68 | traction among other users, and suggest they re-submit when they can show such 69 | support. 70 | -------------------------------------------------------------------------------- /README-cn.md: -------------------------------------------------------------------------------- 1 |  [![构建状态](https://travis-ci.org/IBM/GameOn-Java-Microservices-on-Kubernetes.svg?branch=master)](https://travis-ci.org/IBM/GameOn-Java-Microservices-on-Kubernetes) 2 | *阅读本文的其他语言版本:[English](README.md)。* 3 | # GameOn! Kubernetes 上的 Java 微服务与多语言生态系统 4 | 5 | 此代码将演示如何将一个基于微服务的应用程序 [Game On!](https://book.gameontext.org) 部署在 Kubernetes 集群上,让它与一个多语言生态系统共存。Game On! 是一个基于文本的复古冒险游戏,旨在帮助您探索微服务架构和相关概念。GameOn! 部署有两组微服务:核心和平台。核心微服务是用 Java 编写的,与其他多语言微服务共存。此外,还有一些平台服务,它们为不同微服务提供服务发现、注册和路由功能。所有微服务都在 Kubernetes 集群管理的 Docker 容器中运行。 6 | 7 | ![gameon](images/gameon-microservices-code2.png) 8 | 9 | ### 核心微服务: 10 | 11 | 有 5 个核心 Java 微服务,它们使用了 [MicroProfile](http://microprofile.io) 规范的 [JAX-RS](https://en.wikipedia.org/wiki/Java_API_for_RESTful_Web_Services)、[CDI](https://dzone.com/articles/cdi-di-p1) 等部分。 12 | 13 | - [Player](https://github.com/gameontext/gameon-player):玩家通过 Player Java 微服务来表示,该微服务提供一个公共 API 来执行 CRUD 操作和管理 API 令牌。 14 | - [Auth](https://github.com/gameontext/gameon-auth):该 Java 微服务允许玩家通过选定的“社交登录”建立连接并标识自己 15 | - [Mediator](https://github.com/gameontext/gameon-mediator):Mediator 服务是在 Java 中使用 WebSphere Liberty 实现的,并通过 WebSocket 将玩家连接到各个房间 16 | - [Map](https://github.com/gameontext/gameon-map):Map 服务是一个在 WebSphere Liberty 上运行的 Java EE 应用程序,它使用 JAX-RS 提供一个公共 REST API。它将数据存储在一个 NoSQL 数据存储中:couchdb 或 Cloudant 17 | - [Room](https://github.com/gameontext/gameon-room):基于 Java 的房间实现 18 | 19 | 此外,Proxy 和 WebApp 为核心服务提供了补充 20 | 21 | - [Proxy](https://github.com/gameontext/gameon-proxy):基于 HAProxy,并负责将 API 集合呈现为整个应用程序的单一方面。 22 | - [WebApp](https://github.com/gameontext/gameon-webapp):Webapp 是一个简单的 nginx 流程,为组成用户界面前端的静态文件提供服务。 23 | 24 | ### 平台服务: 25 | 26 | - [服务发现、注册表和路由](https://www.amalgam8.io/):服务注册表和路由组件,服务发现和服务代理就是通过它们来实现的。此外,每个服务都有关联的 sidecar,sidecar 自动向注册表注册关联的微服务。 27 | - [Redis]():存储 Sidecar 使用的地址 28 | - [Kafka](https://kafka.apache.org):发布/订阅由服务和平台使用的解决方案。 29 | 30 | ## 前提条件 31 | 32 | 要本地部署游戏,可通过 GameOn 存储库中的 docker-compose [可在此处获得](https://github.com/gameontext/gameon#local-room-development) 按照说明进行操作。 33 | 34 | 要执行这里的步骤,可使用 [IBM Bluemix Container 服务](https://github.com/IBM/container-journey-template) 创建一个 Kubernetes 集群,以便在云中执行部署。这里的代码会定期使用 Travis 针对[来自 Bluemix Container 服务的 Kubernetes 集群](https://console.ng.bluemix.net/docs/containers/cs_ov.html#cs_ov) 进行测试。 35 | 36 | ## 部署到 Bluemix 上的 Kubernetes 集群中 37 | 如果想将 GameOn! 直接部署到 Bluemix,请单击下面的 Deploy to Bluemix 按钮,创建一个 Bluemix DevOps 服务工具链和管道来部署样本,否则可跳到[步骤](#steps) 38 | 39 | > 您需要先创建 Kubernetes 集群,确保已使用您的 Bluemix 帐户完全部署它。 40 | 41 | [![创建工具链](https://github.com/IBM/container-journey-template/blob/master/images/button.png)](https://console.ng.bluemix.net/devops/setup/deploy/?repository=https://github.com/IBM/GameOn-Java-Microservices-on-Kubernetes) 42 | 43 | 请按照[工具链操作说明](https://github.com/IBM/container-journey-template/blob/master/Toolchain_Instructions_new.md) 完成您的工具链和管道。 44 | 45 | ## 步骤 46 | 1.[修改核心服务 yaml 文件](#1-modify-the-core-services-yaml-files) 47 | 48 | 2.[为您的集群创建一个卷](#2-create-a-volume-for-your-cluster) 49 | 50 | 3.[创建平台服务](#3-create-the-platform-services) 51 | 52 | 4.[创建核心服务](#4-create-the-core-services) 53 | 54 | 5.[探索您的 GameOn 应用程序](#5-explore-your-gameon-app) 55 | 56 | - 5.1 [添加社交登录](#51-add-social-logins) 57 | 58 | - 5.2 [添加房间](#52-add-rooms) 59 | 60 | #### [故障排除](#troubleshooting-1) 61 | 62 | # 1.修改 ConfigMap yaml 文件 63 | 更改 `gameon-configmap.yaml` 文件上的以下值。将 `PLACEHOLDER_IP` 更改为您的集群的公共 IP。可以从 Bluemix Container 服务的 `bx cs workers <您的集群名称>` 获取该 IP。例如:`192.168.99.100` 64 | > 对于 minikube,可以使用 `minikube ip` 获取 IP 65 | 66 | ```yaml 67 | FRONT_END_PLAYER_URL: https://PLACEHOLDER_IP:30443/players/v1/accounts 68 | FRONT_END_SUCCESS_CALLBACK: https://PLACEHOLDER_IP:30443/#/login/callback 69 | FRONT_END_FAIL_CALLBACK: https://PLACEHOLDER_IP:30443/#/game 70 | FRONT_END_AUTH_URL: https://PLACEHOLDER_IP:30443/auth 71 | ... 72 | PROXY_DOCKER_HOST: 'PLACEHOLDER_IP' 73 | ``` 74 | 75 | 一种更改这些值的简单方法是运行 76 | `sed -i s#PLACEHOLDER_IP##g gameon-configmap.yaml`。 78 | 79 | 然后将该配置图应用到您的集群上: 80 | ```bash 81 | $ kubectl create -f gameon-configmap.yaml 82 | configmap "gameon-env" created 83 | ``` 84 | 85 | # 2.为您的集群创建一个卷 86 | 您需要为您的集群创建一个卷。可以使用已提供的 yaml 文件。所需的密钥库将存储在这个卷中。[核心服务](#core-microservices) 也会使用这个卷。 87 | ```bash 88 | $ kubectl create -f local-volume.yaml 89 | persistent volumes "local-volume-1" created 90 | persistent volumes "keystore-claim" created 91 | ``` 92 | 93 | 现在可以使用 **setup.yaml** 文件创建所需的密钥库。这将创建一个 Pod 并创建密钥库。 94 | ```bash 95 | $ kubectl create -f setup.yaml 96 | ``` 97 | 98 | > 可以在 [containers/setup/ 文件夹](containers/setup) 中找到生成密钥库的 Dockerfile 和脚本。可以使用所提供的 Dockerfile 构建您自己的镜像。 99 | 100 | 完成后,Pod 将不会再次运行。可以在使用 `kubectl delete pod setup` 后删除该 Pod(可选)。 101 | 102 | 如果想确认该 Pod 已成功导入密钥库,可以查看该 Pod 的日志。 103 | ```bash 104 | $ kubectl logs setup 105 | Checking for keytool... 106 | Checking for openssl... 107 | Generating key stores using :30443 108 | Certificate stored in file 109 | Certificate was added to keystore 110 | Certificate reply was installed in keystore 111 | Certificate stored in file 112 | MAC verified OK 113 | Certificate was added to keystore 114 | Entry for alias <*> successfully imported. 115 | ... 116 | Entry for alias <**> successfully imported. 117 | Import command completed: 104 entries successfully imported, 0 entries failed or cancelled 118 | ``` 119 | 120 | # 3.创建平台服务 121 | 现在可以创建[平台服务](#platform-services) 并部署应用程序了。 122 | ```bash 123 | $ kubectl create -f platform 124 | OR alternatively 125 | $ kubectl create -f platform/controller.yaml 126 | $ kubectl create -f platform/.yaml 127 | ... 128 | $ kubectl create -f platform/registry.yaml 129 | ``` 130 | 131 | 检查控制面板(控制器和注册表)是否在运行: 132 | ```bash 133 | $ curl -sw "%{http_code}" ":31200/health" -o /dev/null 134 | $ curl -sw "%{http_code}" ":31300/uptime" -o /dev/null 135 | ``` 136 | 如果二者都输出 200,那么可以继续执行下一步。 137 | > 备注:可能要花 1-2 分钟的时间,才能完成 Pod 设置。 138 | 139 | # 4.创建核心服务 140 | 最后,可以创建 **[核心服务](#core-microservices)** 并部署该应用程序。 141 | *(如果想要采用社交登录,请在部署[核心服务](#core-microservices) 前执行[此处](#a-adding-social-logins) 的步骤)* 142 | 143 | 144 | ```bash 145 | $ kubectl create -f core 146 | OR alternatively 147 | $ kubectl create -f core/auth.yaml 148 | $ kubectl create -f core/.yaml 149 | ... 150 | $ kubectl create -f core/webapp.yaml 151 | ``` 152 | 要验证[核心服务](#core-microservices) 是否已完成设置,需要检查代理的 Pod 的日志。可以使用 **kubectl get pods** 获取代理的 Pod 名称 153 | ```bash 154 | kubectl logs proxy-***-** 155 | ``` 156 | 您应该查找 map、auth、mediator、player 和 room 服务器。确认它们都在运行。 157 | ```bash 158 | [WARNING] 094/205214 (11) : Server room/room1 is UP, reason: Layer7 check passed ... 159 | [WARNING] 094/205445 (11) : Server auth/auth1 is UP, reason: Layer7 check passed ... 160 | [WARNING] 094/205531 (11) : Server map/map1 is UP, reason: Layer7 check passed ... 161 | [WARNING] 094/205531 (11) : Server mediator/mediator1 is UP, reason: Layer7 check passed ... 162 | [WARNING] 094/205531 (11) : Server player/player1 is UP, reason: Layer7 check passed ... 163 | ``` 164 | > 可能要花 5-10 分钟的时间,才能完成这些服务的设置。 165 | 166 | # 5.探索您的 GameOn 应用程序 167 | 168 | 现在您已成功将自己的应用程序部署到 Bluemix Kubernetes Container 服务中,可以通过它的 IP 地址和分配的端口访问它。 169 | > https://169.xxx.xxx.xxx:30443/ 170 | > 您需要在端口 30443 上使用 https。 171 | 172 | * 您会在该地址上看到您的应用程序的主页。 173 | ![主页](images/home.png) 174 | * 单击 Enter 键以匿名用户身份进行登录(如果您想使用 Github、witter 等网站上的帐户,需要设置您自己的 Social Login API 密钥) 175 | ![用户](images/user.png) 176 | * 该应用程序会提示您输入您想要的 **Username** 和 **Favorite Color** 177 | ![游戏](images/game.png) 178 | * **恭喜您!您现在已经让自己的 GameOn 应用程序在 Bluemix 上运行!您现在可能希望探索如何创建新房间和添加社交登录。** 179 | * GameOn 应用程序中的命令: 180 | * `/help` - 列出所有可用的命令 181 | * `/sos` - 返回到第一个房间 182 | * `/exits` - 列出所有可用的出口 183 | * `/go ` - 转到该方向上的房间 184 | 185 | # 5.1 添加社交登录 186 | 您可能想要添加社交登录,以便能与好友一起探索房间。 187 | 要添加社交登录,需要在您想要使用的社交应用程序上拥有开发人员帐户。 188 | 189 | > 您需要使用自己修改的 yaml 文件重新部署**[核心服务](#core-microservices)**。下一步将介绍在何处添加 API 密钥。 190 | 191 | 192 | ## Github 193 | 可以在这个链接中注册您的应用程序:[新的 OAuth 应用程序](https://github.com/settings/applications/new) 194 | ![Github](images/github.png) 195 | 对于主页 URL,需要输入您的集群 IP 地址和端口 30443。 196 | > https://169.xxx.xxx.xxx:30443/#/ 197 | 198 | 对于授权回调 URL,需要输入该 IP 地址和端口 30443,并指向该应用程序的身份验证服务。 199 | > https://169.xxx.xxx.xxx:30443/auth/GitHubCallback 200 | 201 | 如果在以后创建了一个新集群,可以在 GitHub 中编辑该信息。 202 | 现在,请记下该应用程序的 **Username** 和 **Favorite Color**。 203 | 您需要将此信息添加到您的**[核心服务](#core-microservices)** 的 yaml 文件上的环境变量中 204 | ```yaml 205 | ... 206 | - name: GITHUB_APP_ID 207 | value : '' 208 | - name: GITHUB_APP_SECRET 209 | value : '' 210 | ... 211 | ``` 212 | > 该应用程序使用了键(名称)**GITHUB_APP_ID** 和 **GITHUB_APP_SECRET**,而且此信息必须与 yaml 文件中的信息完全匹配。 213 | 214 | ## Twitter 215 | 216 | 可以在这个链接中使用您的 Twitter 帐户注册您的应用程序。[创建新应用程序](https://apps.twitter.com/app/new) 217 | ![Twitter](images/twitter.png) 218 | 219 | 对于 name 字段,可以输入您希望提供给您的应用程序的名称。 220 | 对于主页 URL,需要输入您的集群 IP 地址和端口 30443。 221 | > https://169.xxx.xxx.xxx:30443/#/ 222 | 223 | 对于授权回调 URL,需要输入该 IP 地址和端口 30443,并指向该应用程序的身份验证服务。 224 | > https://169.xxx.xxx.xxx:30443/auth/TwitterAuth 225 | 226 | 转到您刚注册的 Twitter 应用程序的 Keys and Access Tokens 部分,并记下该应用程序的 **Consumer Key** 和 **Consumer Secret**。 227 | 您需要将此信息添加到您的**[核心服务](#core-microservices)** 的 yaml 文件上的环境变量中 228 | ```yaml 229 | ... 230 | - name: TWITTER_CONSUMER_KEY 231 | value : '' 232 | - name: TWITTER_CONSUMER_SECRET 233 | value : '' 234 | ... 235 | ``` 236 | > 该应用程序使用键(名称)**TWITTER_CONSUMER_KEY** 和 **TWITTER_CONSUMER_SECRET**,而且此信息必须与核心 yaml 文件中的信息完全匹配。 237 | 238 | # 5.2 添加房间 239 | 240 | 可以按照 GameOn 团队提供的[**这份指南**](https://gameontext.gitbooks.io/gameon-gitbook/content/walkthroughs/createRoom.html) 构建您自己的房间。他们拥有一些使用 Java、Swift、Go 等语言编写的样本房间。 241 | 242 | 在此次学习之旅中,将会部署**[使用 Java 编写的样本房间](https://github.com/gameontext/sample-room-java)**。将它部署在 GameOn 应用程序所在的同一个集群中。 243 | 244 | 可执行以下命令来创建这些房间 245 | ```bash 246 | $ kubectl create -f sample-room 247 | ``` 248 | 249 | 要在集群中注册所部署的房间,需要使用您的应用程序的用户界面。 250 | * 单击右上角的 Registered Rooms 按钮。 251 | ![addroom](images/addroom1.png) 252 | 253 | * 输入该房间的必要信息。(*将 Github Repo 和 Health Endpoint 字段留空。*)然后单击 `Register` 254 | > 备注:在这些样本中,Java 房间使用了端口 9080,而 Swift 房间使用了端口 8080。 255 | 256 | ![addroom](images/addroom2.png) 257 | * 您现在已成功在您的地图中注册了您的房间。可以在用户界面中键入以下命令来直接访问它:`/listmyrooms` 并将 ID 用于 `/teleport <房间 ID>`。[探索游戏](#5-explore-your-gameon-app)。 258 | 259 | * 可以在 [**这里**](https://gameontext.gitbooks.io/gameon-gitbook/content/walkthroughs/registerRoom.html) 了解注册房间的更多细节。 260 | * 可以按照 [GameOn 的指南](https://gameontext.gitbooks.io/gameon-gitbook/content/walkthroughs/createRoom.html) 构建您自己的房间 261 | 262 | ## 故障排除 263 | * 如果不能在浏览器上访问该应用程序,请确保在端口 30443 上使用了 `https://`。 264 | * 如果某个特定服务存在错误,可使用 `kubectl logs <服务的 pod 名称>` 查看它的日志,或者使用 `kubectl logs <服务的 pod 名称> -f` 关注这些日志。 265 | * 要在持久卷上清除/删除您的数据,可删除您的持久卷声明。 266 | * `kubectl delete pvc -l app=gameon` 267 | * 删除该声明后,可以使用 `kubectl delete pv local-volume-1` 删除该持久卷。这可以确保已在该卷上删除了密钥库。 268 | * 删除您的平台服务: 269 | * `kubectl delete -f platform` 270 | * 删除您的核心服务: 271 | * `kubectl delete -f core` 272 | * 删除所有信息: 273 | * `kubectl delete svc,deploy,pvc -l app=gameon` 274 | * `kubectl delete pod setup` 275 | * `kubectl delete pv local-volume-1` 276 | * `kubectl delete -f gameon-configmap.yaml` 277 | 278 | ## 参考资料 279 | 280 | * [GameOn](https://gameontext.org) - 原始的 GameOn 应用程序。此次学习之旅基于[使用 Docker 部署 GameOn](https://book.gameontext.org/walkthroughs/local-docker.html) 281 | 282 | ## 许可 283 | 284 | [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0) 285 | -------------------------------------------------------------------------------- /README-ko.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/IBM/GameOn-Java-Microservices-on-Kubernetes.svg?branch=master)](https://travis-ci.org/IBM/GameOn-Java-Microservices-on-Kubernetes) 2 | 3 | # 폴리글롯 에코시스템 내에서 쿠버네티스에 GameOn! Java 마이크로서비스 구축하기 4 | 5 | *다른 언어로 보기: [English](README.md).* 6 | 7 | 이 개발 과정은 폴리글롯 에코시스템과 공존하는 쿠버네티스 클러스터에 마이크로서비스 기반의 애플리케이션인 [Game On!](https://book.gameontext.org)을 구축하는 방법을 소개합니다. Game On!은 레트로 스타일의 텍스트 기반의 어드벤처 게임으로, 마이크로서비스 아키텍처 및 관련 개념 분석에 사용될 수 있습니다. GameOn! 구축에는 코어(core)와 플랫폼(platform)이라는 두 가지 마이크로서비스들의 집합이 수반됩니다. 코어 마이크로서비스는 Java로 작성되며, 다른 폴리글롯 마이크로서비스들과 공존합니다. 아울러, 여러 마이크로서비스들에 대하여 서비스 발견, 등록, 라우팅 등을 제공하는 플랫폼 서비스가 있습니다. 두 가지 모두 쿠버네티스 클러스터에 의해 관리되는 도커(Docker) 컨테이너에서 실행됩니다. 8 | 9 | ![gameon](images/gameon-microservices-code2.png) 10 | 11 | ### 코어 마이크로서비스: 12 | 13 | [MicroProfile](http://microprofile.io) 스펙의 일부로서 [JAX-RS](https://en.wikipedia.org/wiki/Java_API_for_RESTful_Web_Services), [CDI](https://dzone.com/articles/cdi-di-p1) 등을 사용하는 다섯 가지의 Java 마이크로서비스가 있습니다. 14 | 15 | - [Player](https://github.com/gameontext/gameon-player): CRUD 오퍼레이션과 API 토큰 관리를 위한 공용 API를 제공하는 player Java 마이크로서비스로서, 게임 플레이어를 나타냅니다. 16 | - [Auth](https://github.com/gameontext/gameon-auth): 선택된 "소셜 로그인"을 통해 플레이어들의 연결과 신원 확인을 지원하는 Java 마이크로서비스입니다. 17 | - [Mediator](https://github.com/gameontext/gameon-mediator): WebSphere Liberty 기반의 Java에 구현되는 서비스로서, Websocket를 통해 플레이어들을 룸(room)으로 연결합니다. 18 | - [Map](https://github.com/gameontext/gameon-map): Java EE 애플리케이션으로, JAX-RS 기반의 공용 REST API를 제공하는 WebSphere Liberty에서 실행되고, NoSQL 데이터 저장소(couchdb 또는 Cloudant)에 데이터를 저장합니다. 19 | - [Room](https://github.com/gameontext/gameon-room): Java 기반의 룸 구현. 20 | 21 | 이 밖에도, Proxy와 WebApp이 코어 마이크로서비스를 완성합니다. 22 | 23 | - [Proxy](https://github.com/gameontext/gameon-proxy): HAProxy를 기반으로 하여 전체 애플리케이션의 단일 파사드(facade)로서 API 컬렉션의 표면화를 담당합니다. 24 | - [WebApp](https://github.com/gameontext/gameon-webapp): Webapp은 UI의 프론트엔드를 구성하는 정적 파일을 제공하는 단순 nginx 프로세스입니다. 25 | 26 | ### 플랫폼 서비스: 27 | 28 | - [Service Discovery, Registry 및 Routing](https://www.amalgam8.io/): 서비스 레지스트리 및 라우팅 구성요소로서 이를 통해 서비스 발견과 서비스 프록싱(Service Proxying)이 구현됩니다. 이 밖에도 각 마이크로서비스와 관련된 사이드카가 레지스트리를 통해 마이크로서비스를 자동 등록합니다. 29 | - [Redis](): 사이드카에 의해 사용되는 주소를 저장합니다 30 | - [Kafka](https://kafka.apache.org): 서비스와 플랫폼에서 사용되는 Pub/Sub 솔루션입니다. 31 | 32 | ## 전제 조건 33 | 34 | 게임을 로컬에 구축하려면 [여기](https://github.com/gameontext/gameon#local-room-development)의 GameOn 리포지토리에 있는 docker-compose를 통해 지시사항을 따르십시오. 35 | 36 | 이 곳에 소개된 절차를 따르려면 IBM Bluemix 컨테이너 서비스([IBM Bluemix Container Service](https://github.com/IBM/container-journey-template))를 통해 쿠버네티스 클러스터를 생성하여 클라우드에 구축하십시오. 이 곳의 코드는 Travis를 사용하여 [Bluemix 컨테이너 서비스의 쿠버네티스 클러스터](https://console.ng.bluemix.net/docs/containers/cs_ov.html#cs_ov)에 대하여 정기적으로 테스트됩니다. 37 | 38 | ## Bluemix에 쿠버네티스 클러스터 구축하기 39 | GameOn!을 Bluemix에 직접 구축하려면, 아래의 ‘Deploy to Bluemix’ 버튼을 클릭하여 샘플 구축을 위한 Bluemix DevOps 서비스 툴체인과 파이프라인을 생성하십시오. 그렇지 않은 경우, [단계](#단계)로 이동하십시오. 40 | 41 | > 우선, 쿠버네티스 클러스터를 생성한 뒤, 사용자의 Bluemix 계정에 완전히 구축되었는지 확인해야 합니다. 42 | 43 | [![Create Toolchain](https://github.com/IBM/container-journey-template/blob/master/images/button.png)](https://console.ng.bluemix.net/devops/setup/deploy/?repository=https://github.com/IBM/GameOn-Java-Microservices-on-Kubernetes) 44 | 45 | [툴체인 학습](https://github.com/IBM/container-journey-template/blob/master/Toolchain_Instructions_new-ko.md) 가이드에 따라 툴체인 및 파이프라인을 완료하십시오. 46 | 47 | ## 단계 48 | 1. [코어 서비스 yaml 파일 수정하기](#1-코어-서비스-yaml-파일-수정하기) 49 | 2. [클러스터 볼륨 생성하기](#2-클러스터-볼륨-생성하기) 50 | 3. [플랫폼 서비스 생성하기](#3-플랫폼-서비스-생성하기) 51 | 4. [코어 서비스 생성하기](#4-코어-서비스-생성하기) 52 | 5. [GameOn 앱 살펴보기](#5-gameon-앱-살펴보기) 53 | - 5.1 [소셜 로그인 추가하기](#51-소셜-로그인-추가하기) 54 | - 5.2 [룸(Room) 추가하기](#52-룸room-추가하기) 55 | 56 | #### [문제 해결](#문제-해결-1) 57 | 58 | # 1. 코어 서비스 yaml 파일 수정하기 59 | `gameon-configmap.yaml` 파일에서 다음의 값을 변경하십시오. `PLACEHOLDER_IP` 값을 클러스터의 퍼블릭 IP값으로 대체 하십시오. `bx cs workers ` 명령으로 Bluemix Container 서비스에 대한 IP을 얻을 수 있습니다. 예) `192.168.99.100` 60 | > minikube에서는, `minikube ip` 명령으로 IP를 얻을 수 있습니다 61 | 62 | ```yaml 63 | FRONT_END_PLAYER_URL: https://PLACEHOLDER_IP:30443/players/v1/accounts 64 | FRONT_END_SUCCESS_CALLBACK: https://PLACEHOLDER_IP:30443/#/login/callback 65 | FRONT_END_FAIL_CALLBACK: https://PLACEHOLDER_IP:30443/#/game 66 | FRONT_END_AUTH_URL: https://PLACEHOLDER_IP:30443/auth 67 | ... 68 | PROXY_DOCKER_HOST: 'PLACEHOLDER_IP' 69 | ``` 70 | 71 | 값을 변경하는 가장 쉬운 방법은 다음 명령을 실행하거나 72 | `sed -i s#PLACEHOLDER_IP##g gameon-configmap.yaml` 을 실행하는 것입니다. 74 | 75 | 그 다음, 클러스터에 config map을 적용합니다: 76 | ```bash 77 | $ kubectl create -f gameon-configmap.yaml 78 | configmap "gameon-env" created 79 | ``` 80 | 81 | # 2. 클러스터 볼륨 생성하기 82 | 사용자 클러스터에 볼륨을 생성해야 합니다. 이때, 제공된 yaml 파일을 사용할 수 있습니다. 클러스터 볼륨은 필요한 keystore를 저장하며 [코어 서비스](#코어-마이크로서비스)에서 사용됩니다. 83 | ```bash 84 | $ kubectl create -f local-volume.yaml 85 | persistent volumes "local-volume-1" created 86 | persistent volumes "keystore-claim" created 87 | ``` 88 | 89 | 이제, **setup.yaml** 파일을 사용하여 필요한 keystore를 생성할 수 있습니다. 이때, keystore와 함께 pod가 생성될 것입니다. 90 | ```bash 91 | $ kubectl create -f setup.yaml 92 | ``` 93 | 94 | > [containers/setup/ 폴더](containers/setup)에 keystore 생성을 위한 Dockerfile과 스크립트가 위치해 있습니다. 제공된 Dockerfile을 이용하면 나만의 이미지를 구축할 수 있습니다. 95 | 96 | setup Pod가 실행되었다면, 이후로 다시 실행되지 않습니다. `kubectl delete pod setup` 명령을 이용하여 pod를 삭제할 수 있습니다 (선택 사항). 97 | 98 | Pod가 keystore 가져오기에 성공했는지는 pod의 로그를 통해 확인할 수 있습니다. 99 | ```bash 100 | $ kubectl logs setup 101 | Checking for keytool... 102 | Checking for openssl... 103 | Generating key stores using :30443 104 | Certificate stored in file 105 | Certificate was added to keystore 106 | Certificate reply was installed in keystore 107 | Certificate stored in file 108 | MAC verified OK 109 | Certificate was added to keystore 110 | Entry for alias <*> successfully imported. 111 | ... 112 | Entry for alias <**> successfully imported. 113 | Import command completed: 104 entries successfully imported, 0 entries failed or cancelled 114 | ``` 115 | 116 | # 3. 플랫폼 서비스 생성하기 117 | 이제, 게임 앱의 [플랫폼 서비스](#플랫폼-서비스)와 배치를 진행할 수 있습니다. 118 | ```bash 119 | $ kubectl create -f platform 120 | OR alternatively 121 | $ kubectl create -f platform/controller.yaml 122 | $ kubectl create -f platform/.yaml 123 | ... 124 | $ kubectl create -f platform/registry.yaml 125 | ``` 126 | 127 | 컨트롤 플래인(컨트롤러 및 레지스트리)의 작동 여부 확인: 128 | ```bash 129 | $ curl -sw "%{http_code}" ":31200/health" -o /dev/null 130 | $ curl -sw "%{http_code}" ":31300/uptime" -o /dev/null 131 | ``` 132 | 두 가지 모두 200을 출력하면, 다음 단계로 이동합니다. 133 | > 참고: pod 설치 완료까지 대략 1-2 분이 소요될 수 있습니다. 134 | 135 | # 4. 코어 서비스 생성하기 136 | 마지막 단계로, 앱의 [**코어 서비스**](#코어-마이크로서비스)와 배치를 진행할 수 있습니다. 137 | *(소셜 로그인을 원할 경우, [코어 서비스](#코어-마이크로서비스) 구축에 앞서 [여기](#a-adding-social-logins)에 나온 절차를 이행하십시오)* 138 | 139 | 140 | ```bash 141 | $ kubectl create -f core 142 | OR alternatively 143 | $ kubectl create -f core/auth.yaml 144 | $ kubectl create -f core/.yaml 145 | ... 146 | $ kubectl create -f core/webapp.yaml 147 | ``` 148 | [코어 서비스](#코어-마이크로서비스)가 설치를 완료했는지 확인하려면 프록시의 Pod 로그를 확인해야 합니다. **kubectl get pods**를 이용하여 프록시의 pod 이름을 확인할 수 있습니다 149 | ```bash 150 | kubectl logs proxy-***-** 151 | ``` 152 | map, auth, mediator, player, room 서버들을 검색해야 합니다. 서버 작동 여부를 확인하십시오. 153 | ```bash 154 | [WARNING] 094/205214 (11) : Server room/room1 is UP, reason: Layer7 check passed ... 155 | [WARNING] 094/205445 (11) : Server auth/auth1 is UP, reason: Layer7 check passed ... 156 | [WARNING] 094/205531 (11) : Server map/map1 is UP, reason: Layer7 check passed ... 157 | [WARNING] 094/205531 (11) : Server mediator/mediator1 is UP, reason: Layer7 check passed ... 158 | [WARNING] 094/205531 (11) : Server player/player1 is UP, reason: Layer7 check passed ... 159 | ``` 160 | > 서비스들이 완전히 설치될 때까지 대략 5-10 분이 소요될 수 있습니다. 161 | 162 | # 5. GameOn 앱 살펴보기 163 | 164 | Bluemix 쿠버네티스 컨테이너 서비스에 앱이 성공적으로 빌드됐다면, IP 주소 및 할당된 포트를 통해 앱에 접속할 수 있습니다. 165 | > https://169.xxx.xxx.xxx:30443/ 166 | > https로 30443 포트 번호를 사용해야 합니다. 167 | 168 | * 위 주소에서 앱의 홈페이지가 확인됩니다. 169 | ![Homepage](images/home.png) 170 | * Enter를 클릭하여 Anonymous User로 로그인하십시오(Github, 트위터 등에서 사용자 계정을 사용하고 싶다면, 사용자의 소셜 로그인 API 키를 설치해야 합니다.) 171 | ![User](images/user.png) 172 | * 원하는 **사용자 이름**과 **좋아하는 색상**을 입력합니다 173 | ![Game](images/game.png) 174 | * **축하합니다! 이제 Bluemix에서 여러분만의 GameOn 앱이 실행됩니다! 새로운 룸의 생성과 소셜 로그인 추가 방법을 계속해서 소개합니다.** 175 | * GameOn 앱의 명령어: 176 | * `/help` - 사용 가능한 모든 명령들을 나열합니다 177 | * `/sos` - 첫 번째 room으로 되돌아갑니다 178 | * `/exits` - 사용 가능한 나가기(exit)를 모두 나열합니다 179 | * `/go ` - 해당 방향의 room으로 이동합니다 180 | 181 | # 5.1 소셜 로그인 추가하기 182 | 소셜 로그인을 추가하여 친구들과 함께 룸들을 탐험할 수 있습니다. 소셜 로그인을 추가하려면 사용하고자 하는 소셜 앱에 개발자 계정이 있어야 합니다. 183 | 184 | > 편집된 사용자 yaml 파일로 [**코어 서비스**](#코어-마이크로서비스)를 재구축해야 합니다. 그 다음 단계에서 API 키를 추가할 장소를 확인할 수 있습니다. 185 | 186 | 187 | ## Github 188 | [New OAuth Application](https://github.com/settings/applications/new)에서 애플리케이션을 등록하십시오 189 | ![Github](images/github.png) 190 | Homepage URL에서 클러스터의 IP 주소와 포트 30443을 입력하십시오. 191 | > https://169.xxx.xxx.xxx:30443/#/ 192 | 193 | Authorization 콜백 URL에서 IP 주소와 포트 30443을 입력하고, 앱의 auth 서비스로 포인팅해야 합니다. 194 | > https://169.xxx.xxx.xxx:30443/auth/GitHubCallback 195 | 196 | 위 내용은 클러스터가 새로 생성된 경우 나중에라도 GitHub에서 편집할 수 있습니다. 197 | 앱의 **Client ID**와 **Client Secret**을 기록해 놓으십시오. 198 | [**코어 서비스**](#코어-마이크로서비스)의 yaml 파일에서 환경 변수에 추가해야 합니다 199 | ```yaml 200 | ... 201 | - name: GITHUB_APP_ID 202 | value : '' 203 | - name: GITHUB_APP_SECRET 204 | value : '' 205 | ... 206 | ``` 207 | > 애플리케이션은 키(이름) **GITHUB_APP_ID** 및 **GITHUB_APP_SECRET**를 사용하며, yaml 파일 내의 키들과 정확히 일치해야 합니다. 208 | 209 | ## Twitter 210 | 211 | [Create new app](https://apps.twitter.com/app/new)에서 트위터 계정으로 애플리케이션을 등록할 수 있습니다 212 | ![Twitter](images/twitter.png) 213 | 214 | 이름 필드에 원하는 애플이케이션 이름을 입력하십시오. Homepage URL의 경우, 클러스터의 IP 주소와 포트 30443을 입력해야 합니다. 215 | > https://169.xxx.xxx.xxx:30443/#/ 216 | 217 | Authorization 콜백 URL에는 IP 주소와 포트 30443을 입력하고, 앱의 auth 서비스로 포인팅해야 합니다. 218 | > https://169.xxx.xxx.xxx:30443/auth/TwitterAuth 219 | 220 | 등록을 마친 트위터 애플리케이션의 Keys and Access Tokens 섹션으로 이동하여 앱의 **Consumer Key**와 **Consumer Secret**을 기록해 놓으십시오. [**코어 서비스**](#코어-마이크로서비스)의 yaml 파일에서 환경 변수에 추가해야 합니다. 221 | ```yaml 222 | ... 223 | - name: TWITTER_CONSUMER_KEY 224 | value : '' 225 | - name: TWITTER_CONSUMER_SECRET 226 | value : '' 227 | ... 228 | ``` 229 | > 애플리케이션은 키(이름) **TWITTER_CONSUMER_KEY** 및 **TWITTER_CONSUMER_SECRET**를 사용하며, yaml 파일 내의 키들과 정확히 일치해야 합니다. 230 | 231 | # 5.2 룸(Room) 추가하기 232 | 233 | GameOn 팀의 [**본 지침**](https://gameontext.gitbooks.io/gameon-gitbook/content/walkthroughs/createRoom.html)을 따라 나만의 룸(room)을 빌드할 수 있습니다. GameOn 팀은 Java, Swift, Go 등으로 작성된 샘플 룸들을 갖고 있습니다. 234 | 235 | 이 과정에서는 [**Java로 작성된 샘플 룸**](https://github.com/gameontext/sample-room-java)을 빌드하게 될 것입니다. 샘플 룸은 GameOn 앱과 동일한 클러스터에 빌드됩니다. 236 | 237 | 다음 명령을 실행하면 룸이 생성됩니다. 238 | ```bash 239 | $ kubectl create -f sample-room 240 | ``` 241 | 242 | 빌드된 룸을 클러스터에 등록하려면 앱의 UI를 사용해야 합니다. 243 | * 우측 상단의 Registered Rooms를 클릭하십시오. 244 | ![addroom](images/addroom1.png) 245 | 246 | * 필요한 룸 정보를 입력하십시오. (*Github Repo 필드와 Health Endpoint 필드는 빈칸 처리합니다.*) 그런 다음, `Register`를 클릭하십시오 247 | > 참고: 샘플에서 Java Room은 포트 9080을 사용하며, Swift Room은 포트 8080을 사용합니다. 248 | 249 | ![addroom](images/addroom2.png) 250 | * Map에 룸을 성공적으로 등록했습니다. UI에서 `/listmyrooms`와 같은 명령을 입력하거나 id와 `/teleport `를 이용하여 룸으로 직접 이동할 수 있습니다. [GameOn 앱에 대해 알아 보십시오](#5-gameon-앱-살펴보기). 251 | 252 | * [**여기**](https://gameontext.gitbooks.io/gameon-gitbook/content/walkthroughs/registerRoom.html)에서 세부적인 룸 등록 정보를 확인할 수 있습니다. 253 | * [GameOn 가이드](https://gameontext.gitbooks.io/gameon-gitbook/content/walkthroughs/createRoom.html)에 따라 나만의 룸을 빌드할 수 있습니다. 254 | 255 | ## 문제 해결 256 | * 브라우저에서 앱에 접속할 수 없는 경우, 포트 30443에 `https://`를 이용 중인지 확인해 보십시오. 257 | * 특정 서비스에 문제가 있는 경우, `kubectl logs ` 또는 `kubectl logs -f`를 이용하여 해당 서비스의 로그를 확인하십시오. 258 | * Persistent Volumne에서 데이터를 clean/delete 하려면 Persistent Volumne Claim을 삭제해야 합니다. 259 | * `kubectl delete pvc -l app=gameon` 260 | * PV claim 삭제 후, `kubectl delete pv local-volume-1`을 이용하여 PV를 삭제 할 수 있습니다. 이로써 keystore가 volume에서 삭제됩니다. 261 | * 플랫폼 서비스 삭제하기: 262 | * `kubectl delete -f platform` 263 | * 코어 서비스 삭제하기: 264 | * `kubectl delete -f core` 265 | * 모두 삭제하기: 266 | * `kubectl delete svc,deploy,pvc -l app=gameon` 267 | * `kubectl delete pod setup` 268 | * `kubectl delete pv local-volume-1` 269 | * `kubectl delete -f gameon-configmap.yaml` 270 | 271 | ## 참조 272 | 273 | * [GameOn](https://gameontext.org) - 오리지널 게임 앱. 과정은 [deploying GameOn using Docker](https://book.gameontext.org/walkthroughs/local-docker.html)을 기반으로 작성되었습니다. 274 | 275 | ## 라이센스 276 | 277 | [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0) 278 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/IBM/GameOn-Java-Microservices-on-Kubernetes.svg?branch=master)](https://travis-ci.org/IBM/GameOn-Java-Microservices-on-Kubernetes) 2 | 3 | # GameOn! Java Microservices on Kubernetes with polyglot ecosystem 4 | 5 | *Read this in other languages: [한국어](README-ko.md)、[中国](README-cn.md).* 6 | 7 | This code demonstrates deployment of a Microservices based application [Game On!](https://book.gameontext.org) on to Kubernetes cluster which exists together with a polyglot ecosystem. Game On! is a throwback text-based adventure built to help you explore microservice architectures and related concepts. GameOn! deployment has two sets of microservice, core and platform. The core microservices are written in Java, coexisting with other polyglot microservices. In addition, there are platform services, which provide service discovery, registration and routing for different microservices. All run in in Docker containers managed by Kubernetes Cluster. 8 | 9 | ![gameon](images/gameon-microservices-code2.png) 10 | 11 | ### Core MicroServices: 12 | 13 | There are five core Java microservices, using [JAX-RS](https://en.wikipedia.org/wiki/Java_API_for_RESTful_Web_Services), [CDI](https://dzone.com/articles/cdi-di-p1) etc. part of the [MicroProfile](https://microprofile.io/) spec. 14 | 15 | - [Player](https://github.com/gameontext/gameon-player): Players are represented by the player Java microservice which provides a public API for CRUD operations, and for managing API tokens. 16 | - [Auth](https://github.com/gameontext/gameon-auth): Java microservice to allow players to connect and identify themselves via a selected "social login" 17 | - [Mediator](https://github.com/gameontext/gameon-mediator): The Mediator service is implemented in Java using WebSphere Liberty, and connects players to rooms over Websockets 18 | - [Map](https://github.com/gameontext/gameon-map): The Map service is a Java EE application running on WebSphere Liberty that provides a public REST API using JAX-RS. It stores data in a NoSQL data store, either couchdb or Cloudant 19 | - [Room](https://github.com/gameontext/gameon-room): Java based room implementation 20 | 21 | In addition, Proxy and WebApp complete the core microservices 22 | 23 | - [Proxy](https://github.com/gameontext/gameon-proxy): HAProxy based, and is responsible for surfacing the collection of APIs as a single facade for the entire application. 24 | - [WebApp](https://github.com/gameontext/gameon-webapp): Webapp is a simple nginx process that serves the static files that comprise the front-end of the UI. 25 | 26 | ### Platform Services: 27 | 28 | - [Service Discovery, Registry and Routing](https://amalgam8.io/): Service Registry and routing components, via which Service Discovery and Service Proxying are implemented. In addition, there are sidecars associated with each microservice, which automatically registers the microservice with the registry. 29 | - [Redis](): Store the addresses used by Sidecars 30 | - [Kafka](https://kafka.apache.org): Publish/Subscribe solution used by services and the platform. 31 | 32 | ## Prerequisite 33 | 34 | To deploy the game locally, follow the instructions via docker-compose in GameOn repository [here](https://github.com/gameontext/gameon#local-room-development). 35 | 36 | To follow the steps here, create a Kubernetes cluster with either [Minikube](https://kubernetes.io/docs/setup/minikube/) for local testing, with [IBM Cloud Private](https://github.com/IBM/deploy-ibm-cloud-private/blob/master/README.md), or with [IBM Bluemix Container Service](https://github.com/IBM/container-journey-template/blob/master/README.md) to deploy in cloud. The code here is regularly tested against [Kubernetes Cluster from Bluemix Container Service](https://cloud.ibm.com/docs/containers/cs_ov.html#cs_ov) using Travis. 37 | 38 | 39 | ## Steps 40 | 1. [Modify the Core services yaml files](#1-modify-the-core-services-yaml-files) 41 | 2. [Create a Volume for your Cluster](#2-create-a-volume-for-your-cluster) 42 | 3. [Create the Platform Services](#3-create-the-platform-services) 43 | 4. [Create the Core Services](#4-create-the-core-services) 44 | 5. [Explore your GameOn App](#5-explore-your-gameon-app) 45 | - 5.1 [Add Social Logins](#51-add-social-logins) 46 | - 5.2 [Add Rooms](#52-add-rooms) 47 | 48 | #### [Troubleshooting](#troubleshooting-1) 49 | 50 | # 1. Modify the ConfigMap yaml file 51 | Change these values on the `gameon-configmap.yaml` file. Change `PLACEHOLDER_IP` to the public IP of your cluster. You can get the IP from `bx cs workers ` for the Bluemix Container Service. Ex. `192.168.99.100` 52 | > For minikube, you can get the IP using `minikube ip` 53 | 54 | ```yaml 55 | FRONT_END_PLAYER_URL: https://PLACEHOLDER_IP:30443/players/v1/accounts 56 | FRONT_END_SUCCESS_CALLBACK: https://PLACEHOLDER_IP:30443/#/login/callback 57 | FRONT_END_FAIL_CALLBACK: https://PLACEHOLDER_IP:30443/#/game 58 | FRONT_END_AUTH_URL: https://PLACEHOLDER_IP:30443/auth 59 | ... 60 | PROXY_DOCKER_HOST: 'PLACEHOLDER_IP' 61 | ``` 62 | 63 | An easy way to change these values is to do 64 | `sed -i s#PLACEHOLDER_IP##g gameon-configmap.yaml`. 66 | 67 | Then, apply the config map on your cluster: 68 | ```bash 69 | $ kubectl create -f gameon-configmap.yaml 70 | configmap "gameon-env" created 71 | ``` 72 | 73 | # 2. Create a Volume for your Cluster 74 | You would need to create a volume for your cluster. You can use the provided yaml file. The required keystores will be stored in this volume. The volume will also be used by the [core services](#core-microservices). 75 | ```bash 76 | $ kubectl create -f local-volume.yaml 77 | persistent volumes "local-volume-1" created 78 | persistent volumes "keystore-claim" created 79 | ``` 80 | 81 | You can now create the required keystores using the **setup.yaml** file. This will create a Pod and create the keystores. 82 | ```bash 83 | $ kubectl create -f setup.yaml 84 | ``` 85 | 86 | > You can find the Dockerfile and script for generating keystore in [containers/setup/ folder](containers/setup). You can build your own image using the provided Dockerfile. 87 | 88 | Once it is done, the Pod will not run again. You can delete the Pod after using `kubectl delete pod setup` (optional). 89 | 90 | If you want to confirm that the Pod has successfully imported the keystores, you can view the Pod's logs. 91 | ```bash 92 | $ kubectl logs setup 93 | Checking for keytool... 94 | Checking for openssl... 95 | Generating key stores using :30443 96 | Certificate stored in file 97 | Certificate was added to keystore 98 | Certificate reply was installed in keystore 99 | Certificate stored in file 100 | MAC verified OK 101 | Certificate was added to keystore 102 | Entry for alias <*> successfully imported. 103 | ... 104 | Entry for alias <**> successfully imported. 105 | Import command completed: 104 entries successfully imported, 0 entries failed or cancelled 106 | ``` 107 | 108 | # 3. Create the Platform Services 109 | You can now create the [Platform services](#platform-services) and deployments of the app. 110 | ```bash 111 | $ kubectl create -f platform 112 | OR alternatively 113 | $ kubectl create -f platform/controller.yaml 114 | $ kubectl create -f platform/.yaml 115 | ... 116 | $ kubectl create -f platform/registry.yaml 117 | ``` 118 | 119 | To check if the control plane (controller and registry) is up: 120 | ```bash 121 | $ curl -sw "%{http_code}" ":31200/health" -o /dev/null 122 | $ curl -sw "%{http_code}" ":31300/uptime" -o /dev/null 123 | ``` 124 | If both of them outputs 200, you can proceed to the next step. 125 | > Note: It can take around 1-2 minutes for the Pods to setup completely. 126 | 127 | # 4. Create the Core Services 128 | Finally, you can create the **[Core services](#core-microservices)** and deployments of the app. 129 | *(If you want to have social logins, please follow the steps [here](#a-adding-social-logins) before deploying the [core services](#core-microservices))* 130 | 131 | 132 | ```bash 133 | $ kubectl create -f core 134 | OR alternatively 135 | $ kubectl create -f core/auth.yaml 136 | $ kubectl create -f core/.yaml 137 | ... 138 | $ kubectl create -f core/webapp.yaml 139 | ``` 140 | To verify if the [core services](#core-microservices) has finished setting up, you would need to check the logs of the Pod of the proxy. You can get the Pod name of the proxy using **kubectl get pods** 141 | ```bash 142 | kubectl logs proxy-***-** 143 | ``` 144 | You should look for the map, auth, mediator, player and room servers. Confirm if they are UP. 145 | ```bash 146 | [WARNING] 094/205214 (11) : Server room/room1 is UP, reason: Layer7 check passed ... 147 | [WARNING] 094/205445 (11) : Server auth/auth1 is UP, reason: Layer7 check passed ... 148 | [WARNING] 094/205531 (11) : Server map/map1 is UP, reason: Layer7 check passed ... 149 | [WARNING] 094/205531 (11) : Server mediator/mediator1 is UP, reason: Layer7 check passed ... 150 | [WARNING] 094/205531 (11) : Server player/player1 is UP, reason: Layer7 check passed ... 151 | ``` 152 | > It can take around 5-10 minutes for these services to setup completely. 153 | 154 | # 5. Explore your GameOn App 155 | 156 | Now that you have successfully deployed your own app in the Bluemix Kubernetes Container Service, you can access it via its IP address and assigned Port. 157 | > https://169.xxx.xxx.xxx:30443/ 158 | > You will need to use https on port 30443. 159 | 160 | * You will see the homepage of your app on that address. 161 | ![Homepage](images/home.png) 162 | * Click on Enter to log in as Anonymous User(You will need to setup your own Social Login API keys if you want to use your accounts on Github,Twitter,etc..) 163 | ![User](images/user.png) 164 | * The app will prompt you to enter your desired **Username** and **Favorite Color** 165 | ![Game](images/game.png) 166 | * **Congratulations! You now have your own GameOn app running on Bluemix! You may now wish to explore on creating new rooms and adding social logins.** 167 | * Commands in GameOn app: 168 | * `/help` - lists all commands available 169 | * `/sos` - go back the the first room 170 | * `/exits` - lists all available exits 171 | * `/go ` - go to the room in that direction 172 | 173 | # 5.1 Add Social Logins 174 | You may want to add social logins so you and your friends can explore the rooms together. 175 | To add social logins you would need to have developer accounts on the social app you want to use. 176 | 177 | > You will need to redeploy your **[Core services](#core-microservices)** with the your own modified yaml files. The next step will show you where to add your API Keys. 178 | 179 | 180 | ## Github 181 | You can register your application in this link: [New OAuth Application](https://github.com/settings/applications/new) 182 | ![Github](images/github.png) 183 | For the Homepage URL, you will need to put the IP address of your cluster and the port 30443. 184 | > https://169.xxx.xxx.xxx:30443/#/ 185 | 186 | For the Authorization callback URL, you will need to put the IP address and the port 30443 and point to the auth service of the app. 187 | > https://169.xxx.xxx.xxx:30443/auth/GitHubCallback 188 | 189 | You can edit that in the GitHub later if you made a new cluster. 190 | Now, take note of the **Client ID** and **Client Secret** of the app. 191 | You will need to add this in the environment variables on the yaml files of your **[Core services](#core-microservices)** 192 | ```yaml 193 | ... 194 | - name: GITHUB_APP_ID 195 | value : '' 196 | - name: GITHUB_APP_SECRET 197 | value : '' 198 | ... 199 | ``` 200 | > The application uses the keys(name) **GITHUB_APP_ID** and **GITHUB_APP_SECRET** and must exactly match this in yaml files. 201 | 202 | ## Twitter 203 | 204 | You can register your application with your Twitter account in this link: [Create new app](https://developer.twitter.com/app/new) 205 | ![Twitter](images/twitter.png) 206 | 207 | For the name field, you can put the name you want for your app. 208 | For the Homepage URL, you will need to put the IP address of your cluster and the port 30443. 209 | > https://169.xxx.xxx.xxx:30443/#/ 210 | 211 | For the Authorization callback URL, you will need to put the IP address and the port 30443 and point to the auth service of the app. 212 | > https://169.xxx.xxx.xxx:30443/auth/TwitterAuth 213 | 214 | Go to the Keys and Access Tokens section of the twitter application you just registered and take note of the **Consumer Key** and **Consumer Secret** of the app. 215 | You will need to add this in the environment variables on the yaml files of your **[Core services](#core-microservices)** 216 | ```yaml 217 | ... 218 | - name: TWITTER_CONSUMER_KEY 219 | value : '' 220 | - name: TWITTER_CONSUMER_SECRET 221 | value : '' 222 | ... 223 | ``` 224 | > The application uses the keys(name) **TWITTER_CONSUMER_KEY** and **TWITTER_CONSUMER_SECRET** and must exactly match these in the core yaml files. 225 | 226 | # 5.2 Add Rooms 227 | 228 | You can build your own rooms by following [**this guide**](https://gameontext.gitbooks.io/gameon-gitbook/content/walkthroughs/createRoom.html) by the GameOn team. They have some sample rooms written in Java, Swift, Go, and more. 229 | 230 | In this journey, you will deploy the **[sample room written in Java](https://github.com/gameontext/sample-room-java)**. You will deploy it in the same cluster as your GameOn App. 231 | 232 | You can create these rooms by executing 233 | ```bash 234 | $ kubectl create -f sample-room 235 | ``` 236 | 237 | To register the deployed rooms in the cluster, you will need to use the UI of your app. 238 | * Click on the Registered Rooms button at the top right. 239 | ![addroom](images/addroom1.png) 240 | 241 | * Enter the necessary information of the room. (*Leave the Github Repo and Health Endpoint fields blank.*) Then click `Register` 242 | > Note: In the samples, the Java Room uses port 9080, while the Swift room uses port 8080. 243 | 244 | ![addroom](images/addroom2.png) 245 | * You now have successfully registered your room in your Map. You can go to it directly by typing these commands in the UI: `/listmyrooms` and use the id in `/teleport `. [Explore the game](#5-explore-your-gameon-app). 246 | 247 | * You can learn more about the details of registering a room [**here**](https://gameontext.gitbooks.io/gameon-gitbook/content/walkthroughs/registerRoom.html). 248 | * You can build your own room by following [GameOn's guide](https://gameontext.gitbooks.io/gameon-gitbook/content/walkthroughs/createRoom.html) 249 | 250 | ## Troubleshooting 251 | * If you can't access the app on the browser, make sure you are using `https://` on port 30443. 252 | * If something is wrong with a specific service, view its logs using `kubectl logs ` or `kubectl logs -f` to follow the logs. 253 | * To clean/delete your data on Persistent Volume, delete your persistent volume claim. 254 | * `kubectl delete pvc -l app=gameon` 255 | * After deleting the claim, you can delete the Persistent Volume using `kubectl delete pv local-volume-1`. This would ensure the keystores are deleted on the volume. 256 | * To delete your platform services: 257 | * `kubectl delete -f platform` 258 | * To delete your core services: 259 | * `kubectl delete -f core` 260 | * To delete everything: 261 | * `kubectl delete svc,deploy,pvc -l app=gameon` 262 | * `kubectl delete pod setup` 263 | * `kubectl delete pv local-volume-1` 264 | * `kubectl delete -f gameon-configmap.yaml` 265 | 266 | ## References 267 | 268 | * [GameOn](https://gameontext.org) - The original game on app. The journey is based on [deploying GameOn using Docker](https://book.gameontext.org/walkthroughs/local-docker.html) 269 | 270 | ## License 271 | 272 | This code pattern is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the [Developer Certificate of Origin, Version 1.1 (DCO)](https://developercertificate.org/) and the [Apache Software License, Version 2](https://www.apache.org/licenses/LICENSE-2.0.txt). 273 | 274 | [Apache Software License (ASL) FAQ](https://www.apache.org/foundation/license-faq.html#WhatDoesItMEAN) 275 | -------------------------------------------------------------------------------- /containers/gameon-proxy/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM haproxy:1.6 2 | 3 | MAINTAINER Ben Smith (benjsmi@us.ibm.com) 4 | 5 | RUN apt-get update && apt-get install -y wget ca-certificates --no-install-recommends && rm -rf /var/lib/apt/lists/* 6 | 7 | RUN wget -qO- https://github.com/amalgam8/amalgam8/releases/download/v0.4.2/a8sidecar.sh | sh 8 | 9 | RUN ln -s /usr/local/etc/haproxy /etc/ 10 | RUN mkdir -p /run/haproxy/ 11 | 12 | RUN wget https://github.com/coreos/etcd/releases/download/v2.2.2/etcd-v2.2.2-linux-amd64.tar.gz -q && \ 13 | tar xzf etcd-v2.2.2-linux-amd64.tar.gz etcd-v2.2.2-linux-amd64/etcdctl --strip-components=1 && \ 14 | rm etcd-v2.2.2-linux-amd64.tar.gz && \ 15 | mv etcdctl /usr/local/bin/etcdctl 16 | 17 | COPY ./proxy.pem /etc/ssl/proxy.pem 18 | COPY ./startup.sh /opt/startup.sh 19 | 20 | COPY ./haproxy.cfg /etc/haproxy/haproxy.cfg 21 | COPY ./haproxy-ics.cfg /etc/haproxy/haproxy-ics.cfg 22 | COPY ./haproxy-dev.cfg /etc/haproxy/haproxy-dev.cfg 23 | 24 | EXPOSE 80 443 1936 25 | 26 | ENTRYPOINT ["/opt/startup.sh"] 27 | CMD [""] 28 | -------------------------------------------------------------------------------- /containers/gameon-proxy/haproxy-dev.cfg: -------------------------------------------------------------------------------- 1 | global 2 | #chroot /var/lib/haproxy 3 | #user haproxy 4 | #group haproxy 5 | stats socket /run/haproxy/admin.sock mode 660 level admin 6 | stats timeout 30s 7 | debug 8 | ssl-default-bind-ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:RC4-SHA:!kEDH:!LOW:!EXP:!MD5:!aNULL:!eNULL 9 | 10 | userlist admins 11 | user admin insecure-password PLACEHOLDER_PASSWORD 12 | 13 | defaults 14 | mode http 15 | retries 3 16 | option redispatch 17 | option dontlog-normal 18 | option dontlognull 19 | timeout connect 5000 20 | timeout client 500000 21 | timeout server 500000 22 | errorfile 400 /etc/haproxy/errors/400.http 23 | errorfile 403 /etc/haproxy/errors/403.http 24 | errorfile 408 /etc/haproxy/errors/408.http 25 | errorfile 500 /etc/haproxy/errors/500.http 26 | errorfile 502 /etc/haproxy/errors/502.http 27 | errorfile 503 /etc/haproxy/errors/503.http 28 | errorfile 504 /etc/haproxy/errors/504.http 29 | 30 | frontend logstash-lumberjack 31 | bind *:5043 32 | mode tcp 33 | option tcplog 34 | default_backend logstash-lumberjack 35 | 36 | frontend frontend-ssl 37 | bind *:443 ssl crt /etc/ssl/proxy.pem 38 | mode http 39 | option httplog 40 | 41 | acl player path_beg -i /play 42 | use_backend player if player 43 | 44 | acl auth path_beg -i /auth 45 | use_backend auth if auth 46 | 47 | acl map path_beg -i /map 48 | use_backend map if map 49 | 50 | acl swagger path_beg -i /swagger 51 | use_backend swagger if swagger 52 | 53 | acl room path_beg -i /rooms 54 | use_backend room if room 55 | 56 | acl roomjs path_beg -i /roomjs 57 | use_backend roomjs if roomjs 58 | 59 | acl mediator path_beg -i /mediator 60 | use_backend mediator if mediator 61 | 62 | default_backend static-content 63 | 64 | frontend frontend-plain 65 | bind *:80 66 | mode http 67 | option httplog 68 | 69 | acl player path_beg -i /play 70 | use_backend player if player 71 | 72 | acl auth path_beg -i /auth 73 | use_backend auth if auth 74 | 75 | acl room path_beg -i /rooms 76 | use_backend room if room 77 | 78 | acl swagger path_beg -i /swagger 79 | use_backend swagger if swagger 80 | 81 | acl roomjs path_beg -i /roomjs 82 | use_backend roomjs if roomjs 83 | 84 | acl map path_beg -i /map 85 | use_backend map if map 86 | 87 | acl mediator path_beg -i /mediator 88 | use_backend mediator if mediator 89 | 90 | default_backend static-content 91 | 92 | backend room 93 | mode http 94 | option httplog 95 | option httpchk HEAD / HTTP/1.1\r\nHost:localhost 96 | balance roundrobin 97 | server room1 room:9080 check 98 | 99 | backend roomjs 100 | mode http 101 | option httplog 102 | balance roundrobin 103 | server roomjs1 192.168.99.100:5000 check 104 | 105 | backend map 106 | mode http 107 | option httplog 108 | option httpchk GET /map/v1/health HTTP/1.1\r\nHost:localhost 109 | balance roundrobin 110 | server map1 map:9443 ssl check check-ssl verify none 111 | 112 | backend mediator 113 | mode http 114 | option httplog 115 | balance roundrobin 116 | server mediator1 mediator:9443 ssl check check-ssl verify none 117 | 118 | backend auth 119 | mode http 120 | option httplog 121 | option httpchk GET /auth/health HTTP/1.1\r\nHost:localhost 122 | balance roundrobin 123 | server auth1 auth:9443 ssl check check-ssl verify none 124 | 125 | backend player 126 | mode http 127 | option httplog 128 | balance roundrobin 129 | server player1 player:9443 ssl check check-ssl verify none 130 | 131 | backend static-content 132 | mode http 133 | option httpchk HEAD / HTTP/1.1\r\nHost:localhost 134 | option httplog 135 | balance roundrobin 136 | server webapp1 webapp:8080 check inter 1m 137 | 138 | backend logstash-lumberjack 139 | mode tcp 140 | option tcplog 141 | balance roundrobin 142 | server logstash1 192.168.99.100:5043 check 143 | 144 | backend swagger 145 | mode http 146 | acl swagger_root path -i /swagger 147 | redirect location /swagger/ if swagger_root 148 | option httpchk HEAD / HTTP/1.1\r\nHost:localhost 149 | option httplog 150 | balance roundrobin 151 | server swagger1 192.168.99.100:8081 check 152 | 153 | listen stats 154 | bind *:1936 ssl crt /etc/ssl/proxy.pem 155 | stats enable 156 | stats uri / 157 | stats hide-version 158 | stats auth admin:PLACEHOLDER_PASSWORD 159 | -------------------------------------------------------------------------------- /containers/gameon-proxy/haproxy-ics.cfg: -------------------------------------------------------------------------------- 1 | global 2 | #chroot /var/lib/haproxy 3 | #user haproxy 4 | #group haproxy 5 | stats socket /run/haproxy/admin.sock mode 660 level admin 6 | stats timeout 30s 7 | ssl-default-bind-ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:RC4-SHA:!kEDH:!LOW:!EXP:!MD5:!aNULL:!eNULL 8 | log /dev/stdout local0 info 9 | 10 | userlist admins 11 | user admin insecure-password PLACEHOLDER_PASSWORD 12 | 13 | defaults 14 | mode http 15 | retries 3 16 | option redispatch 17 | option dontlog-normal 18 | option dontlognull 19 | timeout connect 5000 20 | timeout client 500000 21 | timeout server 500000 22 | errorfile 400 /etc/haproxy/errors/400.http 23 | errorfile 403 /etc/haproxy/errors/403.http 24 | errorfile 408 /etc/haproxy/errors/408.http 25 | errorfile 500 /etc/haproxy/errors/500.http 26 | errorfile 502 /etc/haproxy/errors/502.http 27 | errorfile 503 /etc/haproxy/errors/503.http 28 | errorfile 504 /etc/haproxy/errors/504.http 29 | 30 | frontend frontend-ssl 31 | bind *:443 ssl crt /etc/ssl/proxy.pem 32 | mode http 33 | option httplog 34 | redirect prefix https://gameontext.org code 301 if { hdr(host) -i game-on.org } 35 | redirect prefix https://book.gameontext.org code 301 if { hdr(host) -i book.game-on.org } 36 | 37 | acl player path_beg -i /play 38 | use_backend player if player 39 | 40 | acl auth path_beg -i /auth 41 | use_backend auth if auth 42 | 43 | acl map path_beg -i /map 44 | use_backend map if map 45 | 46 | acl swagger path_beg -i /swagger 47 | use_backend swagger if swagger 48 | 49 | acl slackin path_beg -i /slackin 50 | use_backend slackin if slackin 51 | 52 | acl mediator path_beg -i /mediator 53 | use_backend mediator if mediator 54 | 55 | acl interactivemap path_beg -i /interactivemap 56 | http-request redirect location https://gameon-interactivemap.mybluemix.net/interactivemap code 301 if interactivemap 57 | 58 | default_backend static-content 59 | 60 | frontend frontend-plain 61 | bind *:80 62 | mode http 63 | option httplog 64 | redirect prefix https://gameontext.org code 301 if { hdr(host) -i game-on.org } 65 | redirect prefix https://book.gameontext.org code 301 if { hdr(host) -i book.game-on.org } 66 | redirect scheme https code 301 if !{ ssl_fc } 67 | 68 | 69 | backend map 70 | mode http 71 | option httplog 72 | option httpchk GET /map/map/v1/health HTTP/1.1\r\nHost:localhost 73 | balance roundrobin 74 | acl map2 path_beg -i /map/map 75 | http-request set-uri http://%[req.hdr(Host)]/map%[path]?%[query] if !map2 76 | server map1 ${MAP_ENDPOINT} check verify none 77 | 78 | backend mediator 79 | mode http 80 | option httplog 81 | balance roundrobin 82 | acl mediator2 path_beg -i /mediator/mediator 83 | http-request set-uri http://%[req.hdr(Host)]/mediator%[path]?%[query] if !mediator2 84 | server mediator1 ${MEDIATOR_ENDPOINT} check verify none 85 | 86 | backend auth 87 | mode http 88 | option httplog 89 | option httpchk GET /auth/auth/health HTTP/1.1\r\nHost:localhost 90 | balance roundrobin 91 | acl auth2 path_beg -i /auth/auth 92 | http-request set-uri http://%[req.hdr(Host)]/auth%[path]?%[query] if !auth2 93 | server auth1 ${AUTH_ENDPOINT} check verify none 94 | 95 | backend player 96 | mode http 97 | option httplog 98 | balance roundrobin 99 | acl player2 path_beg -i /players/players 100 | http-request set-uri http://%[req.hdr(Host)]/players%[path]?%[query] if !player2 101 | server player1 ${PLAYER_ENDPOINT} check verify none 102 | 103 | backend slackin 104 | mode http 105 | option httplog 106 | balance roundrobin 107 | acl slackin2 path_beg -i /slackin/slackin 108 | http-request set-uri http://%[req.hdr(Host)]/slackin%[path]?%[query] if !slackin2 109 | server slackin1 ${SLACKIN_ENDPOINT} check verify none 110 | 111 | backend swagger 112 | mode http 113 | acl swagger_root path -i /swagger 114 | redirect location /swagger/ if swagger_root 115 | option httpchk HEAD /swagger/ HTTP/1.1\r\nHost:localhost 116 | option httplog 117 | balance roundrobin 118 | acl swagger2 path_beg -i /swagger/swagger/ 119 | http-request set-uri http://%[req.hdr(Host)]/swagger%[path]?%[query] if !swagger2 120 | server swagger1 ${SWAGGER_ENDPOINT} check 121 | 122 | backend static-content 123 | mode http 124 | option httpchk HEAD /webapp/ HTTP/1.1\r\nHost:localhost 125 | option httplog 126 | balance roundrobin 127 | acl webapp2 path_beg -i /webapp/ 128 | http-request set-uri http://%[req.hdr(Host)]/webapp%[path]?%[query] if !webapp2 129 | server webapp1 ${WEBAPP_ENDPOINT} check inter 1m 130 | -------------------------------------------------------------------------------- /containers/gameon-proxy/haproxy.cfg: -------------------------------------------------------------------------------- 1 | global 2 | log PLACEHOLDER_LOGHOST syslog 3 | #chroot /var/lib/haproxy 4 | stats socket /run/haproxy/admin.sock mode 660 level admin 5 | stats timeout 30s 6 | #user haproxy 7 | #group haproxy 8 | 9 | ssl-default-bind-ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:RC4-SHA:!kEDH:!LOW:!EXP:!MD5:!aNULL:!eNULL 10 | 11 | userlist admins 12 | user admin insecure-password PLACEHOLDER_PASSWORD 13 | 14 | defaults 15 | log global 16 | mode http 17 | retries 3 18 | option redispatch 19 | option dontlognull 20 | timeout connect 5000 21 | timeout client 500000 22 | timeout server 500000 23 | errorfile 400 /etc/haproxy/errors/400.http 24 | errorfile 403 /etc/haproxy/errors/403.http 25 | errorfile 408 /etc/haproxy/errors/408.http 26 | errorfile 500 /etc/haproxy/errors/500.http 27 | errorfile 502 /etc/haproxy/errors/502.http 28 | errorfile 503 /etc/haproxy/errors/503.http 29 | errorfile 504 /etc/haproxy/errors/504.http 30 | 31 | frontend logstash-lumberjack 32 | bind *:5043 33 | mode tcp 34 | option tcplog 35 | default_backend logstash-lumberjack 36 | 37 | frontend frontend-ssl 38 | bind *:443 ssl crt /etc/ssl/proxy.pem no-sslv3 39 | mode http 40 | option httplog 41 | redirect prefix https://book.gameontext.org code 301 if { hdr(host) -i book.game-on.org } 42 | 43 | acl auth path_beg -i /auth 44 | use_backend auth if auth 45 | 46 | acl player path_beg -i /play 47 | use_backend player if player 48 | 49 | acl map path_beg -i /map 50 | use_backend map if map 51 | 52 | acl swagger path_beg -i /swagger 53 | use_backend swagger if swagger 54 | 55 | acl room path_beg -i /rooms 56 | use_backend room if room 57 | 58 | acl roomjs path_beg -i /roomjs 59 | use_backend roomjs if roomjs 60 | 61 | acl mediator path_beg -i /mediator 62 | use_backend mediator if mediator 63 | 64 | acl interactivemap path_beg -i /interactivemap 65 | http-request redirect location https://gameon-interactivemap.mybluemix.net/interactivemap code 301 if interactivemap 66 | 67 | default_backend static-content 68 | 69 | frontend frontend-plain 70 | bind *:80 71 | mode http 72 | option httplog 73 | redirect prefix https://book.gameontext.org code 301 if { hdr(host) -i book.game-on.org } 74 | redirect scheme https code 301 if !{ ssl_fc } 75 | 76 | backend room 77 | mode http 78 | option httplog 79 | option httpchk HEAD / HTTP/1.1\r\nHost:localhost 80 | balance roundrobin 81 | server room1 PLACEHOLDER_DOCKERHOST:9080 check 82 | 83 | backend roomjs 84 | mode http 85 | option httplog 86 | balance roundrobin 87 | server room1 PLACEHOLDER_DOCKERHOST:5000 check 88 | 89 | backend map 90 | mode http 91 | option httplog 92 | option httpchk GET /map/v1/health HTTP/1.1\r\nHost:localhost 93 | balance roundrobin 94 | server map1 PLACEHOLDER_DOCKERHOST:9447 ssl check check-ssl verify none 95 | 96 | backend mediator 97 | mode http 98 | option httplog 99 | balance roundrobin 100 | server mediator1 PLACEHOLDER_DOCKERHOST:9446 ssl check check-ssl verify none 101 | 102 | backend auth 103 | mode http 104 | option httplog 105 | option httpchk GET /auth/health HTTP/1.1\r\nHost:localhost 106 | balance roundrobin 107 | server auth1 PLACEHOLDER_DOCKERHOST:9449 ssl check check-ssl verify none 108 | 109 | backend player 110 | mode http 111 | option httplog 112 | balance roundrobin 113 | server player1 PLACEHOLDER_DOCKERHOST:9443 ssl check check-ssl verify none 114 | 115 | backend static-content 116 | mode http 117 | option httpchk HEAD / HTTP/1.1\r\nHost:localhost 118 | option httplog 119 | balance roundrobin 120 | server webapp1 PLACEHOLDER_DOCKERHOST:8080 check 121 | 122 | backend logstash-lumberjack 123 | mode tcp 124 | option tcplog 125 | balance roundrobin 126 | server logstash1 PLACEHOLDER_DOCKERHOST:5043 check 127 | 128 | backend swagger 129 | mode http 130 | acl swagger_root path -i /swagger 131 | redirect location /swagger/ if swagger_root 132 | option httpchk HEAD / HTTP/1.1\r\nHost:localhost 133 | option httplog 134 | balance roundrobin 135 | server swagger1 PLACEHOLDER_DOCKERHOST:8081 check 136 | 137 | listen stats 138 | bind *:1936 ssl crt /etc/ssl/proxy.pem 139 | stats enable 140 | stats uri / 141 | stats hide-version 142 | stats auth admin:PLACEHOLDER_PASSWORD 143 | -------------------------------------------------------------------------------- /containers/gameon-proxy/icsBuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # The following colors have been defined to help with presentation of logs: green, red, label_color, no_color. 3 | log_and_echo "$LABEL" "Starting build script" 4 | 5 | # The IBM Container Service CLI (ice), Git client (git), IDS Inventory CLI (ids-inv) and Python 2.7.3 (python) have been installed. 6 | # Based on the organization and space selected in the Job credentials are in place for both IBM Container Service and IBM Bluemix 7 | ##################### 8 | # Run unit tests # 9 | ##################### 10 | log_and_echo "$LABEL" "No unit tests cases have been checked in" 11 | 12 | ###################################### 13 | # Build Container via Dockerfile # 14 | ###################################### 15 | 16 | # REGISTRY_URL=${CCS_REGISTRY_HOST}/${NAMESPACE} 17 | # FULL_REPOSITORY_NAME=${REGISTRY_URL}/${IMAGE_NAME}:${APPLICATION_VERSION} 18 | # If you wish to receive slack notifications, set SLACK_WEBHOOK_PATH as a property on the stage. 19 | 20 | if [ -f Dockerfile ]; then 21 | log_and_echo "$LABEL" "Building ${FULL_REPOSITORY_NAME}" 22 | ${EXT_DIR}/utilities/sendMessage.sh -l info -m "New container build requested for ${FULL_REPOSITORY_NAME}" 23 | # build image 24 | BUILD_COMMAND="" 25 | if [ "${USE_CACHED_LAYERS}" == "true" ]; then 26 | BUILD_COMMAND="build --pull --tag ${FULL_REPOSITORY_NAME} ${WORKSPACE}" 27 | ice_retry ${BUILD_COMMAND} 28 | RESULT=$? 29 | else 30 | BUILD_COMMAND="build --no-cache --tag ${FULL_REPOSITORY_NAME} ${WORKSPACE}" 31 | ice_retry ${BUILD_COMMAND} 32 | RESULT=$? 33 | fi 34 | 35 | if [ $RESULT -ne 0 ]; then 36 | log_and_echo "$ERROR" "Error building image" 37 | ice info 38 | ice images 39 | ${EXT_DIR}/print_help.sh 40 | ${EXT_DIR}/utilities/sendMessage.sh -l bad -m "Container build of ${FULL_REPOSITORY_NAME} failed. $(get_error_info)" 41 | exit 1 42 | else 43 | log_and_echo "$SUCCESSFUL" "Container build of ${FULL_REPOSITORY_NAME} was successful" 44 | ${EXT_DIR}/utilities/sendMessage.sh -l good -m "Container build of ${FULL_REPOSITORY_NAME} was successful" 45 | fi 46 | else 47 | log_and_echo "$ERROR" "Dockerfile not found in project" 48 | ${EXT_DIR}/utilities/sendMessage.sh -l bad -m "Failed to get Dockerfile. $(get_error_info)" 49 | exit 1 50 | fi 51 | 52 | ###################################################################################### 53 | # Copy any artifacts that will be needed for deployment and testing to $WORKSPACE # 54 | ###################################################################################### 55 | echo "IMAGE_NAME=${FULL_REPOSITORY_NAME}" >> $ARCHIVE_DIR/build.properties 56 | cp icsDeploy.sh $ARCHIVE_DIR 57 | 58 | -------------------------------------------------------------------------------- /containers/gameon-proxy/icsDeploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | git_retry clone https://github.com/gameontext/ics-pipeline-utilities.git pipeline_utils 3 | 4 | pipeline_utils/icsGroupDeploy.sh 5 | -------------------------------------------------------------------------------- /containers/gameon-proxy/idsBuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # This script is only intended to run in the IBM DevOps Services Pipeline Environment. 5 | # 6 | 7 | echo Informing slack... 8 | curl -X 'POST' --silent --data-binary '{"text":"A new build for the proxy has started."}' $WEBHOOK > /dev/null 9 | 10 | echo Setting up Docker... 11 | mkdir dockercfg ; cd dockercfg 12 | echo -e $KEY > key.pem 13 | echo -e $CA_CERT > ca.pem 14 | echo -e $CERT > cert.pem 15 | echo Key Hash `echo $KEY | md5sum` 16 | echo Ca Cert Hash `echo $CA_CERT | md5sum` 17 | echo Cert Hash `echo $CERT | md5sum` 18 | cd .. 19 | wget http://security.ubuntu.com/ubuntu/pool/main/a/apparmor/libapparmor1_2.8.95~2430-0ubuntu5.3_amd64.deb -O libapparmor.deb 20 | sudo dpkg -i libapparmor.deb 21 | rm libapparmor.deb 22 | wget https://get.docker.com/builds/Linux/x86_64/docker-1.9.1 --quiet -O docker 23 | chmod +x docker 24 | 25 | echo Building the docker image... 26 | ./docker build -t gameon-proxy . 27 | echo Stopping the existing container... 28 | ./docker stop -t 0 gameon-proxy 29 | ./docker rm gameon-proxy 30 | echo Starting the new container... 31 | ./docker run -d -p 80:80 -p 443:443 -p 1936:1936 -p 9001:9001 --restart=always --link=etcd -e ETCDCTL_ENDPOINT=http://etcd:4001 --name=gameon-proxy gameon-proxy 32 | 33 | rm -rf dockercfg 34 | -------------------------------------------------------------------------------- /containers/gameon-proxy/proxy.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIEGTCCAwGgAwIBAgIJAJrPw7yxIWvcMA0GCSqGSIb3DQEBCwUAMIGiMQswCQYD 3 | VQQGEwJVUzEXMBUGA1UECAwOTm9ydGggQ2Fyb2xpbmExDzANBgNVBAcMBkR1cmhh 4 | bTEMMAoGA1UECgwDSUJNMREwDwYDVQQLDAhQYXR0ZXJuczElMCMGA1UEAwwcZG9j 5 | a2VyLWNvbXB1dGUtMS5kZXZ0ZXN0LmJpejEhMB8GCSqGSIb3DQEJARYSYmVuanNt 6 | aUB1cy5pYm0uY29tMB4XDTE1MTAwNzE5NTMwMloXDTE2MTAwNjE5NTMwMlowgaIx 7 | CzAJBgNVBAYTAlVTMRcwFQYDVQQIDA5Ob3J0aCBDYXJvbGluYTEPMA0GA1UEBwwG 8 | RHVyaGFtMQwwCgYDVQQKDANJQk0xETAPBgNVBAsMCFBhdHRlcm5zMSUwIwYDVQQD 9 | DBxkb2NrZXItY29tcHV0ZS0xLmRldnRlc3QuYml6MSEwHwYJKoZIhvcNAQkBFhJi 10 | ZW5qc21pQHVzLmlibS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB 11 | AQCeYcZoE3kA2Ido+O5zpAXBySAmG5iUV2gGDuIea1H2UlVVD5gAnFOVV4qOhJVN 12 | rer5NsKx1fm+TfhM5w3k6m/ZWwn3IuXkiegrRwa3R0BlFsc52YsyFeC8u1cccNHz 13 | CqM2MLrB2rS+/XXFP2jKxzuVzU+3ROaSmjZAO0FTpTQ8C8X5rB4vG1HSlCK3wRpQ 14 | +9krkCFB4Fi0YcMBC8N10M8+LMoTtJIrQGUJr+0yZWqql3M3Ta3Ji2Q6kXAkGPes 15 | RxrqRwlUvEgdCgidihp+Br9DHpSXf5wlPM2vv2EuJvA4ss0pnuluv6vtsLx5/1jt 16 | j/3PrjuFipFkL+PhrcCMakJ/AgMBAAGjUDBOMB0GA1UdDgQWBBRxdJ5d242T/Hdu 17 | ZSAzuQl07bFTWzAfBgNVHSMEGDAWgBRxdJ5d242T/HduZSAzuQl07bFTWzAMBgNV 18 | HRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQACRjrRIiSHkdg1RLdMdCeAzw0U 19 | tmUHHFp5v6Vtk+1BO59KCOdaDrq5eULAGUqeyjlFKuUzO0+8ZIUCYcPaY8E8rPXN 20 | GfeDxf2cMD/uk0qM8eZnT0pbg6JsntCL66sKve/sWCVf/9dRtpVH04a3yKeBYLqa 21 | q3mn1yruFBQ/AyGY2HeKAi7ZHhM2OhaLl90JDaixxssOMuF9UFJ6sg0J28CKaQ7U 22 | h9uqKNZ1s5qeL2yLlTAFvuN8QXAH7MdxE+zfkVa+DjgAI4XJ+3vm5MHFEacbR7UR 23 | UXvid3B96oRULwvW6JNM4fTsS0sduisXUP54yRvBBdhBZywA9N9DmbX+5qqE 24 | -----END CERTIFICATE----- 25 | -----BEGIN PRIVATE KEY----- 26 | MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCeYcZoE3kA2Ido 27 | +O5zpAXBySAmG5iUV2gGDuIea1H2UlVVD5gAnFOVV4qOhJVNrer5NsKx1fm+TfhM 28 | 5w3k6m/ZWwn3IuXkiegrRwa3R0BlFsc52YsyFeC8u1cccNHzCqM2MLrB2rS+/XXF 29 | P2jKxzuVzU+3ROaSmjZAO0FTpTQ8C8X5rB4vG1HSlCK3wRpQ+9krkCFB4Fi0YcMB 30 | C8N10M8+LMoTtJIrQGUJr+0yZWqql3M3Ta3Ji2Q6kXAkGPesRxrqRwlUvEgdCgid 31 | ihp+Br9DHpSXf5wlPM2vv2EuJvA4ss0pnuluv6vtsLx5/1jtj/3PrjuFipFkL+Ph 32 | rcCMakJ/AgMBAAECggEAL9I94fbfNk4qtJtVBD2mL1jXCCqU61Vo50tfIugsmz9I 33 | 3KIUtzp8Uj9YaqfFnOrCY/UQ3DlLaxaHvlCVdWUD2JEQdTpoR5UMMOUFNhmha+Rw 34 | yxrQWJMahGHcb43xFn1Dwnz8JsQuhuxovuHidjep2hVf2GpJZEKD1ukNVIAxQV+j 35 | A5pBgCLOWgbkkGvDv0wPcEemtOGE0deQcSpivqOyk2Xx0j21DVZRlg8mOlUSx8+8 36 | +FtYlKIbisuYztlCbg07kOHN0atR8jvOlRr3bJkXs38moJ7cWAOPibDwcvdomcws 37 | PHET/nWDJ2n3d2LXSEIV+K3cox777DgYFbuMc+VnYQKBgQDPorvHpwGfZXt0f0LX 38 | YrKdeQlTlnRtUfUJW9YNM1W8jANjNmY6uv4pKnAC/m8DUoyTrSmYBco6DqNts/7m 39 | 6B/cy5pDeggNRZisFvO4lInL21qrVbKHUrrApRSp46/rt7ZWYhC17RCx0jACDFST 40 | 1of72RGhMe1qxyGm/Z/e5U4zMwKBgQDDRg1oCx+q6W6Z8bJr+sKMUTMJHy4cFo5v 41 | iDGtPf+wVWvvRW4f0joSUCfL2/KCFiJOIAAozvL/DasAE9vzYcigGqwrL0xS4nFM 42 | k0wrEHKzYoB0kSoCXNVEtPcRsmC4Nf4X998hWUzXRMifFnDhaHc8+P6LuIdGCQC6 43 | QP/UTw+zhQKBgQCgdfu2XHslitCwhBTMzQqKJdquTUymmzrJw74VL4HnlzCbAJRa 44 | eN4oRBKSTbzPDYF0MtM9F+Rjn6JvCjZIjkTpZjNOSEVmtE07WPV6xNgEwf09AZpZ 45 | d/a5IBpq/Hmcqbnw4hJV9eH7+hp9yremFJm8aNF2CFaZOVDpc4GUSRN4/wKBgQCg 46 | mmP6V3PDMNwbVvMk5gfOOhZcgT1+MnsRdhVNY/mAgLEWCKeLGm9SkoQ4oXxxy1yJ 47 | nr4i0hp+9THYDX1QTfMg4u8JUYxXexAuJ9N0c8GykegOdzny2YE6UhAGiQwNVbLW 48 | 6bGljvmo71SFq4JJkY7IIg3QwoLXch4cEcuXRTMntQKBgQCmoof/w0QrUl+xVBX2 49 | DCILFNsRu009jLHDe8YgAHI198TSFfrulDTBqzGifP4hJBWpeCplXEC9YjLnI0BZ 50 | tpI/1hRT+bAf+JX/JYIfbB7lEFc9ddaBJiW02l5zJbkpxBLqif70lvOZQgv9980W 51 | 5iIOeRwpq2TuPcZUgZO4ZJr29A== 52 | -----END PRIVATE KEY----- 53 | -------------------------------------------------------------------------------- /containers/gameon-proxy/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Configure our link to etcd based on shared volume with secret 4 | if [ ! -z "$ETCD_SECRET" ]; then 5 | . /data/primordial/setup.etcd.sh /data/primordial $ETCD_SECRET 6 | fi 7 | 8 | export A8_SERVICE=proxy 9 | 10 | if [ "$ETCDCTL_ENDPOINT" != "" ]; then 11 | if [ "$PROXY_CONFIG" == "" ]; then 12 | PROXY_CONFIG=/etc/haproxy/haproxy.cfg 13 | fi 14 | echo Setting up etcd... 15 | echo "** Testing etcd is accessible" 16 | etcdctl --debug ls 17 | RC=$? 18 | 19 | while [ $RC -ne 0 ]; do 20 | sleep 15 21 | 22 | # recheck condition 23 | echo "** Re-testing etcd connection" 24 | etcdctl --debug ls 25 | RC=$? 26 | done 27 | echo "etcdctl returned sucessfully, continuing" 28 | 29 | echo "Using config file $PROXY_CONFIG" 30 | 31 | etcdctl get /proxy/third-party-ssl-cert > /etc/ssl/proxy.pem 32 | sed -i s/PLACEHOLDER_PASSWORD/$(etcdctl get /passwords/admin-password)/g /etc/haproxy/haproxy.cfg 33 | sed -i s/PLACEHOLDER_DOCKERHOST/$(etcdctl get /proxy/docker-host)/g /etc/haproxy/haproxy.cfg 34 | sed -i s/PLACEHOLDER_LOGHOST/$(etcdctl get /logstash/endpoint)/g /etc/haproxy/haproxy.cfg 35 | 36 | export AUTH_ENDPOINT=$(etcdctl get /endpoints/auth) 37 | export ROOM_ENDPOINT=$(etcdctl get /endpoints/room) 38 | export MAP_ENDPOINT=$(etcdctl get /endpoints/map) 39 | export MEDIATOR_ENDPOINT=$(etcdctl get /endpoints/mediator) 40 | export PLAYER_ENDPOINT=$(etcdctl get /endpoints/player) 41 | export WEBAPP_ENDPOINT=$(etcdctl get /endpoints/webapp) 42 | export SWAGGER_ENDPOINT=$(etcdctl get /endpoints/swagger) 43 | export SLACKIN_ENDPOINT=$(etcdctl get /endpoints/slackin) 44 | export A8_REGISTRY_URL=$(etcdctl get /amalgam8/registryUrl) 45 | export A8_CONTROLLER_URL=$(etcdctl get /amalgam8/controllerUrl) 46 | export A8_CONTROLLER_POLL=$(etcdctl get /amalgam8/controllerPoll) 47 | JWT=$(etcdctl get /amalgam8/jwt) 48 | 49 | sudo service rsyslog start 50 | 51 | echo Starting haproxy... 52 | if [ -z "$A8_REGISTRY_URL" ]; then 53 | #no a8, just run haproxy. 54 | haproxy -f $PROXY_CONFIG 55 | else 56 | #a8, configure security, and run via sidecar. 57 | if [ ! -z "$JWT" ]; then 58 | export A8_REGISTRY_TOKEN=$JWT 59 | export A8_CONTROLLER_TOKEN=$JWT 60 | fi 61 | exec a8sidecar --proxy haproxy -f $PROXY_CONFIG 62 | fi 63 | echo HAProxy shut down 64 | else 65 | echo HAProxy will log to STDOUT--this is dev environment. 66 | sed -i s/PLACEHOLDER_PASSWORD/$ADMIN_PASSWORD/g /etc/haproxy/haproxy-dev.cfg 67 | exec a8sidecar --proxy haproxy -f /etc/haproxy/haproxy-dev.cfg 68 | fi 69 | -------------------------------------------------------------------------------- /containers/setup/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ibmjava 2 | COPY gen-keystore.sh /tmp/gen-keystore.sh 3 | WORKDIR /tmp 4 | CMD bash ./gen-keystore.sh ${IP} -------------------------------------------------------------------------------- /containers/setup/README.md: -------------------------------------------------------------------------------- 1 | # Generate Keystore 2 | Dockerfile pulls from ibmjava image. 3 | ``` 4 | FROM ibmjava 5 | COPY gen-keystore.sh /tmp/gen-keystore.sh 6 | WORKDIR /tmp 7 | CMD bash ./gen-keystore.sh ${IP} 8 | ``` 9 | 10 | The provided script `gen-keystore.sh` generates a certificate for the app and requires an IP address as input. You will need to set an environment variable `IP` in your yaml file for creating the Pod. 11 | 12 | Example: 13 | ```yaml 14 | apiVersion: v1 15 | kind: Pod 16 | metadata: 17 | name: setup 18 | labels: 19 | app: gameon 20 | tier: setup 21 | spec: 22 | restartPolicy: Never 23 | containers: 24 | - name: setup 25 | image: anthonyamanse/keystore # Replace this to your image name 26 | env: 27 | - name: IP 28 | value: '169.47.241.213' # Replace this to your cluster's IP address 29 | volumeMounts: 30 | - name: keystore 31 | mountPath: /tmp/keystore/ 32 | volumes: 33 | - name: keystore 34 | persistentVolumeClaim: 35 | claimName: keystore-claim 36 | ``` -------------------------------------------------------------------------------- /containers/setup/gen-keystore.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Generate keystores in ./keystore for a given IP 4 | 5 | if (( $# != 1)) 6 | then 7 | echo "Usage: ./gen-keystore.sh " 8 | exit 1 9 | fi 10 | 11 | IP=$1 12 | 13 | if [ -z ${JAVA_HOME} ] 14 | then 15 | echo "JAVA_HOME is not set. Please set and re-run this script." 16 | exit 1 17 | fi 18 | 19 | echo "Checking for keytool..." 20 | keytool -help > /dev/null 2>&1 21 | if [ $? != 0 ] 22 | then 23 | echo "Error: keytool is missing from the path, please correct this, then retry" 24 | exit 1 25 | fi 26 | 27 | echo "Checking for openssl..." 28 | openssl version > /dev/null 2>&1 29 | if [ $? != 0 ] 30 | then 31 | echo "Error: openssl is missing from the path, please correct this, then retry" 32 | exit 1 33 | fi 34 | 35 | echo "Generating key stores using ${IP}" 36 | 37 | #create a ca cert we'll import into all our trust stores.. 38 | keytool -genkeypair \ 39 | -alias gameonca \ 40 | -keypass gameonca \ 41 | -storepass gameonca \ 42 | -keystore keystore/cakey.jks \ 43 | -keyalg RSA \ 44 | -keysize 2048 \ 45 | -dname "CN=GameOnLocalDevCA, OU=The Amazing GameOn Certificate Authority, O=The Ficticious GameOn Company, L=Earth, ST=Happy, C=CA" \ 46 | -ext KeyUsage="keyCertSign" \ 47 | -ext BasicConstraints:"critical=ca:true" \ 48 | -validity 9999 49 | #export the ca cert so we can add it to the trust stores 50 | keytool -exportcert \ 51 | -alias gameonca \ 52 | -keypass gameonca \ 53 | -storepass gameonca \ 54 | -keystore keystore/cakey.jks \ 55 | -file keystore/gameonca.crt \ 56 | -rfc 57 | #create the keypair we plan to use for our ssl/jwt signing 58 | keytool -genkeypair \ 59 | -alias gameonappkey \ 60 | -keypass testOnlyKeystore \ 61 | -storepass testOnlyKeystore \ 62 | -keystore keystore/key.jks \ 63 | -keyalg RSA \ 64 | -sigalg SHA1withRSA \ 65 | -dname "CN=${IP},OU=GameOn Application,O=The Ficticious GameOn Company,L=Earth,ST=Happy,C=CA" \ 66 | -validity 365 67 | #create the signing request for the app key 68 | keytool -certreq \ 69 | -alias gameonappkey \ 70 | -keypass testOnlyKeystore \ 71 | -storepass testOnlyKeystore \ 72 | -keystore keystore/key.jks \ 73 | -file keystore/appsignreq.csr 74 | #sign the cert with the ca 75 | keytool -gencert \ 76 | -alias gameonca \ 77 | -keypass gameonca \ 78 | -storepass gameonca \ 79 | -keystore keystore/cakey.jks \ 80 | -infile keystore/appsignreq.csr \ 81 | -outfile keystore/app.cer 82 | #import the ca cert 83 | keytool -importcert \ 84 | -alias gameonca \ 85 | -storepass testOnlyKeystore \ 86 | -keypass testOnlyKeystore \ 87 | -keystore keystore/key.jks \ 88 | -noprompt \ 89 | -file keystore/gameonca.crt 90 | #import the signed cert 91 | keytool -importcert \ 92 | -alias gameonappkey \ 93 | -storepass testOnlyKeystore \ 94 | -keypass testOnlyKeystore \ 95 | -keystore keystore/key.jks \ 96 | -noprompt \ 97 | -file keystore/app.cer 98 | #change the alias of the signed cert 99 | keytool -changealias \ 100 | -alias gameonappkey \ 101 | -destalias default \ 102 | -storepass testOnlyKeystore \ 103 | -keypass testOnlyKeystore \ 104 | -keystore keystore/key.jks 105 | #export the signed cert in pem format for proxy to use 106 | keytool -exportcert \ 107 | -alias default \ 108 | -storepass testOnlyKeystore \ 109 | -keypass testOnlyKeystore \ 110 | -keystore keystore/key.jks \ 111 | -file keystore/app.pem \ 112 | -rfc 113 | #export the private key in pem format for proxy to use 114 | keytool -importkeystore \ 115 | -srckeystore keystore/key.jks \ 116 | -destkeystore keystore/key.p12 \ 117 | -srcstoretype jks \ 118 | -deststoretype pkcs12 \ 119 | -srcstorepass testOnlyKeystore \ 120 | -deststorepass testOnlyKeystore \ 121 | -srckeypass testOnlyKeystore \ 122 | -destkeypass testOnlyKeystore \ 123 | -srcalias default 124 | openssl pkcs12 \ 125 | -in keystore/key.p12 \ 126 | -out keystore/private.pem \ 127 | -nocerts \ 128 | -nodes \ 129 | -password pass:testOnlyKeystore 130 | #concat the public and private key for haproxy 131 | cat keystore/app.pem keystore/private.pem > keystore/proxy.pem 132 | #add the cacert to the truststore 133 | keytool -importcert \ 134 | -alias gameonca \ 135 | -storepass truststore \ 136 | -keypass truststore \ 137 | -keystore keystore/truststore.jks \ 138 | -noprompt \ 139 | -trustcacerts \ 140 | -file keystore/gameonca.crt 141 | #add all jvm cacerts to the truststore. 142 | keytool -importkeystore \ 143 | -srckeystore $JAVA_HOME/lib/security/cacerts \ 144 | -destkeystore keystore/truststore.jks \ 145 | -srcstorepass changeit \ 146 | -deststorepass truststore 147 | #clean up the public cert.. 148 | rm -f keystore/public.crt 149 | -------------------------------------------------------------------------------- /core/auth.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: auth 5 | labels: 6 | app: gameon 7 | spec: 8 | type: NodePort 9 | ports: 10 | - port: 9080 11 | protocol: TCP 12 | targetPort: 9080 13 | name: auth-1 14 | nodePort: 30989 15 | - port: 9443 16 | protocol: TCP 17 | targetPort: 9443 18 | name: auth-2 19 | nodePort: 30949 20 | selector: 21 | app: gameon 22 | tier: auth 23 | --- 24 | apiVersion: extensions/v1beta1 25 | kind: Deployment 26 | metadata: 27 | name: auth 28 | labels: 29 | app: gameon 30 | spec: 31 | strategy: 32 | type: Recreate 33 | template: 34 | metadata: 35 | labels: 36 | app: gameon 37 | tier: auth 38 | spec: 39 | containers: 40 | - image: anthonyamanse/gameon-auth:latest 41 | imagePullPolicy: Always 42 | name: auth 43 | env: 44 | - name: service_map 45 | valueFrom: 46 | configMapKeyRef: 47 | name: gameon-env 48 | key: service_map 49 | - name: service_room 50 | valueFrom: 51 | configMapKeyRef: 52 | name: gameon-env 53 | key: service_room 54 | - name: service_simpleroom 55 | valueFrom: 56 | configMapKeyRef: 57 | name: gameon-env 58 | key: service_simpleroom 59 | - name: GITHUB_APP_ID 60 | valueFrom: 61 | configMapKeyRef: 62 | name: gameon-env 63 | key: GITHUB_APP_ID 64 | - name: GITHUB_APP_SECRET 65 | valueFrom: 66 | configMapKeyRef: 67 | name: gameon-env 68 | key: GITHUB_APP_SECRET 69 | - name: TWITTER_CONSUMER_KEY 70 | valueFrom: 71 | configMapKeyRef: 72 | name: gameon-env 73 | key: TWITTER_CONSUMER_KEY 74 | - name: TWITTER_CONSUMER_SECRET 75 | valueFrom: 76 | configMapKeyRef: 77 | name: gameon-env 78 | key: TWITTER_CONSUMER_SECRET 79 | - name: MAP_SERVICE_URL 80 | valueFrom: 81 | configMapKeyRef: 82 | name: gameon-env 83 | key: MAP_SERVICE_URL 84 | - name: PLAYER_SERVICE_URL 85 | valueFrom: 86 | configMapKeyRef: 87 | name: gameon-env 88 | key: PLAYER_SERVICE_URL 89 | - name: COUCHDB_SERVICE_URL 90 | valueFrom: 91 | configMapKeyRef: 92 | name: gameon-env 93 | key: COUCHDB_SERVICE_URL 94 | - name: KAFKA_SERVICE_URL 95 | valueFrom: 96 | configMapKeyRef: 97 | name: gameon-env 98 | key: KAFKA_SERVICE_URL 99 | - name: FRONT_END_PLAYER_URL 100 | valueFrom: 101 | configMapKeyRef: 102 | name: gameon-env 103 | key: FRONT_END_PLAYER_URL 104 | - name: FRONT_END_SUCCESS_CALLBACK 105 | valueFrom: 106 | configMapKeyRef: 107 | name: gameon-env 108 | key: FRONT_END_SUCCESS_CALLBACK 109 | - name: FRONT_END_FAIL_CALLBACK 110 | valueFrom: 111 | configMapKeyRef: 112 | name: gameon-env 113 | key: FRONT_END_FAIL_CALLBACK 114 | - name: FRONT_END_AUTH_URL 115 | valueFrom: 116 | configMapKeyRef: 117 | name: gameon-env 118 | key: FRONT_END_AUTH_URL 119 | - name: GAMEON_MODE 120 | valueFrom: 121 | configMapKeyRef: 122 | name: gameon-env 123 | key: GAMEON_MODE 124 | - name: TARGET_PLATFORM 125 | valueFrom: 126 | configMapKeyRef: 127 | name: gameon-env 128 | key: TARGET_PLATFORM 129 | - name: SYSTEM_ID 130 | valueFrom: 131 | configMapKeyRef: 132 | name: gameon-env 133 | key: SYSTEM_ID 134 | - name: LICENSE 135 | valueFrom: 136 | configMapKeyRef: 137 | name: gameon-env 138 | key: LICENSE 139 | - name: PROXY_DOCKER_HOST 140 | valueFrom: 141 | configMapKeyRef: 142 | name: gameon-env 143 | key: PROXY_DOCKER_HOST 144 | - name: ADMIN_PASSWORD 145 | valueFrom: 146 | configMapKeyRef: 147 | name: gameon-env 148 | key: ADMIN_PASSWORD 149 | - name: WLP_SKIP_MAXPERMSIZE 150 | valueFrom: 151 | configMapKeyRef: 152 | name: gameon-env 153 | key: WLP_SKIP_MAXPERMSIZE 154 | - name: WLP_OUTPUT_DIR 155 | valueFrom: 156 | configMapKeyRef: 157 | name: gameon-env 158 | key: WLP_OUTPUT_DIR 159 | - name: LOG_DIR 160 | valueFrom: 161 | configMapKeyRef: 162 | name: gameon-env 163 | key: LOG_DIR 164 | - name: MAP_KEY 165 | valueFrom: 166 | configMapKeyRef: 167 | name: gameon-env 168 | key: MAP_KEY 169 | - name: COUCHDB_USER 170 | valueFrom: 171 | configMapKeyRef: 172 | name: gameon-env 173 | key: COUCHDB_USER 174 | - name: COUCHDB_PASSWORD 175 | valueFrom: 176 | configMapKeyRef: 177 | name: gameon-env 178 | key: COUCHDB_PASSWORD 179 | - name: A8_REGISTRY_URL 180 | valueFrom: 181 | configMapKeyRef: 182 | name: gameon-env 183 | key: A8_REGISTRY_URL 184 | - name: A8_CONTROLLER_URL 185 | valueFrom: 186 | configMapKeyRef: 187 | name: gameon-env 188 | key: A8_CONTROLLER_URL 189 | - name: A8_CONTROLLER_POLL 190 | valueFrom: 191 | configMapKeyRef: 192 | name: gameon-env 193 | key: A8_CONTROLLER_POLL 194 | - name: A8_CONTROLLER_POLL 195 | valueFrom: 196 | configMapKeyRef: 197 | name: gameon-env 198 | key: A8_CONTROLLER_POLL 199 | ports: 200 | - containerPort: 9080 201 | name: auth-1 202 | - containerPort: 9443 203 | name: auth-2 204 | volumeMounts: 205 | - name: keystore 206 | mountPath: /opt/ibm/wlp/usr/servers/defaultServer/resources/security 207 | volumes: 208 | - name: keystore 209 | persistentVolumeClaim: 210 | claimName: keystore-claim 211 | -------------------------------------------------------------------------------- /core/map.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: map 5 | labels: 6 | app: gameon 7 | spec: 8 | type: NodePort 9 | ports: 10 | - port: 9080 11 | protocol: TCP 12 | targetPort: 9080 13 | name: map-1 14 | nodePort: 30999 15 | - port: 9443 16 | protocol: TCP 17 | targetPort: 9443 18 | name: map-2 19 | nodePort: 30947 20 | selector: 21 | app: gameon 22 | tier: map 23 | --- 24 | apiVersion: extensions/v1beta1 25 | kind: Deployment 26 | metadata: 27 | name: map 28 | labels: 29 | app: gameon 30 | spec: 31 | strategy: 32 | type: Recreate 33 | template: 34 | metadata: 35 | labels: 36 | app: gameon 37 | tier: map 38 | spec: 39 | containers: 40 | - image: anthonyamanse/gameon-map:latest 41 | imagePullPolicy: Always 42 | name: map 43 | env: 44 | - name: service_map 45 | valueFrom: 46 | configMapKeyRef: 47 | name: gameon-env 48 | key: service_map 49 | - name: service_room 50 | valueFrom: 51 | configMapKeyRef: 52 | name: gameon-env 53 | key: service_room 54 | - name: service_simpleroom 55 | valueFrom: 56 | configMapKeyRef: 57 | name: gameon-env 58 | key: service_simpleroom 59 | - name: GITHUB_APP_ID 60 | valueFrom: 61 | configMapKeyRef: 62 | name: gameon-env 63 | key: GITHUB_APP_ID 64 | - name: GITHUB_APP_SECRET 65 | valueFrom: 66 | configMapKeyRef: 67 | name: gameon-env 68 | key: GITHUB_APP_SECRET 69 | - name: TWITTER_CONSUMER_KEY 70 | valueFrom: 71 | configMapKeyRef: 72 | name: gameon-env 73 | key: TWITTER_CONSUMER_KEY 74 | - name: TWITTER_CONSUMER_SECRET 75 | valueFrom: 76 | configMapKeyRef: 77 | name: gameon-env 78 | key: TWITTER_CONSUMER_SECRET 79 | - name: MAP_SERVICE_URL 80 | valueFrom: 81 | configMapKeyRef: 82 | name: gameon-env 83 | key: MAP_SERVICE_URL 84 | - name: PLAYER_SERVICE_URL 85 | valueFrom: 86 | configMapKeyRef: 87 | name: gameon-env 88 | key: PLAYER_SERVICE_URL 89 | - name: COUCHDB_SERVICE_URL 90 | valueFrom: 91 | configMapKeyRef: 92 | name: gameon-env 93 | key: COUCHDB_SERVICE_URL 94 | - name: KAFKA_SERVICE_URL 95 | valueFrom: 96 | configMapKeyRef: 97 | name: gameon-env 98 | key: KAFKA_SERVICE_URL 99 | - name: FRONT_END_PLAYER_URL 100 | valueFrom: 101 | configMapKeyRef: 102 | name: gameon-env 103 | key: FRONT_END_PLAYER_URL 104 | - name: FRONT_END_SUCCESS_CALLBACK 105 | valueFrom: 106 | configMapKeyRef: 107 | name: gameon-env 108 | key: FRONT_END_SUCCESS_CALLBACK 109 | - name: FRONT_END_FAIL_CALLBACK 110 | valueFrom: 111 | configMapKeyRef: 112 | name: gameon-env 113 | key: FRONT_END_FAIL_CALLBACK 114 | - name: FRONT_END_AUTH_URL 115 | valueFrom: 116 | configMapKeyRef: 117 | name: gameon-env 118 | key: FRONT_END_AUTH_URL 119 | - name: GAMEON_MODE 120 | valueFrom: 121 | configMapKeyRef: 122 | name: gameon-env 123 | key: GAMEON_MODE 124 | - name: TARGET_PLATFORM 125 | valueFrom: 126 | configMapKeyRef: 127 | name: gameon-env 128 | key: TARGET_PLATFORM 129 | - name: SYSTEM_ID 130 | valueFrom: 131 | configMapKeyRef: 132 | name: gameon-env 133 | key: SYSTEM_ID 134 | - name: LICENSE 135 | valueFrom: 136 | configMapKeyRef: 137 | name: gameon-env 138 | key: LICENSE 139 | - name: PROXY_DOCKER_HOST 140 | valueFrom: 141 | configMapKeyRef: 142 | name: gameon-env 143 | key: PROXY_DOCKER_HOST 144 | - name: ADMIN_PASSWORD 145 | valueFrom: 146 | configMapKeyRef: 147 | name: gameon-env 148 | key: ADMIN_PASSWORD 149 | - name: WLP_SKIP_MAXPERMSIZE 150 | valueFrom: 151 | configMapKeyRef: 152 | name: gameon-env 153 | key: WLP_SKIP_MAXPERMSIZE 154 | - name: WLP_OUTPUT_DIR 155 | valueFrom: 156 | configMapKeyRef: 157 | name: gameon-env 158 | key: WLP_OUTPUT_DIR 159 | - name: LOG_DIR 160 | valueFrom: 161 | configMapKeyRef: 162 | name: gameon-env 163 | key: LOG_DIR 164 | - name: MAP_KEY 165 | valueFrom: 166 | configMapKeyRef: 167 | name: gameon-env 168 | key: MAP_KEY 169 | - name: COUCHDB_USER 170 | valueFrom: 171 | configMapKeyRef: 172 | name: gameon-env 173 | key: COUCHDB_USER 174 | - name: COUCHDB_PASSWORD 175 | valueFrom: 176 | configMapKeyRef: 177 | name: gameon-env 178 | key: COUCHDB_PASSWORD 179 | - name: A8_REGISTRY_URL 180 | valueFrom: 181 | configMapKeyRef: 182 | name: gameon-env 183 | key: A8_REGISTRY_URL 184 | - name: A8_CONTROLLER_URL 185 | valueFrom: 186 | configMapKeyRef: 187 | name: gameon-env 188 | key: A8_CONTROLLER_URL 189 | - name: A8_CONTROLLER_POLL 190 | valueFrom: 191 | configMapKeyRef: 192 | name: gameon-env 193 | key: A8_CONTROLLER_POLL 194 | - name: A8_CONTROLLER_POLL 195 | valueFrom: 196 | configMapKeyRef: 197 | name: gameon-env 198 | key: A8_CONTROLLER_POLL 199 | ports: 200 | - containerPort: 9080 201 | name: map-1 202 | - containerPort: 9443 203 | name: map-2 204 | volumeMounts: 205 | - name: keystore 206 | mountPath: /opt/ibm/wlp/usr/servers/defaultServer/resources/security 207 | volumes: 208 | - name: keystore 209 | persistentVolumeClaim: 210 | claimName: keystore-claim 211 | -------------------------------------------------------------------------------- /core/mediator.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: mediator 5 | labels: 6 | app: gameon 7 | spec: 8 | type: NodePort 9 | ports: 10 | - port: 9080 11 | protocol: TCP 12 | targetPort: 9080 13 | name: mediator-1 14 | nodePort: 30986 15 | - port: 9443 16 | protocol: TCP 17 | targetPort: 9443 18 | name: mediator-2 19 | nodePort: 30946 20 | selector: 21 | app: gameon 22 | tier: mediator 23 | --- 24 | apiVersion: extensions/v1beta1 25 | kind: Deployment 26 | metadata: 27 | name: mediator 28 | labels: 29 | app: gameon 30 | spec: 31 | strategy: 32 | type: Recreate 33 | template: 34 | metadata: 35 | labels: 36 | app: gameon 37 | tier: mediator 38 | spec: 39 | containers: 40 | - image: anthonyamanse/gameon-mediator:latest 41 | imagePullPolicy: Always 42 | name: mediator 43 | env: 44 | - name: service_map 45 | valueFrom: 46 | configMapKeyRef: 47 | name: gameon-env 48 | key: service_map 49 | - name: service_room 50 | valueFrom: 51 | configMapKeyRef: 52 | name: gameon-env 53 | key: service_room 54 | - name: service_simpleroom 55 | valueFrom: 56 | configMapKeyRef: 57 | name: gameon-env 58 | key: service_simpleroom 59 | - name: GITHUB_APP_ID 60 | valueFrom: 61 | configMapKeyRef: 62 | name: gameon-env 63 | key: GITHUB_APP_ID 64 | - name: GITHUB_APP_SECRET 65 | valueFrom: 66 | configMapKeyRef: 67 | name: gameon-env 68 | key: GITHUB_APP_SECRET 69 | - name: TWITTER_CONSUMER_KEY 70 | valueFrom: 71 | configMapKeyRef: 72 | name: gameon-env 73 | key: TWITTER_CONSUMER_KEY 74 | - name: TWITTER_CONSUMER_SECRET 75 | valueFrom: 76 | configMapKeyRef: 77 | name: gameon-env 78 | key: TWITTER_CONSUMER_SECRET 79 | - name: MAP_SERVICE_URL 80 | valueFrom: 81 | configMapKeyRef: 82 | name: gameon-env 83 | key: MAP_SERVICE_URL 84 | - name: PLAYER_SERVICE_URL 85 | valueFrom: 86 | configMapKeyRef: 87 | name: gameon-env 88 | key: PLAYER_SERVICE_URL 89 | - name: COUCHDB_SERVICE_URL 90 | valueFrom: 91 | configMapKeyRef: 92 | name: gameon-env 93 | key: COUCHDB_SERVICE_URL 94 | - name: KAFKA_SERVICE_URL 95 | valueFrom: 96 | configMapKeyRef: 97 | name: gameon-env 98 | key: KAFKA_SERVICE_URL 99 | - name: FRONT_END_PLAYER_URL 100 | valueFrom: 101 | configMapKeyRef: 102 | name: gameon-env 103 | key: FRONT_END_PLAYER_URL 104 | - name: FRONT_END_SUCCESS_CALLBACK 105 | valueFrom: 106 | configMapKeyRef: 107 | name: gameon-env 108 | key: FRONT_END_SUCCESS_CALLBACK 109 | - name: FRONT_END_FAIL_CALLBACK 110 | valueFrom: 111 | configMapKeyRef: 112 | name: gameon-env 113 | key: FRONT_END_FAIL_CALLBACK 114 | - name: FRONT_END_AUTH_URL 115 | valueFrom: 116 | configMapKeyRef: 117 | name: gameon-env 118 | key: FRONT_END_AUTH_URL 119 | - name: GAMEON_MODE 120 | valueFrom: 121 | configMapKeyRef: 122 | name: gameon-env 123 | key: GAMEON_MODE 124 | - name: TARGET_PLATFORM 125 | valueFrom: 126 | configMapKeyRef: 127 | name: gameon-env 128 | key: TARGET_PLATFORM 129 | - name: SYSTEM_ID 130 | valueFrom: 131 | configMapKeyRef: 132 | name: gameon-env 133 | key: SYSTEM_ID 134 | - name: LICENSE 135 | valueFrom: 136 | configMapKeyRef: 137 | name: gameon-env 138 | key: LICENSE 139 | - name: PROXY_DOCKER_HOST 140 | valueFrom: 141 | configMapKeyRef: 142 | name: gameon-env 143 | key: PROXY_DOCKER_HOST 144 | - name: ADMIN_PASSWORD 145 | valueFrom: 146 | configMapKeyRef: 147 | name: gameon-env 148 | key: ADMIN_PASSWORD 149 | - name: WLP_SKIP_MAXPERMSIZE 150 | valueFrom: 151 | configMapKeyRef: 152 | name: gameon-env 153 | key: WLP_SKIP_MAXPERMSIZE 154 | - name: WLP_OUTPUT_DIR 155 | valueFrom: 156 | configMapKeyRef: 157 | name: gameon-env 158 | key: WLP_OUTPUT_DIR 159 | - name: LOG_DIR 160 | valueFrom: 161 | configMapKeyRef: 162 | name: gameon-env 163 | key: LOG_DIR 164 | - name: MAP_KEY 165 | valueFrom: 166 | configMapKeyRef: 167 | name: gameon-env 168 | key: MAP_KEY 169 | - name: COUCHDB_USER 170 | valueFrom: 171 | configMapKeyRef: 172 | name: gameon-env 173 | key: COUCHDB_USER 174 | - name: COUCHDB_PASSWORD 175 | valueFrom: 176 | configMapKeyRef: 177 | name: gameon-env 178 | key: COUCHDB_PASSWORD 179 | - name: A8_REGISTRY_URL 180 | valueFrom: 181 | configMapKeyRef: 182 | name: gameon-env 183 | key: A8_REGISTRY_URL 184 | - name: A8_CONTROLLER_URL 185 | valueFrom: 186 | configMapKeyRef: 187 | name: gameon-env 188 | key: A8_CONTROLLER_URL 189 | - name: A8_CONTROLLER_POLL 190 | valueFrom: 191 | configMapKeyRef: 192 | name: gameon-env 193 | key: A8_CONTROLLER_POLL 194 | - name: A8_CONTROLLER_POLL 195 | valueFrom: 196 | configMapKeyRef: 197 | name: gameon-env 198 | key: A8_CONTROLLER_POLL 199 | ports: 200 | - containerPort: 9080 201 | name: mediator-1 202 | - containerPort: 9443 203 | name: mediator-2 204 | volumeMounts: 205 | - name: keystore 206 | mountPath: /opt/ibm/wlp/usr/servers/defaultServer/resources/security 207 | volumes: 208 | - name: keystore 209 | persistentVolumeClaim: 210 | claimName: keystore-claim 211 | -------------------------------------------------------------------------------- /core/player.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: player 5 | labels: 6 | app: gameon 7 | spec: 8 | type: NodePort 9 | ports: 10 | - port: 4201 11 | protocol: TCP 12 | targetPort: 4201 13 | name: player-1 14 | nodePort: 30421 15 | - port: 9443 16 | protocol: TCP 17 | targetPort: 9443 18 | name: player-3 19 | nodePort: 30943 20 | - port: 9080 21 | protocol: TCP 22 | targetPort: 9080 23 | name: player-2 24 | nodePort: 30982 25 | selector: 26 | app: gameon 27 | tier: player 28 | --- 29 | apiVersion: extensions/v1beta1 30 | kind: Deployment 31 | metadata: 32 | name: player 33 | labels: 34 | app: gameon 35 | spec: 36 | strategy: 37 | type: Recreate 38 | template: 39 | metadata: 40 | labels: 41 | app: gameon 42 | tier: player 43 | spec: 44 | containers: 45 | - image: anthonyamanse/gameon-player:latest 46 | imagePullPolicy: Always 47 | name: player 48 | env: 49 | - name: service_map 50 | valueFrom: 51 | configMapKeyRef: 52 | name: gameon-env 53 | key: service_map 54 | - name: service_room 55 | valueFrom: 56 | configMapKeyRef: 57 | name: gameon-env 58 | key: service_room 59 | - name: service_simpleroom 60 | valueFrom: 61 | configMapKeyRef: 62 | name: gameon-env 63 | key: service_simpleroom 64 | - name: GITHUB_APP_ID 65 | valueFrom: 66 | configMapKeyRef: 67 | name: gameon-env 68 | key: GITHUB_APP_ID 69 | - name: GITHUB_APP_SECRET 70 | valueFrom: 71 | configMapKeyRef: 72 | name: gameon-env 73 | key: GITHUB_APP_SECRET 74 | - name: TWITTER_CONSUMER_KEY 75 | valueFrom: 76 | configMapKeyRef: 77 | name: gameon-env 78 | key: TWITTER_CONSUMER_KEY 79 | - name: TWITTER_CONSUMER_SECRET 80 | valueFrom: 81 | configMapKeyRef: 82 | name: gameon-env 83 | key: TWITTER_CONSUMER_SECRET 84 | - name: MAP_SERVICE_URL 85 | valueFrom: 86 | configMapKeyRef: 87 | name: gameon-env 88 | key: MAP_SERVICE_URL 89 | - name: PLAYER_SERVICE_URL 90 | valueFrom: 91 | configMapKeyRef: 92 | name: gameon-env 93 | key: PLAYER_SERVICE_URL 94 | - name: COUCHDB_SERVICE_URL 95 | valueFrom: 96 | configMapKeyRef: 97 | name: gameon-env 98 | key: COUCHDB_SERVICE_URL 99 | - name: KAFKA_SERVICE_URL 100 | valueFrom: 101 | configMapKeyRef: 102 | name: gameon-env 103 | key: KAFKA_SERVICE_URL 104 | - name: FRONT_END_PLAYER_URL 105 | valueFrom: 106 | configMapKeyRef: 107 | name: gameon-env 108 | key: FRONT_END_PLAYER_URL 109 | - name: FRONT_END_SUCCESS_CALLBACK 110 | valueFrom: 111 | configMapKeyRef: 112 | name: gameon-env 113 | key: FRONT_END_SUCCESS_CALLBACK 114 | - name: FRONT_END_FAIL_CALLBACK 115 | valueFrom: 116 | configMapKeyRef: 117 | name: gameon-env 118 | key: FRONT_END_FAIL_CALLBACK 119 | - name: FRONT_END_AUTH_URL 120 | valueFrom: 121 | configMapKeyRef: 122 | name: gameon-env 123 | key: FRONT_END_AUTH_URL 124 | - name: GAMEON_MODE 125 | valueFrom: 126 | configMapKeyRef: 127 | name: gameon-env 128 | key: GAMEON_MODE 129 | - name: TARGET_PLATFORM 130 | valueFrom: 131 | configMapKeyRef: 132 | name: gameon-env 133 | key: TARGET_PLATFORM 134 | - name: SYSTEM_ID 135 | valueFrom: 136 | configMapKeyRef: 137 | name: gameon-env 138 | key: SYSTEM_ID 139 | - name: LICENSE 140 | valueFrom: 141 | configMapKeyRef: 142 | name: gameon-env 143 | key: LICENSE 144 | - name: PROXY_DOCKER_HOST 145 | valueFrom: 146 | configMapKeyRef: 147 | name: gameon-env 148 | key: PROXY_DOCKER_HOST 149 | - name: ADMIN_PASSWORD 150 | valueFrom: 151 | configMapKeyRef: 152 | name: gameon-env 153 | key: ADMIN_PASSWORD 154 | - name: WLP_SKIP_MAXPERMSIZE 155 | valueFrom: 156 | configMapKeyRef: 157 | name: gameon-env 158 | key: WLP_SKIP_MAXPERMSIZE 159 | - name: WLP_OUTPUT_DIR 160 | valueFrom: 161 | configMapKeyRef: 162 | name: gameon-env 163 | key: WLP_OUTPUT_DIR 164 | - name: LOG_DIR 165 | valueFrom: 166 | configMapKeyRef: 167 | name: gameon-env 168 | key: LOG_DIR 169 | - name: MAP_KEY 170 | valueFrom: 171 | configMapKeyRef: 172 | name: gameon-env 173 | key: MAP_KEY 174 | - name: COUCHDB_USER 175 | valueFrom: 176 | configMapKeyRef: 177 | name: gameon-env 178 | key: COUCHDB_USER 179 | - name: COUCHDB_PASSWORD 180 | valueFrom: 181 | configMapKeyRef: 182 | name: gameon-env 183 | key: COUCHDB_PASSWORD 184 | - name: A8_REGISTRY_URL 185 | valueFrom: 186 | configMapKeyRef: 187 | name: gameon-env 188 | key: A8_REGISTRY_URL 189 | - name: A8_CONTROLLER_URL 190 | valueFrom: 191 | configMapKeyRef: 192 | name: gameon-env 193 | key: A8_CONTROLLER_URL 194 | - name: A8_CONTROLLER_POLL 195 | valueFrom: 196 | configMapKeyRef: 197 | name: gameon-env 198 | key: A8_CONTROLLER_POLL 199 | - name: A8_CONTROLLER_POLL 200 | valueFrom: 201 | configMapKeyRef: 202 | name: gameon-env 203 | key: A8_CONTROLLER_POLL 204 | ports: 205 | - containerPort: 4201 206 | name: player-1 207 | - containerPort: 9080 208 | name: player-2 209 | - containerPort: 9443 210 | name: player-3 211 | volumeMounts: 212 | - name: keystore 213 | mountPath: /opt/ibm/wlp/usr/servers/defaultServer/resources/security 214 | volumes: 215 | - name: keystore 216 | persistentVolumeClaim: 217 | claimName: keystore-claim 218 | -------------------------------------------------------------------------------- /core/proxy.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: proxy 5 | labels: 6 | app: gameon 7 | spec: 8 | type: NodePort 9 | ports: 10 | - port: 80 11 | protocol: TCP 12 | targetPort: 80 13 | name: proxy-1 14 | nodePort: 30080 15 | - port: 443 16 | protocol: TCP 17 | targetPort: 443 18 | name: proxy-2 19 | nodePort: 30443 20 | - port: 1936 21 | protocol: TCP 22 | targetPort: 1936 23 | name: proxy-3 24 | nodePort: 31936 25 | selector: 26 | app: gameon 27 | tier: proxy 28 | --- 29 | apiVersion: extensions/v1beta1 30 | kind: Deployment 31 | metadata: 32 | name: proxy 33 | labels: 34 | app: gameon 35 | spec: 36 | strategy: 37 | type: Recreate 38 | template: 39 | metadata: 40 | labels: 41 | app: gameon 42 | tier: proxy 43 | spec: 44 | containers: 45 | - image: anthonyamanse/gameon-proxy:0.1 46 | imagePullPolicy: Always 47 | name: proxy 48 | env: 49 | - name: service_map 50 | valueFrom: 51 | configMapKeyRef: 52 | name: gameon-env 53 | key: service_map 54 | - name: service_room 55 | valueFrom: 56 | configMapKeyRef: 57 | name: gameon-env 58 | key: service_room 59 | - name: service_simpleroom 60 | valueFrom: 61 | configMapKeyRef: 62 | name: gameon-env 63 | key: service_simpleroom 64 | - name: GITHUB_APP_ID 65 | valueFrom: 66 | configMapKeyRef: 67 | name: gameon-env 68 | key: GITHUB_APP_ID 69 | - name: GITHUB_APP_SECRET 70 | valueFrom: 71 | configMapKeyRef: 72 | name: gameon-env 73 | key: GITHUB_APP_SECRET 74 | - name: TWITTER_CONSUMER_KEY 75 | valueFrom: 76 | configMapKeyRef: 77 | name: gameon-env 78 | key: TWITTER_CONSUMER_KEY 79 | - name: TWITTER_CONSUMER_SECRET 80 | valueFrom: 81 | configMapKeyRef: 82 | name: gameon-env 83 | key: TWITTER_CONSUMER_SECRET 84 | - name: MAP_SERVICE_URL 85 | valueFrom: 86 | configMapKeyRef: 87 | name: gameon-env 88 | key: MAP_SERVICE_URL 89 | - name: PLAYER_SERVICE_URL 90 | valueFrom: 91 | configMapKeyRef: 92 | name: gameon-env 93 | key: PLAYER_SERVICE_URL 94 | - name: COUCHDB_SERVICE_URL 95 | valueFrom: 96 | configMapKeyRef: 97 | name: gameon-env 98 | key: COUCHDB_SERVICE_URL 99 | - name: KAFKA_SERVICE_URL 100 | valueFrom: 101 | configMapKeyRef: 102 | name: gameon-env 103 | key: KAFKA_SERVICE_URL 104 | - name: FRONT_END_PLAYER_URL 105 | valueFrom: 106 | configMapKeyRef: 107 | name: gameon-env 108 | key: FRONT_END_PLAYER_URL 109 | - name: FRONT_END_SUCCESS_CALLBACK 110 | valueFrom: 111 | configMapKeyRef: 112 | name: gameon-env 113 | key: FRONT_END_SUCCESS_CALLBACK 114 | - name: FRONT_END_FAIL_CALLBACK 115 | valueFrom: 116 | configMapKeyRef: 117 | name: gameon-env 118 | key: FRONT_END_FAIL_CALLBACK 119 | - name: FRONT_END_AUTH_URL 120 | valueFrom: 121 | configMapKeyRef: 122 | name: gameon-env 123 | key: FRONT_END_AUTH_URL 124 | - name: GAMEON_MODE 125 | valueFrom: 126 | configMapKeyRef: 127 | name: gameon-env 128 | key: GAMEON_MODE 129 | - name: TARGET_PLATFORM 130 | valueFrom: 131 | configMapKeyRef: 132 | name: gameon-env 133 | key: TARGET_PLATFORM 134 | - name: SYSTEM_ID 135 | valueFrom: 136 | configMapKeyRef: 137 | name: gameon-env 138 | key: SYSTEM_ID 139 | - name: LICENSE 140 | valueFrom: 141 | configMapKeyRef: 142 | name: gameon-env 143 | key: LICENSE 144 | - name: PROXY_DOCKER_HOST 145 | valueFrom: 146 | configMapKeyRef: 147 | name: gameon-env 148 | key: PROXY_DOCKER_HOST 149 | - name: ADMIN_PASSWORD 150 | valueFrom: 151 | configMapKeyRef: 152 | name: gameon-env 153 | key: ADMIN_PASSWORD 154 | - name: WLP_SKIP_MAXPERMSIZE 155 | valueFrom: 156 | configMapKeyRef: 157 | name: gameon-env 158 | key: WLP_SKIP_MAXPERMSIZE 159 | - name: WLP_OUTPUT_DIR 160 | valueFrom: 161 | configMapKeyRef: 162 | name: gameon-env 163 | key: WLP_OUTPUT_DIR 164 | - name: LOG_DIR 165 | valueFrom: 166 | configMapKeyRef: 167 | name: gameon-env 168 | key: LOG_DIR 169 | - name: MAP_KEY 170 | valueFrom: 171 | configMapKeyRef: 172 | name: gameon-env 173 | key: MAP_KEY 174 | - name: COUCHDB_USER 175 | valueFrom: 176 | configMapKeyRef: 177 | name: gameon-env 178 | key: COUCHDB_USER 179 | - name: COUCHDB_PASSWORD 180 | valueFrom: 181 | configMapKeyRef: 182 | name: gameon-env 183 | key: COUCHDB_PASSWORD 184 | - name: A8_REGISTRY_URL 185 | valueFrom: 186 | configMapKeyRef: 187 | name: gameon-env 188 | key: A8_REGISTRY_URL 189 | - name: A8_CONTROLLER_URL 190 | valueFrom: 191 | configMapKeyRef: 192 | name: gameon-env 193 | key: A8_CONTROLLER_URL 194 | - name: A8_CONTROLLER_POLL 195 | valueFrom: 196 | configMapKeyRef: 197 | name: gameon-env 198 | key: A8_CONTROLLER_POLL 199 | - name: A8_CONTROLLER_POLL 200 | valueFrom: 201 | configMapKeyRef: 202 | name: gameon-env 203 | key: A8_CONTROLLER_POLL 204 | ports: 205 | - containerPort: 80 206 | name: proxy-1 207 | - containerPort: 443 208 | name: proxy-2 209 | - containerPort: 1936 210 | name: proxy-3 211 | volumeMounts: 212 | - name: keystore 213 | mountPath: /keystore 214 | volumes: 215 | - name: keystore 216 | persistentVolumeClaim: 217 | claimName: keystore-claim 218 | -------------------------------------------------------------------------------- /core/room.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: room 5 | labels: 6 | app: gameon 7 | spec: 8 | type: NodePort 9 | ports: 10 | - port: 9080 11 | protocol: TCP 12 | targetPort: 9080 13 | name: room-1 14 | nodePort: 30980 15 | - port: 9443 16 | protocol: TCP 17 | targetPort: 9443 18 | name: room-2 19 | nodePort: 30945 20 | selector: 21 | app: gameon 22 | tier: room 23 | --- 24 | apiVersion: extensions/v1beta1 25 | kind: Deployment 26 | metadata: 27 | name: room 28 | labels: 29 | app: gameon 30 | spec: 31 | strategy: 32 | type: Recreate 33 | template: 34 | metadata: 35 | labels: 36 | app: gameon 37 | tier: room 38 | spec: 39 | containers: 40 | - image: anthonyamanse/gameon-room:latest 41 | imagePullPolicy: Always 42 | name: room 43 | env: 44 | - name: service_map 45 | valueFrom: 46 | configMapKeyRef: 47 | name: gameon-env 48 | key: service_map 49 | - name: service_room 50 | valueFrom: 51 | configMapKeyRef: 52 | name: gameon-env 53 | key: service_room 54 | - name: service_simpleroom 55 | valueFrom: 56 | configMapKeyRef: 57 | name: gameon-env 58 | key: service_simpleroom 59 | - name: GITHUB_APP_ID 60 | valueFrom: 61 | configMapKeyRef: 62 | name: gameon-env 63 | key: GITHUB_APP_ID 64 | - name: GITHUB_APP_SECRET 65 | valueFrom: 66 | configMapKeyRef: 67 | name: gameon-env 68 | key: GITHUB_APP_SECRET 69 | - name: TWITTER_CONSUMER_KEY 70 | valueFrom: 71 | configMapKeyRef: 72 | name: gameon-env 73 | key: TWITTER_CONSUMER_KEY 74 | - name: TWITTER_CONSUMER_SECRET 75 | valueFrom: 76 | configMapKeyRef: 77 | name: gameon-env 78 | key: TWITTER_CONSUMER_SECRET 79 | - name: MAP_SERVICE_URL 80 | valueFrom: 81 | configMapKeyRef: 82 | name: gameon-env 83 | key: MAP_SERVICE_URL 84 | - name: PLAYER_SERVICE_URL 85 | valueFrom: 86 | configMapKeyRef: 87 | name: gameon-env 88 | key: PLAYER_SERVICE_URL 89 | - name: COUCHDB_SERVICE_URL 90 | valueFrom: 91 | configMapKeyRef: 92 | name: gameon-env 93 | key: COUCHDB_SERVICE_URL 94 | - name: KAFKA_SERVICE_URL 95 | valueFrom: 96 | configMapKeyRef: 97 | name: gameon-env 98 | key: KAFKA_SERVICE_URL 99 | - name: FRONT_END_PLAYER_URL 100 | valueFrom: 101 | configMapKeyRef: 102 | name: gameon-env 103 | key: FRONT_END_PLAYER_URL 104 | - name: FRONT_END_SUCCESS_CALLBACK 105 | valueFrom: 106 | configMapKeyRef: 107 | name: gameon-env 108 | key: FRONT_END_SUCCESS_CALLBACK 109 | - name: FRONT_END_FAIL_CALLBACK 110 | valueFrom: 111 | configMapKeyRef: 112 | name: gameon-env 113 | key: FRONT_END_FAIL_CALLBACK 114 | - name: FRONT_END_AUTH_URL 115 | valueFrom: 116 | configMapKeyRef: 117 | name: gameon-env 118 | key: FRONT_END_AUTH_URL 119 | - name: GAMEON_MODE 120 | valueFrom: 121 | configMapKeyRef: 122 | name: gameon-env 123 | key: GAMEON_MODE 124 | - name: TARGET_PLATFORM 125 | valueFrom: 126 | configMapKeyRef: 127 | name: gameon-env 128 | key: TARGET_PLATFORM 129 | - name: SYSTEM_ID 130 | valueFrom: 131 | configMapKeyRef: 132 | name: gameon-env 133 | key: SYSTEM_ID 134 | - name: LICENSE 135 | valueFrom: 136 | configMapKeyRef: 137 | name: gameon-env 138 | key: LICENSE 139 | - name: PROXY_DOCKER_HOST 140 | valueFrom: 141 | configMapKeyRef: 142 | name: gameon-env 143 | key: PROXY_DOCKER_HOST 144 | - name: ADMIN_PASSWORD 145 | valueFrom: 146 | configMapKeyRef: 147 | name: gameon-env 148 | key: ADMIN_PASSWORD 149 | - name: WLP_SKIP_MAXPERMSIZE 150 | valueFrom: 151 | configMapKeyRef: 152 | name: gameon-env 153 | key: WLP_SKIP_MAXPERMSIZE 154 | - name: WLP_OUTPUT_DIR 155 | valueFrom: 156 | configMapKeyRef: 157 | name: gameon-env 158 | key: WLP_OUTPUT_DIR 159 | - name: LOG_DIR 160 | valueFrom: 161 | configMapKeyRef: 162 | name: gameon-env 163 | key: LOG_DIR 164 | - name: MAP_KEY 165 | valueFrom: 166 | configMapKeyRef: 167 | name: gameon-env 168 | key: MAP_KEY 169 | - name: COUCHDB_USER 170 | valueFrom: 171 | configMapKeyRef: 172 | name: gameon-env 173 | key: COUCHDB_USER 174 | - name: COUCHDB_PASSWORD 175 | valueFrom: 176 | configMapKeyRef: 177 | name: gameon-env 178 | key: COUCHDB_PASSWORD 179 | - name: A8_REGISTRY_URL 180 | valueFrom: 181 | configMapKeyRef: 182 | name: gameon-env 183 | key: A8_REGISTRY_URL 184 | - name: A8_CONTROLLER_URL 185 | valueFrom: 186 | configMapKeyRef: 187 | name: gameon-env 188 | key: A8_CONTROLLER_URL 189 | - name: A8_CONTROLLER_POLL 190 | valueFrom: 191 | configMapKeyRef: 192 | name: gameon-env 193 | key: A8_CONTROLLER_POLL 194 | - name: A8_CONTROLLER_POLL 195 | valueFrom: 196 | configMapKeyRef: 197 | name: gameon-env 198 | key: A8_CONTROLLER_POLL 199 | ports: 200 | - containerPort: 9080 201 | name: room-1 202 | - containerPort: 9443 203 | name: room-2 204 | volumeMounts: 205 | - name: keystore 206 | mountPath: /opt/ibm/wlp/usr/servers/defaultServer/resources/security 207 | volumes: 208 | - name: keystore 209 | persistentVolumeClaim: 210 | claimName: keystore-claim 211 | -------------------------------------------------------------------------------- /core/webapp.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: webapp 5 | labels: 6 | app: gameon 7 | spec: 8 | type: NodePort 9 | ports: 10 | - port: 8080 11 | protocol: TCP 12 | targetPort: 8080 13 | nodePort: 30880 14 | name: webapp-1 15 | selector: 16 | app: gameon 17 | tier: webapp 18 | --- 19 | apiVersion: extensions/v1beta1 20 | kind: Deployment 21 | metadata: 22 | name: webapp 23 | labels: 24 | app: gameon 25 | spec: 26 | strategy: 27 | type: Recreate 28 | template: 29 | metadata: 30 | labels: 31 | app: gameon 32 | tier: webapp 33 | spec: 34 | containers: 35 | - image: anthonyamanse/gameon-webapp:latest 36 | imagePullPolicy: Always 37 | name: webapp 38 | env: 39 | - name: service_map 40 | valueFrom: 41 | configMapKeyRef: 42 | name: gameon-env 43 | key: service_map 44 | - name: service_room 45 | valueFrom: 46 | configMapKeyRef: 47 | name: gameon-env 48 | key: service_room 49 | - name: service_simpleroom 50 | valueFrom: 51 | configMapKeyRef: 52 | name: gameon-env 53 | key: service_simpleroom 54 | - name: GITHUB_APP_ID 55 | valueFrom: 56 | configMapKeyRef: 57 | name: gameon-env 58 | key: GITHUB_APP_ID 59 | - name: GITHUB_APP_SECRET 60 | valueFrom: 61 | configMapKeyRef: 62 | name: gameon-env 63 | key: GITHUB_APP_SECRET 64 | - name: TWITTER_CONSUMER_KEY 65 | valueFrom: 66 | configMapKeyRef: 67 | name: gameon-env 68 | key: TWITTER_CONSUMER_KEY 69 | - name: TWITTER_CONSUMER_SECRET 70 | valueFrom: 71 | configMapKeyRef: 72 | name: gameon-env 73 | key: TWITTER_CONSUMER_SECRET 74 | - name: MAP_SERVICE_URL 75 | valueFrom: 76 | configMapKeyRef: 77 | name: gameon-env 78 | key: MAP_SERVICE_URL 79 | - name: PLAYER_SERVICE_URL 80 | valueFrom: 81 | configMapKeyRef: 82 | name: gameon-env 83 | key: PLAYER_SERVICE_URL 84 | - name: COUCHDB_SERVICE_URL 85 | valueFrom: 86 | configMapKeyRef: 87 | name: gameon-env 88 | key: COUCHDB_SERVICE_URL 89 | - name: KAFKA_SERVICE_URL 90 | valueFrom: 91 | configMapKeyRef: 92 | name: gameon-env 93 | key: KAFKA_SERVICE_URL 94 | - name: FRONT_END_PLAYER_URL 95 | valueFrom: 96 | configMapKeyRef: 97 | name: gameon-env 98 | key: FRONT_END_PLAYER_URL 99 | - name: FRONT_END_SUCCESS_CALLBACK 100 | valueFrom: 101 | configMapKeyRef: 102 | name: gameon-env 103 | key: FRONT_END_SUCCESS_CALLBACK 104 | - name: FRONT_END_FAIL_CALLBACK 105 | valueFrom: 106 | configMapKeyRef: 107 | name: gameon-env 108 | key: FRONT_END_FAIL_CALLBACK 109 | - name: FRONT_END_AUTH_URL 110 | valueFrom: 111 | configMapKeyRef: 112 | name: gameon-env 113 | key: FRONT_END_AUTH_URL 114 | - name: GAMEON_MODE 115 | valueFrom: 116 | configMapKeyRef: 117 | name: gameon-env 118 | key: GAMEON_MODE 119 | - name: TARGET_PLATFORM 120 | valueFrom: 121 | configMapKeyRef: 122 | name: gameon-env 123 | key: TARGET_PLATFORM 124 | - name: SYSTEM_ID 125 | valueFrom: 126 | configMapKeyRef: 127 | name: gameon-env 128 | key: SYSTEM_ID 129 | - name: LICENSE 130 | valueFrom: 131 | configMapKeyRef: 132 | name: gameon-env 133 | key: LICENSE 134 | - name: PROXY_DOCKER_HOST 135 | valueFrom: 136 | configMapKeyRef: 137 | name: gameon-env 138 | key: PROXY_DOCKER_HOST 139 | - name: ADMIN_PASSWORD 140 | valueFrom: 141 | configMapKeyRef: 142 | name: gameon-env 143 | key: ADMIN_PASSWORD 144 | - name: WLP_SKIP_MAXPERMSIZE 145 | valueFrom: 146 | configMapKeyRef: 147 | name: gameon-env 148 | key: WLP_SKIP_MAXPERMSIZE 149 | - name: WLP_OUTPUT_DIR 150 | valueFrom: 151 | configMapKeyRef: 152 | name: gameon-env 153 | key: WLP_OUTPUT_DIR 154 | - name: LOG_DIR 155 | valueFrom: 156 | configMapKeyRef: 157 | name: gameon-env 158 | key: LOG_DIR 159 | - name: MAP_KEY 160 | valueFrom: 161 | configMapKeyRef: 162 | name: gameon-env 163 | key: MAP_KEY 164 | - name: COUCHDB_USER 165 | valueFrom: 166 | configMapKeyRef: 167 | name: gameon-env 168 | key: COUCHDB_USER 169 | - name: COUCHDB_PASSWORD 170 | valueFrom: 171 | configMapKeyRef: 172 | name: gameon-env 173 | key: COUCHDB_PASSWORD 174 | - name: A8_REGISTRY_URL 175 | valueFrom: 176 | configMapKeyRef: 177 | name: gameon-env 178 | key: A8_REGISTRY_URL 179 | - name: A8_CONTROLLER_URL 180 | valueFrom: 181 | configMapKeyRef: 182 | name: gameon-env 183 | key: A8_CONTROLLER_URL 184 | - name: A8_CONTROLLER_POLL 185 | valueFrom: 186 | configMapKeyRef: 187 | name: gameon-env 188 | key: A8_CONTROLLER_POLL 189 | - name: A8_CONTROLLER_POLL 190 | valueFrom: 191 | configMapKeyRef: 192 | name: gameon-env 193 | key: A8_CONTROLLER_POLL 194 | ports: 195 | - containerPort: 8080 196 | name: webapp-1 197 | - containerPort: 80 198 | name: webapp-2 199 | - containerPort: 443 200 | name: webapp-3 201 | -------------------------------------------------------------------------------- /gameon-configmap.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: gameon-env 5 | namespace: default 6 | data: 7 | service_map: https://map:9443/map/v1/sites 8 | service_room: ws://room:9080/rooms 9 | service_simpleroom: ws://simpleroom:9090/rooms 10 | GITHUB_APP_ID: '' 11 | GITHUB_APP_SECRET: '' 12 | TWITTER_CONSUMER_KEY: '' 13 | TWITTER_CONSUMER_SECRET: '' 14 | MAP_SERVICE_URL: http://127.0.0.1:6379/map/map/v1/sites 15 | PLAYER_SERVICE_URL: http://127.0.0.1:6379/players/players/v1/accounts 16 | COUCHDB_SERVICE_URL: http://couchdb:5984 17 | KAFKA_SERVICE_URL: kafka:9092 18 | FRONT_END_PLAYER_URL: https://PLACEHOLDER_IP:30443/players/v1/accounts 19 | FRONT_END_SUCCESS_CALLBACK: https://PLACEHOLDER_IP:30443/#/login/callback 20 | FRONT_END_FAIL_CALLBACK: https://PLACEHOLDER_IP:30443/#/game 21 | FRONT_END_AUTH_URL: https://PLACEHOLDER_IP:30443/auth 22 | GAMEON_MODE: development 23 | TARGET_PLATFORM: local 24 | SYSTEM_ID: game-on.org 25 | LICENSE: accept 26 | PROXY_DOCKER_HOST: 'PLACEHOLDER_IP' 27 | ADMIN_PASSWORD: admin 28 | WLP_SKIP_MAXPERMSIZE: 'true' 29 | WLP_OUTPUT_DIR: /opt/ibm/wlp/usr/servers/ 30 | LOG_DIR: /opt/ibm/wlp/usr/servers/defaultServer/logs 31 | MAP_KEY: fish 32 | COUCHDB_USER: mapUser 33 | COUCHDB_PASSWORD: myCouchDBSecret 34 | A8_REGISTRY_URL: http://registry:8080 35 | A8_CONTROLLER_URL: http://controller:8080 36 | A8_CONTROLLER_POLL: 5s 37 | A8_CONTROLLER_POLL: 5s 38 | -------------------------------------------------------------------------------- /images/addroom1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/GameOn-Java-Microservices-on-Kubernetes/380350da7c007329ffa63e355a3c24fb6e2fd6e1/images/addroom1.png -------------------------------------------------------------------------------- /images/addroom2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/GameOn-Java-Microservices-on-Kubernetes/380350da7c007329ffa63e355a3c24fb6e2fd6e1/images/addroom2.png -------------------------------------------------------------------------------- /images/addroom3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/GameOn-Java-Microservices-on-Kubernetes/380350da7c007329ffa63e355a3c24fb6e2fd6e1/images/addroom3.png -------------------------------------------------------------------------------- /images/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/GameOn-Java-Microservices-on-Kubernetes/380350da7c007329ffa63e355a3c24fb6e2fd6e1/images/game.png -------------------------------------------------------------------------------- /images/gameon-microservices-code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/GameOn-Java-Microservices-on-Kubernetes/380350da7c007329ffa63e355a3c24fb6e2fd6e1/images/gameon-microservices-code.png -------------------------------------------------------------------------------- /images/gameon-microservices-code2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/GameOn-Java-Microservices-on-Kubernetes/380350da7c007329ffa63e355a3c24fb6e2fd6e1/images/gameon-microservices-code2.png -------------------------------------------------------------------------------- /images/gameon-microservices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/GameOn-Java-Microservices-on-Kubernetes/380350da7c007329ffa63e355a3c24fb6e2fd6e1/images/gameon-microservices.png -------------------------------------------------------------------------------- /images/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/GameOn-Java-Microservices-on-Kubernetes/380350da7c007329ffa63e355a3c24fb6e2fd6e1/images/github.png -------------------------------------------------------------------------------- /images/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/GameOn-Java-Microservices-on-Kubernetes/380350da7c007329ffa63e355a3c24fb6e2fd6e1/images/home.png -------------------------------------------------------------------------------- /images/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/GameOn-Java-Microservices-on-Kubernetes/380350da7c007329ffa63e355a3c24fb6e2fd6e1/images/twitter.png -------------------------------------------------------------------------------- /images/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/GameOn-Java-Microservices-on-Kubernetes/380350da7c007329ffa63e355a3c24fb6e2fd6e1/images/user.png -------------------------------------------------------------------------------- /local-volume.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: PersistentVolume 3 | metadata: 4 | name: local-volume-1 5 | labels: 6 | type: local 7 | spec: 8 | capacity: 9 | storage: 20Gi 10 | accessModes: 11 | - ReadWriteOnce 12 | hostPath: 13 | path: /tmp/data/pv-1 14 | persistentVolumeReclaimPolicy: Recycle 15 | --- 16 | apiVersion: v1 17 | kind: PersistentVolumeClaim 18 | metadata: 19 | name: keystore-claim 20 | annotations: # comment line if you want to use a StorageClass 21 | # or specify which StorageClass 22 | volume.beta.kubernetes.io/storage-class: "" # comment line if you 23 | # want to use a StorageClass or specify which StorageClass 24 | labels: 25 | app: gameon 26 | spec: 27 | accessModes: 28 | - ReadWriteOnce 29 | resources: 30 | requests: 31 | storage: 20Gi 32 | -------------------------------------------------------------------------------- /platform/controller.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: controller 5 | labels: 6 | app: gameon 7 | spec: 8 | type: NodePort 9 | ports: 10 | - port: 8080 11 | protocol: TCP 12 | targetPort: 8080 13 | nodePort: 31200 14 | selector: 15 | app: gameon 16 | tier: controller 17 | --- 18 | apiVersion: extensions/v1beta1 19 | kind: Deployment 20 | metadata: 21 | name: controller 22 | labels: 23 | app: gameon 24 | spec: 25 | strategy: 26 | type: Recreate 27 | template: 28 | metadata: 29 | labels: 30 | app: gameon 31 | tier: controller 32 | spec: 33 | containers: 34 | - image: amalgam8/a8-controller 35 | name: controller 36 | env: 37 | - name: A8_LOG_LEVEL 38 | value: info 39 | - name: A8_DATABASE_TYPE 40 | value: redis 41 | - name: A8_DATABASE_HOST 42 | value: redis://$(REDIS_SERVICE_HOST):$(REDIS_SERVICE_PORT) 43 | ports: 44 | - containerPort: 8080 45 | name: controller 46 | -------------------------------------------------------------------------------- /platform/couchdb.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: couchdb 5 | labels: 6 | app: gameon 7 | spec: 8 | ports: 9 | - port: 5984 10 | protocol: TCP 11 | targetPort: 5984 12 | selector: 13 | app: gameon 14 | tier: couchdb 15 | --- 16 | apiVersion: extensions/v1beta1 17 | kind: Deployment 18 | metadata: 19 | name: couchdb 20 | labels: 21 | app: gameon 22 | spec: 23 | strategy: 24 | type: Recreate 25 | template: 26 | metadata: 27 | labels: 28 | app: gameon 29 | tier: couchdb 30 | spec: 31 | containers: 32 | - image: couchdb:1.6.1 33 | name: couchdb 34 | ports: 35 | - containerPort: 5984 36 | name: couchdb -------------------------------------------------------------------------------- /platform/kafka.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: kafka 5 | labels: 6 | app: gameon 7 | spec: 8 | ports: 9 | - port: 9092 10 | protocol: TCP 11 | targetPort: 9092 12 | selector: 13 | app: gameon 14 | tier: kafka 15 | --- 16 | apiVersion: extensions/v1beta1 17 | kind: Deployment 18 | metadata: 19 | name: kafka 20 | labels: 21 | app: gameon 22 | spec: 23 | strategy: 24 | type: Recreate 25 | template: 26 | metadata: 27 | labels: 28 | app: gameon 29 | tier: kafka 30 | spec: 31 | containers: 32 | - image: spotify/kafka 33 | name: kafka 34 | env: 35 | - name: ADVERTISED_HOST 36 | value: localhost 37 | - name: ADVERTISED_PORT 38 | value: '9092' 39 | - name: AUTO_CREATE_TOPICS 40 | value: "true" 41 | ports: 42 | - containerPort: 9092 43 | name: kafka 44 | -------------------------------------------------------------------------------- /platform/redis.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: redis 5 | labels: 6 | app: gameon 7 | spec: 8 | ports: 9 | - port: 6379 10 | protocol: TCP 11 | targetPort: 6379 12 | selector: 13 | app: gameon 14 | tier: redis 15 | --- 16 | apiVersion: extensions/v1beta1 17 | kind: Deployment 18 | metadata: 19 | name: redis 20 | labels: 21 | app: gameon 22 | spec: 23 | strategy: 24 | type: Recreate 25 | template: 26 | metadata: 27 | labels: 28 | app: gameon 29 | tier: redis 30 | spec: 31 | containers: 32 | - image: redis:alpine 33 | name: redis 34 | ports: 35 | - containerPort: 6379 36 | name: redis -------------------------------------------------------------------------------- /platform/registry.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: registry 5 | labels: 6 | app: gameon 7 | spec: 8 | type: NodePort 9 | ports: 10 | - port: 8080 11 | protocol: TCP 12 | targetPort: 8080 13 | nodePort: 31300 14 | selector: 15 | app: gameon 16 | tier: registry 17 | --- 18 | apiVersion: extensions/v1beta1 19 | kind: Deployment 20 | metadata: 21 | name: registry 22 | labels: 23 | app: gameon 24 | spec: 25 | strategy: 26 | type: Recreate 27 | template: 28 | metadata: 29 | labels: 30 | app: gameon 31 | tier: registry 32 | spec: 33 | containers: 34 | - image: amalgam8/a8-registry 35 | name: registry 36 | env: 37 | - name: A8_STORE 38 | value: redis 39 | - name: A8_STORE_ADDRESS 40 | value: $(REDIS_SERVICE_HOST):$(REDIS_SERVICE_PORT) 41 | ports: 42 | - containerPort: 8080 43 | name: registry 44 | -------------------------------------------------------------------------------- /sample-room/javaroom.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: javaroom 5 | labels: 6 | app: gameon 7 | spec: 8 | ports: 9 | - port: 9080 10 | protocol: TCP 11 | targetPort: 9080 12 | selector: 13 | app: gameon 14 | tier: javaroom 15 | --- 16 | apiVersion: extensions/v1beta1 17 | kind: Deployment 18 | metadata: 19 | name: javaroom 20 | labels: 21 | app: gameon 22 | spec: 23 | strategy: 24 | type: Recreate 25 | template: 26 | metadata: 27 | labels: 28 | app: gameon 29 | tier: javaroom 30 | spec: 31 | containers: 32 | - image: anthonyamanse/sample-room-java:2.0 33 | name: javaroom 34 | ports: 35 | - containerPort: 9080 36 | volumeMounts: 37 | - name: keystore 38 | mountPath: /opt/ibm/wlp/usr/servers/defaultServer/resources/security 39 | volumes: 40 | - name: keystore 41 | persistentVolumeClaim: 42 | claimName: keystore-claim -------------------------------------------------------------------------------- /scripts/README.md: -------------------------------------------------------------------------------- 1 | # Scripts 2 | 3 | ## deploy-to-bluemix 4 | Contains necessary scripts for the toolchain to deploy the app in Bluemix. 5 | Requirements are having a Bluemix account, deployed Cluster in Bluemix container service, and a Github account. 6 | 7 | ## install.sh 8 | The script for Travis. It runs build and checks if the build has passed or failed. 9 | -------------------------------------------------------------------------------- /scripts/deploy-to-bluemix/bx_login.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -z $CF_ORG ]; then 4 | CF_ORG="$BLUEMIX_ORG" 5 | fi 6 | if [ -z $CF_SPACE ]; then 7 | CF_SPACE="$BLUEMIX_SPACE" 8 | fi 9 | 10 | 11 | if ([ -z "$BLUEMIX_USER" ] || [ -z "$BLUEMIX_PASSWORD" ] || [ -z "$BLUEMIX_ACCOUNT" ]) && ([ -z "$API_KEY"]) 12 | then 13 | echo "Define BLUEMIX_USER, BLUEMIX PASSWORD and BLUEMIX_ACCOUNT environment variables or just use the API_KEY environment variable." 14 | exit 1 15 | fi 16 | echo "Deploy pods" 17 | 18 | echo "bx login -a $CF_TARGET_URL" 19 | 20 | if [ -z "$API_KEY"]; then 21 | bx login -a "$CF_TARGET_URL" -u "$BLUEMIX_USER" -p "$BLUEMIX_PASSWORD" -c "$BLUEMIX_ACCOUNT" -o "$CF_ORG" -s "$CF_SPACE" 22 | else 23 | bx login -a "$CF_TARGET_URL" --apikey "$API_KEY" -o "$CF_ORG" -s "$CF_SPACE" 24 | fi 25 | 26 | # Init container clusters 27 | echo "bx cs init" 28 | bx cs init 29 | if [ $? -ne 0 ]; then 30 | echo "Failed to initialize to Bluemix Container Service" 31 | exit 1 32 | fi 33 | -------------------------------------------------------------------------------- /scripts/deploy-to-bluemix/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Creating GameOn App" 4 | 5 | IP_ADDR=$(bx cs workers $CLUSTER_NAME | grep normal | awk '{ print $2 }' | head -1) 6 | if [ -z $IP_ADDR ]; then 7 | echo "$CLUSTER_NAME not created or workers not ready" 8 | echo "Running clusters are: " 9 | bx cs clusters 10 | echo "Running workers of $CLUSTER_NAME" 11 | bx cs workers $CLUSTER_NAME 12 | exit 1 13 | fi 14 | 15 | echo -e "Configuring vars" 16 | exp=$(bx cs cluster-config $CLUSTER_NAME | grep export) 17 | if [ $? -ne 0 ]; then 18 | echo "Cluster $CLUSTER_NAME not created or not ready." 19 | echo "Running workers of $CLUSTER_NAME" 20 | bx cs workers $CLUSTER_NAME 21 | echo "Cluster-config of $CLUSTER_NAME" 22 | bx cs cluster-config $CLUSTER_NAME 23 | exit 1 24 | fi 25 | eval "$exp" 26 | 27 | kubectl delete --ignore-not-found=true -f gameon-configmap.yaml 28 | kubectl delete pvc -l app=gameon 29 | kubectl delete --ignore-not-found=true -f core 30 | kubectl delete --ignore-not-found=true -f platform 31 | kubectl delete --ignore-not-found=true -f setup.yaml 32 | kubectl delete --ignore-not-found=true -f sample-room 33 | kuber=$(kubectl get pods -l app=gameon) 34 | while [ ${#kuber} -ne 0 ] 35 | do 36 | sleep 5s 37 | kubectl get pods -l app=gameon 38 | kuber=$(kubectl get pods -l app=gameon) 39 | done 40 | kubectl delete --ignore-not-found=true -f local-volume.yaml 41 | 42 | 43 | sed -i s#PLACEHOLDER_IP#$IP_ADDR#g gameon-configmap.yaml 44 | 45 | echo -e "Creating config map" 46 | kubectl create -f gameon-configmap.yaml 47 | echo -e "Creating local volumes" 48 | kubectl create -f local-volume.yaml 49 | 50 | sleep 5s 51 | kubectl create -f setup.yaml 52 | echo "Waiting for container to setup" 53 | sleep 15s 54 | 55 | keystore=$(kubectl logs setup | grep Import | awk '{print $4}') 56 | TRIES=0 57 | while [ "$keystore" != "104" ] 58 | do 59 | echo "Setting up keystore values..." 60 | keystore=$(kubectl logs setup | grep Import | awk '{print $4}') 61 | if [ "$keystore" = "104" ] 62 | then 63 | kubectl logs setup 64 | echo "Setup successful" 65 | break 66 | fi 67 | if [ $TRIES -eq 10 ] 68 | then 69 | echo "Failed setting up keystore values." 70 | kubectl logs setup 71 | exit 1 72 | fi 73 | TRIES=$((TRIES+1)) 74 | sleep 5s 75 | done 76 | 77 | echo "Deploying Platform services..." 78 | kubectl create -f platform 79 | 80 | echo "Waiting for pods to setup" 81 | sleep 10s 82 | PODS=$(kubectl get pods | grep Pending) 83 | while [ ${#PODS} -ne 0 ] 84 | do 85 | echo "Some Pods are Pending..." 86 | PODS=$(kubectl get pods | grep Pending) 87 | sleep 5s 88 | done 89 | 90 | PODS=$(kubectl get pods | grep ContainerCreating) 91 | while [ ${#PODS} -ne 0 ] 92 | do 93 | echo "Some Pods are not yet Running..." 94 | PODS=$(kubectl get pods | grep ContainerCreating) 95 | sleep 5s 96 | done 97 | 98 | echo "Pods for the platform services are now Running." 99 | echo "Waiting for the amalgam8 controlplane to finish setup..." 100 | 101 | TRIES=0 102 | while true 103 | do 104 | code=$(curl -sw '%{http_code}' http://$IP_ADDR:31200/health -o /dev/null) 105 | if [ "$code" = "200" ]; then 106 | echo "Controller is up" 107 | break 108 | fi 109 | if [ $TRIES -eq 10 ] 110 | then 111 | echo "Failed setting up controlplane." 112 | kubectl logs $(kubectl get pods | grep controller | awk '{print $1}') 113 | exit 1 114 | fi 115 | TRIES=$((TRIES+1)) 116 | sleep 5s 117 | done 118 | 119 | TRIES=0 120 | while true 121 | do 122 | code=$(curl -sw '%{http_code}' http://$IP_ADDR:31300/uptime -o /dev/null) 123 | if [ "$code" = "200" ]; then 124 | echo "Registry is up" 125 | break 126 | fi 127 | if [ $TRIES -eq 10 ] 128 | then 129 | echo "Failed setting up controlplane." 130 | kubectl logs $(kubectl get pods | grep registry | awk '{print $1}') 131 | exit 1 132 | fi 133 | TRIES=$((TRIES+1)) 134 | sleep 5s 135 | done 136 | 137 | 138 | 139 | kubectl create -f core 140 | 141 | echo "Waiting for pods to setup" 142 | sleep 10s 143 | PODS=$(kubectl get pods | grep Pending) 144 | while [ ${#PODS} -ne 0 ] 145 | do 146 | echo "Some Pods are Pending..." 147 | PODS=$(kubectl get pods | grep Pending) 148 | sleep 5s 149 | done 150 | 151 | PODS=$(kubectl get pods | grep ContainerCreating) 152 | while [ ${#PODS} -ne 0 ] 153 | do 154 | echo "Some Pods are not yet Running..." 155 | PODS=$(kubectl get pods | grep ContainerCreating) 156 | sleep 5s 157 | done 158 | 159 | echo "Pods for the core services are now Running." 160 | echo "Waiting for core services to finish setting up..." 161 | # kubectl logs $(kubectl get pods | grep proxy | awk '{print $1}') | tail -10 162 | 163 | TRIES=0 164 | 165 | while true 166 | do 167 | CORE=$(kubectl logs $(kubectl get pods | grep proxy | awk '{print $1}') | grep UP | awk '{print $8}' | xargs | sed -e s/,//g) 168 | 169 | if [ "$CORE" = "UP UP UP UP UP" ] 170 | then 171 | kubectl logs $(kubectl get pods | grep proxy | awk '{print $1}') | grep UP 172 | echo "You can now access your Gameon App at https://$IP_ADDR:30443" 173 | echo "If you'd like to add social logins, please follow the instructions in the Repository's README" 174 | break 175 | fi 176 | 177 | if [ $TRIES -eq 60 ] 178 | then 179 | echo "Failed to setup core services." 180 | echo "Printing running services detected by proxy:" 181 | kubectl logs $(kubectl get pods | grep proxy | awk '{print $1}') | grep UP | awk '{print $6}' 182 | exit 1 183 | fi 184 | echo "Waiting for core services to finish setting up..." 185 | sleep 10s 186 | done 187 | -------------------------------------------------------------------------------- /scripts/deploy-to-bluemix/install_bx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Download Bluemix CLI" 4 | wget --quiet --output-document=/tmp/Bluemix_CLI_amd64.tar.gz http://public.dhe.ibm.com/cloud/bluemix/cli/bluemix-cli/latest/Bluemix_CLI_amd64.tar.gz 5 | tar -xf /tmp/Bluemix_CLI_amd64.tar.gz --directory=/tmp 6 | 7 | # Create bx alias 8 | echo "#!/bin/sh" >/tmp/Bluemix_CLI/bin/bx 9 | echo "/tmp/Bluemix_CLI/bin/bluemix \"\$@\" " >>/tmp/Bluemix_CLI/bin/bx 10 | chmod +x /tmp/Bluemix_CLI/bin/* 11 | 12 | export PATH="/tmp/Bluemix_CLI/bin:$PATH" 13 | 14 | # Install Armada CS plugin 15 | echo "Install the Bluemix container-service plugin" 16 | bx plugin install container-service -r Bluemix 17 | 18 | echo "Install kubectl" 19 | wget --quiet --output-document=/tmp/Bluemix_CLI/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl 20 | chmod +x /tmp/Bluemix_CLI/bin/kubectl 21 | 22 | if [ -n "$DEBUG" ]; then 23 | bx --version 24 | bx plugin list 25 | fi 26 | -------------------------------------------------------------------------------- /scripts/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | function install_bluemix_cli() { 4 | #statements 5 | echo "Installing Bluemix cli" 6 | curl -L "https://cli.run.pivotal.io/stable?release=linux64-binary&source=github" | tar -zx 7 | sudo mv cf /usr/local/bin 8 | sudo curl -o /usr/share/bash-completion/completions/cf https://raw.githubusercontent.com/cloudfoundry/cli/master/ci/installers/completion/cf 9 | cf --version 10 | curl -L public.dhe.ibm.com/cloud/bluemix/cli/bluemix-cli/Bluemix_CLI_0.5.1_amd64.tar.gz > Bluemix_CLI.tar.gz 11 | tar -xvf Bluemix_CLI.tar.gz 12 | sudo ./Bluemix_CLI/install_bluemix_cli 13 | } 14 | 15 | function bluemix_auth() { 16 | echo "Authenticating with Bluemix" 17 | echo "1" | bx login -a https://api.ng.bluemix.net --apikey $BLUEMIX_AUTH 18 | curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl 19 | bx plugin install container-service -r Bluemix 20 | echo "Installing kubectl" 21 | chmod +x ./kubectl 22 | sudo mv ./kubectl /usr/local/bin/kubectl 23 | } 24 | 25 | function cluster_setup() { 26 | bx cs workers $CLUSTER_NAME 27 | $(bx cs cluster-config $CLUSTER_NAME | grep export) 28 | kubectl delete --ignore-not-found=true -f gameon-configmap.yaml 29 | kubectl delete pvc -l app=gameon 30 | kubectl delete --ignore-not-found=true -f core 31 | kubectl delete --ignore-not-found=true -f platform 32 | kubectl delete --ignore-not-found=true -f setup.yaml 33 | kuber=$(kubectl get pods -l app=gameon) 34 | while [ ${#kuber} -ne 0 ] 35 | do 36 | sleep 5s 37 | kubectl get pods -l app=gameon 38 | kuber=$(kubectl get pods -l app=gameon) 39 | done 40 | kubectl delete --ignore-not-found=true -f local-volume.yaml 41 | } 42 | 43 | function initial_setup() { 44 | IP=$(bx cs workers $CLUSTER_NAME | grep normal | awk '{print $2}' | head -1) 45 | kubectl create -f local-volume.yaml 46 | sleep 5s 47 | sed -i s#PLACEHOLDER_IP#$IP#g gameon-configmap.yaml 48 | kubectl create -f gameon-configmap.yaml 49 | kubectl create -f setup.yaml 50 | echo "Waiting for container to setup" 51 | sleep 45 52 | 53 | keystore=$(kubectl logs setup | grep Import | awk '{print $4}') 54 | TRIES=0 55 | while [ "$keystore" != "104" ] 56 | do 57 | echo "Setting up keystore values..." 58 | keystore=$(kubectl logs setup | grep Import | awk '{print $4}') 59 | if [ "$keystore" = "104" ] 60 | then 61 | echo "Setup successfull" 62 | break 63 | fi 64 | if [ $TRIES -eq 40 ] 65 | then 66 | echo "Failed setting up keystore values." 67 | exit 1 68 | fi 69 | TRIES=$((TRIES+1)) 70 | sleep 5s 71 | done 72 | } 73 | 74 | function create_platform_services() { 75 | kubectl create -f platform 76 | 77 | echo "Waiting for pods to setup" 78 | sleep 10s 79 | PODS=$(kubectl get pods | grep Pending) 80 | while [ ${#PODS} -ne 0 ] 81 | do 82 | echo "Some Pods are Pending..." 83 | PODS=$(kubectl get pods | grep Pending) 84 | sleep 5s 85 | done 86 | 87 | PODS=$(kubectl get pods | grep ContainerCreating) 88 | while [ ${#PODS} -ne 0 ] 89 | do 90 | echo "Some Pods are not yet Running..." 91 | PODS=$(kubectl get pods | grep ContainerCreating) 92 | sleep 5s 93 | done 94 | 95 | echo "Pods for the platform services are now Running." 96 | echo "Waiting for the amalgam8 controlplane to finish setup..." 97 | IP=$(bx cs workers $CLUSTER_NAME | grep normal | awk '{print $2}' | head -1) 98 | TRIES=0 99 | while true 100 | do 101 | code=$(curl -sw '%{http_code}' http://$IP:31200/health -o /dev/null) 102 | if [ "$code" = "200" ]; then 103 | echo "Controller is up" 104 | break 105 | fi 106 | if [ $TRIES -eq 10 ] 107 | then 108 | echo "Failed setting up controlplane." 109 | exit 1 110 | fi 111 | TRIES=$((TRIES+1)) 112 | sleep 5s 113 | done 114 | IP=$(bx cs workers $CLUSTER_NAME | grep normal | awk '{print $2}' | head -1) 115 | TRIES=0 116 | while true 117 | do 118 | code=$(curl -sw '%{http_code}' http://$IP:31300/uptime -o /dev/null) 119 | if [ "$code" = "200" ]; then 120 | echo "Registry is up" 121 | break 122 | fi 123 | if [ $TRIES -eq 10 ] 124 | then 125 | echo "Failed setting up controlplane." 126 | exit 1 127 | fi 128 | TRIES=$((TRIES+1)) 129 | sleep 5s 130 | done 131 | } 132 | 133 | function create_core_services() { 134 | 135 | kubectl create -f core 136 | 137 | echo "Waiting for pods to setup" 138 | sleep 10s 139 | PODS=$(kubectl get pods | grep Pending) 140 | while [ ${#PODS} -ne 0 ] 141 | do 142 | echo "Some Pods are Pending..." 143 | PODS=$(kubectl get pods | grep Pending) 144 | sleep 5s 145 | done 146 | 147 | PODS=$(kubectl get pods | grep ContainerCreating) 148 | while [ ${#PODS} -ne 0 ] 149 | do 150 | echo "Some Pods are not yet Running..." 151 | PODS=$(kubectl get pods | grep ContainerCreating) 152 | sleep 5s 153 | done 154 | 155 | echo "Pods for the core services are now Running." 156 | echo "Waiting for core services to finish setting up..." 157 | # kubectl logs $(kubectl get pods | grep proxy | awk '{print $1}') | tail -10 158 | 159 | TRIES=0 160 | 161 | while true 162 | do 163 | CORE=$(kubectl logs $(kubectl get pods | grep proxy | awk '{print $1}') | grep UP | awk '{print $8}' | xargs | sed -e s/,//g) 164 | 165 | if [ "$CORE" = "UP UP UP UP UP" ] 166 | then 167 | kubectl logs $(kubectl get pods | grep proxy | awk '{print $1}') | grep UP 168 | echo "Everything seems to be working fine!" 169 | echo "Travis build has finished. Cleaning up..." 170 | break 171 | fi 172 | 173 | if [ $TRIES -eq 60 ] 174 | then 175 | echo "Failed to setup core services." 176 | echo "Printing running services detected by proxy:" 177 | kubectl logs $(kubectl get pods | grep proxy | awk '{print $1}') | grep UP | awk '{print $6}' 178 | exit 1 179 | fi 180 | echo "Waiting for core services to finish setting up..." 181 | sleep 10s 182 | done 183 | } 184 | 185 | 186 | 187 | 188 | install_bluemix_cli 189 | bluemix_auth 190 | cluster_setup 191 | initial_setup 192 | create_platform_services 193 | create_core_services 194 | cluster_setup 195 | -------------------------------------------------------------------------------- /setup.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: setup 5 | labels: 6 | app: gameon 7 | tier: setup 8 | spec: 9 | restartPolicy: Never 10 | containers: 11 | - name: setup 12 | image: anthonyamanse/keystore 13 | env: 14 | - name: IP 15 | valueFrom: 16 | configMapKeyRef: 17 | name: gameon-env 18 | key: PROXY_DOCKER_HOST 19 | volumeMounts: 20 | - name: keystore 21 | mountPath: /tmp/keystore/ 22 | volumes: 23 | - name: keystore 24 | persistentVolumeClaim: 25 | claimName: keystore-claim 26 | --------------------------------------------------------------------------------