[
  {
    "path": ".bluemix/deploy.json",
    "content": "{\n    \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n    \"title\": \"Sample Deploy Stage\",\n    \"description\": \"sample toolchain\",\n    \"longDescription\": \"The Delivery Pipeline automates continuous deployment.\",\n    \"type\": \"object\",\n    \"properties\": {\n        \"prod-region\": {\n            \"description\": \"The bluemix region\",\n            \"type\": \"string\"\n        },\n        \"prod-organization\": {\n            \"description\": \"The bluemix org\",\n            \"type\": \"string\"\n        },\n       \"prod-space\": {\n            \"description\": \"The bluemix space\",\n            \"type\": \"string\"\n        },\n       \"prod-app-name\": {\n            \"description\": \"The name of your WordPress app\",\n            \"type\": \"string\"\n        },\n       \"bluemix-user\": {\n            \"description\": \"Your Bluemix user ID\",\n            \"type\": \"string\"\n        },\n       \"bluemix-password\": {\n            \"description\": \"Your Bluemix Password\",\n            \"type\": \"string\"\n        },\n       \"bluemix-api-key\": {\n            \"description\": \"Required for **Federated ID** since Federated ID can't login with Bluemix user and password via Bluemix CLI. You can obtain your API_KEY via https://console.ng.bluemix.net/iam/#/apikeys by clicking **Create API key** (Each API key only can be viewed once).\",\n            \"type\": \"string\"\n        },\n       \"bluemix-cluster-account\": {\n            \"description\": \"The GUID of the Bluemix account where you created the cluster. Retrieve it with [bx iam accounts].\",\n            \"type\": \"string\"\n        },\n       \"bluemix-cluster-name\": {\n            \"description\": \"Your cluster name. Retrieve it with [bx cs clusters].\",\n            \"type\": \"string\"\n        }\n    },\n    \"required\": [\"prod-region\", \"prod-organization\", \"prod-space\", \"bluemix-cluster-name\"],\n    \"anyOf\": [\n        {\n            \"required\": [\"bluemix-user\", \"bluemix-password\", \"bluemix-cluster-account\"]\n        },\n        {\n            \"required\": [\"bluemix-api-key\"]\n        }\n    ],\n    \"form\": [\n       {\n          \"type\": \"validator\",\n          \"url\": \"/devops/setup/bm-helper/helper.html\"\n       },\n        {\n          \"type\": \"text\",\n          \"readonly\": false,\n          \"title\": \"Bluemix User ID\",\n          \"key\": \"bluemix-user\"\n        },{\n          \"type\": \"password\",\n          \"readonly\": false,\n          \"title\": \"Bluemix Password\",\n          \"key\": \"bluemix-password\"\n        },{\n          \"type\": \"password\",\n          \"readonly\": false,\n          \"title\": \"Bluemix API Key (Optional)\",\n          \"key\": \"bluemix-api-key\"\n        },{\n          \"type\": \"password\",\n          \"readonly\": false,\n          \"title\": \"Bluemix Cluster Account ID\",\n          \"key\": \"bluemix-cluster-account\"\n        },{\n          \"type\": \"text\",\n          \"readonly\": false,\n          \"title\": \"Bluemix Cluster Name\",\n          \"key\": \"bluemix-cluster-name\"\n        },\n        {\n            \"type\": \"table\",\n            \"columnCount\": 4,\n            \"widths\": [\"15%\", \"28%\", \"28%\", \"28%\"],\n            \"items\": [\n                {\n                  \"type\": \"label\",\n                  \"title\": \"\"\n                },\n                {\n                  \"type\": \"label\",\n                  \"title\": \"Region\"\n                },\n                {\n                  \"type\": \"label\",\n                  \"title\": \"Organization\"\n                },\n                {\n                  \"type\": \"label\",\n                  \"title\": \"Space\"\n                },\n                {\n                  \"type\": \"label\",\n                  \"title\": \"Production stage\"\n                },\n                {\n                  \"type\": \"select\",\n                  \"key\": \"prod-region\"\n                },\n                {\n                  \"type\": \"select\",\n                  \"key\": \"prod-organization\"\n                },\n                {\n                  \"type\": \"select\",\n                  \"key\": \"prod-space\",\n                  \"readonly\": false\n                }\n            ]\n        }\n    ]\n}\n"
  },
  {
    "path": ".bluemix/pipeline.yml",
    "content": "---\nstages:\n  - name: BUILD\n    inputs:\n      - type: git\n        branch: master\n        service: ${SAMPLE_REPO}\n    triggers:\n      - type: commit\n    jobs:\n      - name: Build\n        type: builder\n        artifact_dir: ''\n        build_type: shell\n        script: |-\n          #!/bin/bash\n          bash -n *.sh\n  - name: DEPLOY\n    inputs:\n      - type: job\n        stage: BUILD\n        job: Build\n        dir_name: null\n    triggers:\n      - type: stage\n    properties:\n      - name: BLUEMIX_USER\n        type: text\n        value: ${BLUEMIX_USER}\n      - name: BLUEMIX_PASSWORD\n        type: secure\n        value: ${BLUEMIX_PASSWORD}\n      - name: BLUEMIX_ACCOUNT\n        type: secure\n        value: ${BLUEMIX_ACCOUNT}\n      - name: CLUSTER_NAME\n        type: text\n        value: ${CLUSTER_NAME}\n      - name: API_KEY\n        type: secure\n        value: ${API_KEY}\n    jobs:\n      - name: Deploy\n        type: deployer\n        target:\n          region_id: ${PROD_REGION_ID}\n          organization: ${PROD_ORG_NAME}\n          space: ${PROD_SPACE_NAME}\n          application: Pipeline\n        script: |\n          #!/bin/bash\n          . ./scripts/deploy-to-bluemix/install_bx.sh\n          ./scripts/deploy-to-bluemix/bx_login.sh\n          ./scripts/deploy-to-bluemix/deploy.sh\nhooks:\n  - enabled: true\n    label: null\n    ssl_enabled: false\n    url: >-\n      https://devops-api-integration.stage1.ng.bluemix.net/v1/messaging/webhook/publish\n"
  },
  {
    "path": ".bluemix/toolchain.yml",
    "content": "---\nname: \"Deploy Kubernetes WordPress sample to Bluemix\"\ndescription: \"Toolchain to deploy Kubernetes WordPress sample to Bluemix\"\nversion: 0.1\nimage: data:image/svg+xml;base64,$file(toolchain.svg,base64)\nicon: data:image/svg+xml;base64,$file(icon.svg,base64)\nrequired:\n  - deploy\n  - sample-repo\n\n# Github repos\nsample-repo:\n  service_id: githubpublic\n  parameters:\n    repo_name: \"{{name}}\"\n    repo_url: https://github.com/IBM/scalable-wordpress-deployment-on-kubernetes\n    type: clone\n    has_issues: false\n\n# Pipelines\nsample-build:\n  service_id: pipeline\n  parameters:\n    name: \"{{name}}\"\n    ui-pipeline: true\n    configuration:\n      content: $file(pipeline.yml)\n      env:\n        SAMPLE_REPO: \"sample-repo\"\n        CF_APP_NAME: \"{{deploy.parameters.prod-app-name}}\"\n        PROD_SPACE_NAME: \"{{deploy.parameters.prod-space}}\"\n        PROD_ORG_NAME: \"{{deploy.parameters.prod-organization}}\"\n        PROD_REGION_ID: \"{{deploy.parameters.prod-region}}\"\n        BLUEMIX_USER: \"{{deploy.parameters.bluemix-user}}\"\n        BLUEMIX_PASSWORD: \"{{deploy.parameters.bluemix-password}}\"\n        API_KEY: \"{{deploy.parameters.bluemix-api-key}}\"\n        BLUEMIX_ACCOUNT: \"{{deploy.parameters.bluemix-cluster-account}}\"\n        CLUSTER_NAME: \"{{deploy.parameters.bluemix-cluster-name}}\"\n      execute: true\n    services: [\"sample-repo\"]\n  hidden: [form, description]\n\n# Deployment\ndeploy:\n  schema:\n    $ref: deploy.json\n  service-category: pipeline\n  parameters:\n    prod-app-name: \"{{sample-repo.parameters.repo_name}}\"\n"
  },
  {
    "path": ".gitignore",
    "content": "# Ignore Vim files\n[._]*.s[a-w][a-z]\n[._]s[a-w][a-z]\nSession.vim\n.netrwhist\n*~\ntags\n\n# Ignore macOS files\n*.DS_Store\n.AppleDouble\n.LSOverride\n._*\n.DocumentRevisions-V100\n.fseventsd\n.Spotlight-V100\n.TemporaryItems\n.Trashes\n.VolumeIcon.icns\n.com.apple.timemachine.donotpresent\n.AppleDB\n.AppleDesktop\nNetwork Trash Folder\nTemporary Items\n.apdisk\n\n# Ignore CI files\ndind-cluster-v1.7.sh*\npassword.txt\n"
  },
  {
    "path": ".travis.yml",
    "content": "---\nlanguage: python\npython: 2.7\ncache: pip\n\nnotifications:\n  slack:\n    rooms:\n      secure: \"qb8F4QsJ6O6ygzZLDnp0ifmG6x8AX0Ne2KvuNOEjLwFeh45uYCMm4Ni1uiqryItyea3vZ7VOWdiR6hbBpVdXo0B3cOLDgQixQa8L89z9gQWocq7M0wo7RI9p3tGfBQ4xfNTPPLp9wzQ077h+8rXzSp6dbkWrUpUX3GEtcTz5B9rHasASGo4+azmvbdUa3CCv2MRVTEaftwBaf/F6CvMnxJdOFwd2tcFGs6sxQnWPbKEKWKqGyBqI347VcMYTmy9xmSQh8hMMxnzvYIyWFj2uTH6vYqBsMfAaI2nwBFKFVE9LzdKicoGdtzvC8hfEOC5gzORhBL3aQk4q7uhT39Cm7KcV+1/c391EuamyUAqtjPOCR3DS2CThaIEjYwi5xRMkWxqv9kZegb9vnd5BAjD6bYprZmuX6hkiaiKWPdiL3oxS8dyQG0h+rpBy1AUsDP4U7frK6QSaRHCtfx9eHncJvRxgX40D3YEGwPmHldGcSn/V6x2NyZFRAACxklzsn1vb//cjBr502w4nn1TeWLSnw3x9MdG3ZtZ8NjmeoXiN/nrQzd24l5PSysLPt/5W3t8GuQtaSzlVBXuYtNzBu9p0S2755KDXYA51SmZq8CV/T+0WPErLMLet/VJece4hThUgXdQHsIuayQzIGIozTFqe2/oOErOWYQ83MdC1vZ0PLxw=\"\n    on_pull_requests: false\n    on_sucess: change\n\nservices:\n  - docker\n\nbefore_install:\n  - sudo apt-get install shellcheck\n  - pip install -U -r test-requirements.txt\n  - git clone https://github.com/IBM/pattern-ci\n\nbefore_script:\n  - \"./pattern-ci/tests/shellcheck-lint.sh\"\n  - \"./pattern-ci/tests/yaml-lint.sh\"\n\njobs:\n  include:\n    - install: ./pattern-ci/scripts/install-minikube.sh\n      script: ./tests/deploy-minikube.sh\n"
  },
  {
    "path": ".yamllint.yml",
    "content": "---\nrules:\n  braces:\n    min-spaces-inside: 0\n    max-spaces-inside: 0\n    min-spaces-inside-empty: 0\n    max-spaces-inside-empty: 0\n  brackets:\n    min-spaces-inside: 0\n    max-spaces-inside: 0\n    min-spaces-inside-empty: 0\n    max-spaces-inside-empty: 0\n  colons:\n    max-spaces-before: 0\n    max-spaces-after: 1\n  commas:\n    max-spaces-before: 0\n    min-spaces-after: 1\n    max-spaces-after: 1\n  comments:\n    require-starting-space: true\n    min-spaces-from-content: 2\n  comments-indentation: enable\n  document-end: disable\n  document-start:\n    present: true\n  empty-lines:\n    max: 2\n    max-start: 0\n    max-end: 0\n  hyphens:\n    max-spaces-after: 1\n  indentation:\n    spaces: consistent\n    indent-sequences: true\n    check-multi-line-strings: false\n  key-duplicates: enable\n  line-length:\n    max: 80\n    allow-non-breakable-words: true\n    allow-non-breakable-inline-mappings: true\n    level: warning\n  new-line-at-end-of-file: enable\n  new-lines:\n    type: unix\n  trailing-spaces: enable\n  truthy: enable\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing\n\nThis is an open source project, and we appreciate your help!\n\nWe use the GitHub issue tracker to discuss new features and non-trivial bugs.\n\nIn addition to the issue tracker, [#journeys on\nSlack](https://dwopen.slack.com) is the best way to get into contact with the\nproject's maintainers.\n\nTo contribute code, documentation, or tests, please submit a pull request to\nthe GitHub repository. Generally, we expect two maintainers to review your pull\nrequest before it is approved for merging. For more details, see the\n[MAINTAINERS](MAINTAINERS.md) page.\n"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "MAINTAINERS.md",
    "content": "# Maintainers Guide\n\nThis guide is intended for maintainers - anybody with commit access to one or\nmore Code Pattern repositories.\n\n## Methodology\n\nThis repository does not have a traditional release management cycle, but\nshould instead be maintained as a useful, working, and polished reference at\nall times. While all work can therefore be focused on the master branch, the\nquality of this branch should never be compromised.\n\nThe remainder of this document details how to merge pull requests to the\nrepositories.\n\n## Merge approval\n\nThe project maintainers use LGTM (Looks Good To Me) in comments on the pull\nrequest to indicate acceptance prior to merging. A change requires LGTMs from\ntwo project maintainers. If the code is written by a maintainer, the change\nonly requires one additional LGTM.\n\n## Reviewing Pull Requests\n\nWe recommend reviewing pull requests directly within GitHub. This allows a\npublic commentary on changes, providing transparency for all users. When\nproviding feedback be civil, courteous, and kind. Disagreement is fine, so long\nas the discourse is carried out politely. If we see a record of uncivil or\nabusive comments, we will revoke your commit privileges and invite you to leave\nthe project.\n\nDuring your review, consider the following points:\n\n### Does the change have positive impact?\n\nSome proposed changes may not represent a positive impact to the project. Ask\nwhether or not the change will make understanding the code easier, or if it\ncould simply be a personal preference on the part of the author (see\n[bikeshedding](https://en.wiktionary.org/wiki/bikeshedding)).\n\nPull requests that do not have a clear positive impact should be closed without\nmerging.\n\n### Do the changes make sense?\n\nIf you do not understand what the changes are or what they accomplish, ask the\nauthor for clarification. Ask the author to add comments and/or clarify test\ncase names to make the intentions clear.\n\nAt times, such clarification will reveal that the author may not be using the\ncode correctly, or is unaware of features that accommodate their needs. If you\nfeel this is the case, work up a code sample that would address the pull\nrequest for them, and feel free to close the pull request once they confirm.\n\n### Does the change introduce a new feature?\n\nFor any given pull request, ask yourself \"is this a new feature?\" If so, does\nthe pull request (or associated issue) contain narrative indicating the need\nfor the feature? If not, ask them to provide that information.\n\nAre new unit tests in place that test all new behaviors introduced? If not, do\nnot merge the feature until they are! Is documentation in place for the new\nfeature? (See the documentation guidelines). If not do not merge the feature\nuntil it is! Is the feature necessary for general use cases? Try and keep the\nscope of any given component narrow. If a proposed feature does not fit that\nscope, recommend to the user that they maintain the feature on their own, and\nclose the request. You may also recommend that they see if the feature gains\ntraction among other users, and suggest they re-submit when they can show such\nsupport.\n"
  },
  {
    "path": "README-jp.md",
    "content": "[![Build Status](https://travis-ci.org/IBM/Scalable-WordPress-deployment-on-Kubernetes.svg?branch=master)](https://travis-ci.org/IBM/Scalable-WordPress-deployment-on-Kubernetes)\n\n*他の言語で表示: [English](README.md) / [한국어](README-ko.md) / [português](README-po.md).*\n\n# スケーラブルな WordPress 実装を Kubernetes クラスター上にデプロイする\n\nこのチュートリアルでは、Kubernetesクラスタの全機能を紹介し、世界で最も人気のあるWebサイトフレームワークを世界で最も人気のあるコンテナ・オーケストレーションプラットフォーム上に展開する方法を紹介します。KubernetesクラスタでWordPressをホストするための完全なロードマップを提供します。各コンポーネントは別々のコンテナまたはコンテナのグループで実行されます。\n\nWordpressは典型的な多層アプリケーションを表し、各コンポーネントはそれぞれのコンテナを持ちます。WordPressコンテナはフロントエンド層となり、MySQLコンテナはWordPressのデータベース/バックエンド層になります。\n\nKubernetesへのデプロイに加えて、フロントのWordPress層をどのように拡張できるか、そしてMySQLをIBM Cloudからのサービスとして仕様してWordPressフロントエンドで使用する方法も説明します。\n\n![kube-wordpress](images/kube-wordpress-code.png)\n\n## Included Components\n- [WordPress (最新版)](https://hub.docker.com/_/wordpress/)\n- [MySQL (5.6)](https://hub.docker.com/_/mysql/)\n- [Kubernetes Clusters](https://cloud.ibm.com/docs/containers/cs_ov.html#cs_ov)\n- [IBM Cloud Compose for MySQL](https://cloud.ibm.com/catalog/services/compose-for-mysql)\n- [IBM Cloud DevOps Toolchain Service](https://cloud.ibm.com/catalog/services/continuous-delivery)\n- [IBM Cloud Kubernetes Service](https://cloud.ibm.com/catalog?taxonomyNavigation=apps&category=containers)\n\n## 前提条件\n\nローカルテスト用の[Minikube](https://kubernetes.io/docs/setup/minikube/)や、[IBM Cloud Kubernetes Service](https://github.com/IBM/container-journey-template)または[IBM Cloud Private](https://github.com/IBM/deploy-ibm-cloud-private/blob/master/README.md) のいずれかでKubernetes Clusterを作成します。このレポジトリのコードは[Kubernetes Cluster from IBM Cloud Container Service](https://cloud.ibm.com/docs/containers/cs_ov.html#cs_ov)上でTravis CIを使用して定期的にテストされています。\n\n## 目的\n\nこのシナリオでは、以下の作業について説明します:\n\n- 永続ディスクを定義するためローカル永続ボリュームを作成\n- 機密データを保護するためのシークレットを作成\n- WordPressフロントエンドのポットを1つ以上作成してデプロイ\n- MySQLデータベースを作成してデプロイします。(コンテナ内、またはバックエンドとしてIBM CloudのMySQLを使用)\n\n## Deploy to IBM Cloud\nWordPressを直接IBM Cloudへデプロイしたい場合は、下の`Deploy to IBM Cloud`ボタンをクリックしてWordPressサンプルをデプロイするためのIBM Cloud DepOps サービスツールチェインとパイプラインを作成します。それ以外の場合は、[手順](##手順)へジャンプします\n\n[![Create Toolchain](https://cloud.ibm.com/devops/setup/deploy/button.png)](https://cloud.ibm.com/devops/getting-started)\n\nツールチェインとパイプラインを完成させるには、 [Toolchain instructions](https://github.com/IBM/container-journey-template/blob/master/Toolchain_Instructions_new.md) の指示に従ってください。\n\n## 手順\n1. [MySQL シークレットの設定](#1-mysql-シークレットの設定)\n2. [ローカル永続ボリュームの作成](#2-ローカル永続ボリュームの作成)\n3. [WordPressとMySQLのサービス/デプロイメントの作成と配布](#3-WordPressとMySQLのサービス/デプロイメントの作成と配布)\n  - 3.1 [コンテナ内でMySQLを使用する](#31-コンテナ内でMySQLを使用する)\n  - 3.2 [バックエンドとしてIBM Cloud MySQLを使用する](#32-バックエンドとしてIBM-Cloud-MySQLを使用する)\n4. [外部のWordPressリンクにアクセスする](#4-外部のWordPressリンクにアクセスする)\n5. [WordPressを使用する](#5-WordPressを使用する)\n\n# 1. MySQL シークレットの設定\n\n> *Quickstart option:* このレポジトリ内で `bash scripts/quickstart.sh`を実行します。\n\n同じディレクトリに`password.txt`という名前の新しいファイルを作成し、希望のMySQLパスワードを`password.txt`の中に入れます。 (ASCII文字を含む任意の文字列).\n\n\n`password.txt`の末尾に改行が無いことを確認する必要があります。改行を削除するには、次のコマンドを使用します。\n```bash\ntr -d '\\n' <password.txt >.strippedpassword.txt && mv .strippedpassword.txt password.txt\n```\n\n# 2. ローカル永続ボリュームの作成\nKubernetesポッドのライフサイクルを超えてデータを保存するには、MySQLおよびWordPressアプリケーションが接続するための永続的なボリュームを作成する必要があります。\n\n#### IBM Cloud Kubernetes Service \"ライト\"クラスタ\n次のコマンドを実行して、ローカル永続ボリュームを手動で作成します\n```bash\nkubectl create -f local-volumes.yaml\n```\n#### IBM Cloud Kubernetes Service \"有料\"クラスタ または Minikube\nMySQLおよびWordPressアプリケーションがデプロイされると、永続ボリュームが動的に作成されます。この手順は不要です\n\n# 3. WordPressとMySQLのサービス/デプロイメントの作成と配布\n\n### 3.1 コンテナ内でMySQLを使用する\n\n> *Note:* IBM Cloud Compose-MySQLをバックエンドとして使用したい場合は、[バックエンドとしてIBM Cloud MySQLを使用する](#32-バックエンドとしてIBM-Cloud-MySQLを使用する)を参照してください\n\n永続ボリュームをクラスタのローカルストレージにインストールします。その後、MySQLとWordPressのためのシークレットとサービスを作成します\n```bash\nkubectl create secret generic mysql-pass --from-file=password.txt\nkubectl create -f mysql-deployment.yaml\nkubectl create -f wordpress-deployment.yaml\n```\n\n\nすべてのポッドが実行されたら、次のコマンドを実行してポッド名を確認します。\n```bash\nkubectl get pods\n```\n\nこれにより、Kubernetesクラスタからのポッドのリストが返されます\n```bash\nNAME                               READY     STATUS    RESTARTS   AGE\nwordpress-3772071710-58mmd         1/1       Running   0          17s\nwordpress-mysql-2569670970-bd07b   1/1       Running   0          1m\n```\n\nそれでは、[外部のWordPressリンクにアクセスする](#-4-外部のWordPressリンクにアクセスする)へ進んでください\n\n### 3.2 バックエンドとしてIBM Cloud MySQLを使用する\n\nIBM CloudでCompose for MySQLをプロビジョニングします https://cloud.ibm.com/catalog/services/compose-for-mysql\n\nサービス認証情報に移動して、認証情報を確認してください。\nMySQLのホスト名、ポート番号、ユーザー、パスワードがあなたの認証情報URIの下にあり、以下のように見えるはずです\n\n![mysql](images/mysql.png)\n\n`wordpress-deployment.yaml`ファイルを編集し、WORDPRESS_DB_HOSTの値をMySQLのホスト名とポート番号に変更し(例： `value: <hostname>:<port>`)、 WORDPRESS_DB_USERの値をMySQLパスワードに変更します\n\n環境変数は次のようになります\n\n```yaml\n    spec:\n      containers:\n      - image: wordpress:4.7.3-apache\n        name: wordpress\n        env:\n        - name: WORDPRESS_DB_HOST\n          value: sl-us-dal-9-portal.7.dblayer.com:22412\n        - name: WORDPRESS_DB_USER\n          value: admin\n        - name: WORDPRESS_DB_PASSWORD\n          value: XMRXTOXTDWOOPXEE\n```\n\n`wordpress-deployment.yaml`を変更したら、次のコマンドを実行してWordPressをデプロイします\n```bash\nkubectl create -f wordpress-deployment.yaml\n```\n\nすべてのポッドが実行されたら、次のコマンドを実行してポッド名を確認します\n```bash\nkubectl get pods\n```\n\nこれにより、Kubernetesクラスタからポッドのリストが返されます\n\n```bash\nNAME                               READY     STATUS    RESTARTS   AGE\nwordpress-3772071710-58mmd         1/1       Running   0          17s\n```\n\n# 4. 外部のWordPressリンクにアクセスする\n\n> 有料クラスタがある場合は、NodePortの代わりにLoadBalancerを使用することができます。\n>\n>`kubectl edit services wordpress`\n>\n> `spec`の下で、 `type: NodePort` を `type: LoadBalancer` に変更してください\n>\n> **Note:** YAMLファイルを編集したあとに、`service \"wordpress\" edited`が表示されていることを確認してください。これはYAMLファイルが入力ミスや接続エラーなしで正常に編集されたことを意味します。\n\nクラスタのIPアドレスを取得するには\n\n```bash\n$ bx cs workers <your_cluster_name>\nOK\nID                                                 Public IP        Private IP     Machine Type   State    Status\nkube-hou02-pa817264f1244245d38c4de72fffd527ca-w1   169.47.220.142   10.10.10.57    free           normal   Ready\n```\n\nNodePort番号を取得するには、次のコマンドを実行する必要があります。\n\n```bash\n$ kubectl get svc wordpress\nNAME        CLUSTER-IP    EXTERNAL-IP   PORT(S)        AGE\nwordpress   10.10.10.57   <nodes>       80:30180/TCP   2m\n```\n\nおめでとうございます。今あなたはあなたのWordPressサイトへアクセスするためのリンク**http://[IP]:[port number]** を使用することができるようになりました。\n\n\n> **Note:** 上記の例では、リンクは次のようになります http://169.47.220.142:30180\n\nKubernetes UIでdeploymentのステータスを確認することができます。`kubectl proxy`を実行し、URL 'http://127.0.0.1:8001/ui' に移動して、WordPressコンテナの準備が整ったことを確認します。\n\n![Kubernetes Status Page](images/kube_ui.png)\n\n> **Note:** ポッドが完全に機能するまで最大5分かかります。\n\n\n\n**(Optional)** クラスタ内にさらにリソースがあり、WordPress Webサイトをスケールアップしたい場合は、次のコマンドを実行して現在のdeploymentsを確認できます。\n\n```bash\n$ kubectl get deployments\nNAME              DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE\nwordpress         1         1         1            1           23h\nwordpress-mysql   1         1         1            1           23h\n```\n\nこれで、次のコマンドを実行してWordPressフロントエンドをスケールアップできます。\n```bash\n$ kubectl scale deployments/wordpress --replicas=2\ndeployment \"wordpress\" scaled\n$ kubectl get deployments\nNAME              DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE\nwordpress         2         2         2            2           23h\nwordpress-mysql   1         1         1            1           23h\n```\nご覧のとおり、WordPressフロントエンドを実行している2つのポッドがあります。\n\n> **Note:** 無料クラスタユーザーの場合、無料利用枠のユーザーには限られたリソースしかないため、スケールアップは最大10個のポッドまでとすることをおすすめします。\n\n# 5. WordPressを使用する\n\nWordPressが起動しました。新しいユーザーとして登録して、WordPressをインストールすることができます。\n![wordpress home Page](images/wordpress.png)\n\nWordPresをインストール後、新しいコメントを投稿することができます。\n\n![wordpress comment Page](images/wordpress_comment.png)\n\n\n# トラブルシューティング\n\n誤って改行付きのパスワードを作成した場合、MySQLサービスを認証することはできません。現在のシークレットを削除するには\n\n```bash\nkubectl delete secret mysql-pass\n```\n\nサービス、deployments、永続ボリューム要求を削除したい場合は、次のコマンドで実行できます\n```bash\nkubectl delete deployment,service,pvc -l app=wordpress\n```\n\n永続ボリュームを削除したい場合は、次のコマンドで実行できます\n```bash\nkubectl delete -f local-volumes.yaml\n```\n\nWordPressの動作に時間がかかる場合、ログを調べることでWordPressのデバックすることができます。\n```bash\nkubectl get pods # WordPressのポッド名を取得する\nkubectl logs [wordpress pod name]\n```\n\n\n# References\n- このWordPressの例は、\nhttps://github.com/kubernetes/kubernetes/tree/master/examples/mysql-wordpress-pd にあるKubernetesのオープンソースの例[mysql-wordpress-pd](https://github.com/kubernetes/kubernetes/tree/master/examples/mysql-wordpress-pd)に基づいています。\n\n\n# ライセンス\nこのコードパターンは、Apache Software License, Version 2の元でライセンスされています。このコードパターン内で呼び出される個別のサードパーティコードオブジェクトは、独自の個別ライセンスに従って、それぞれのプロバイダによってライセンスされます。コントリビュートの対象は[Developer Certificate of Origin, Version 1.1 (DCO)](https://developercertificate.org/) と [Apache Software License, Version 2](https://www.apache.org/licenses/LICENSE-2.0.txt)です。\n\n[Apache Software License (ASL) FAQ](https://www.apache.org/foundation/license-faq.html#WhatDoesItMEAN)\n"
  },
  {
    "path": "README-ko.md",
    "content": "[![Build Status](https://travis-ci.org/IBM/Scalable-WordPress-deployment-on-Kubernetes.svg?branch=master)](https://travis-ci.org/IBM/Scalable-WordPress-deployment-on-Kubernetes)\n\n*다른 언어로 보기: [English](README.md).*\n\n# 쿠버네티스 클러스터에 스케일링 가능한 워드프레스 구축하기\n\n이 과정은 세계에서 가장 널리 이용되고 있는 컨테이너 오케스트레이션 플랫폼인 쿠버네티스의 여러 뛰어난 기능과 세계에서 가장 많이 이용되고 있는 웹사이트 프레임워크인 워드프레스를 쿠버네티스 상에 간단하게 배포하는 방법을 소개합니다. 단계별 가이드를 통해 IBM Bluemix 컨테이너 서비스의 쿠버네티스 클러스터에 워드프레스를 호스팅하는 방법 등을 안내합니다. 각 구성요소는 개별 컨테이너 또는 여러 컨테이너 그룹에서 실행됩니다.\n\n워드프레스는 전형적인 멀티-티어(multi-tier) 앱으로, 각 구성요소마다 자체 컨테이너가 있습니다. 워드프레스 컨테이너는 프론트-엔드 티어가 되고, MySQL 컨테이너는 워드프레스의 데이터베이스/백엔드 티어가 됩니다.\n\n쿠버네티스에서의 배포 외에도, 프론트 워드프레스 티어(front WordPress tier)를 스케일링하는 방법과 워드프레스 프론트 티어가 사용하는 MySQL을 Bluemix에서 DBaaS (Database as a Service)형태로 제공하는 Bluemix Compose for MySQL를 활용하여 사용하는 방법 또한 소개하겠습니다.\n\n![kube-wordpress](images/kube-wordpress-code.png)\n\n## 포함된 구성요소\n- [워드프레스 (최신 버전)](https://hub.docker.com/_/wordpress/)\n- [MySQL (5.6)](https://hub.docker.com/_/mysql/)\n- [쿠버네티스 클러스터(Kubernetes Clusters)](https://console.ng.bluemix.net/docs/containers/cs_ov.html#cs_ov)\n- [Bluemix 컨테이너 서비스(Bluemix Container Service)](https://console.ng.bluemix.net/catalog/?taxonomyNavigation=apps&category=containers)\n- [Bluemix Compose for MySQL](https://console.ng.bluemix.net/catalog/services/compose-for-mysql)\n- [Bluemix DevOps 툴체인 서비스](https://console.ng.bluemix.net/catalog/services/continuous-delivery)\n\n## 전제조건\n\n로컬 테스트 환경에서는 [미니큐브(Minikube)](https://kubernetes.io/docs/getting-started-guides/minikube)를, 클라우드 환경에서는 [IBM Bluemix 컨테이너 서비스(Bluemix Container Service)](https://github.com/IBM/container-journey-template)를 활용하여 쿠버네티스 클러스터를 생성하십시오. 여기 제공되는 코드는  [Bluemix 컨테이너 서비스의 쿠버네티스 클러스터(Kubernetes Cluster from Bluemix Container Service)](https://console.ng.bluemix.net/docs/containers/cs_ov.html#cs_ov) 환경에서 Travis로 정기적인 테스트를 수행합니다.\n\n## 목적\n\n본 시나리오는 아래 작업의 진행을 위한 설명을 제공합니다.\n\n- 로컬 PersistentVolume(PV) 생성을 통한 영구적 디스크의 정의.\n- 비밀번호 생성을 통한 데이터의 보호.\n- 한 개 이상의 pod를 이용한 워드프레스 프론트엔드의 생성 및 배포.\n- MySQL 데이터베이스의 생성 및 배포(컨테이너 내에서의 생성 및 배포, 또는 Bluemix  MySQL을 백엔드로 사용한 생성 및 배포).\n\n## Bluemix에 배포하기\n드프레스를 Bluemix에 직접 배포하려면, 아래의 ‘Deploy to Bluemix’ 버튼을 클릭하여 워드프레스 샘플 배포를 위한 Bluemix DevOps 서비스 툴체인과 파이프라인을 생성합니다. 그렇지 않은 경우,  [단계](##단계) 로 이동합니다.\n\n[![Create Toolchain](https://github.com/IBM/container-journey-template/blob/master/images/button.png)](https://console.ng.bluemix.net/devops/setup/deploy/)\n\n [툴체인 가이드를](https://github.com/IBM/container-journey-template/blob/master/Toolchain_Instructions_new.md) 참고하여 툴체인과 파이프라인을 생성하십시오.\n## 단계\n1. [MySQL 비밀키 설치](#1-mysql-비밀키-설치)\n2. [워드프레스 및 MySQL의 서비스 및 배포 생성](#2-워드프레스-및-mysql의-서비스-및-배포-생성)\n  - 2.1 [컨테이너에서 MySQL 사용하기](#21-컨테이너에서-mysql-사용하기)\n  - 2.2 [Bluemix MySQL 사용하기](#22-bluemix-mysql-사용하기)\n3. [외부 워드프레스 링크 이용하기](#3-외부-워드프레스-링크-이용하기)\n4. [워드프레스 사용하기](#4-워드프레스-사용하기)\n\n# 1. MySQL 비밀키 설치\n\n> *빠른 시작을 위한 옵션:* Git 저장소 내의  `bash scripts/quickstart.sh`를 실행합니다.\n\n동일한 디렉토리에  `password.txt` 라는 이름의 신규 파일을 생성하고, 원하는 MySQL 암호를 `password.txt`에 기록하십시오(ASCII 형식의 문자열 가능).\n\n\n `password.txt` 에 줄바꿈 문자가 있어서는 안됩니다. 다음 명령을 이용하면 줄바꿈 문자를 제거할 수 있습니다.\n\n```bash\ntr -d '\\n' <password.txt >.strippedpassword.txt && mv .strippedpassword.txt password.txt\n```\n\n# 2. 워드프레스와 MySQL의 서비스 생성 및 배포하기\n\n### 2.1 컨테이너에서 MySQL 사용하기\n\n> *참고:* Bluemix Compose-MySql을 백엔드로 이용하려는 경우,  [Bluemix MySQL을 백엔드로 사용하기](#22-using-bluemix-mysql-as-backend)로 이동하십시오.\n\n클러스터의 로컬 스토리지에 PersistentVolume(PV)를 설치하십시오. 그런 다음, MySQL 비밀 번호를 설정하고, MySQL 및 워드프레스의 서비스를 생성하십시오.\n\n```bash\nkubectl create -f local-volumes.yaml\nkubectl create secret generic mysql-pass --from-file=password.txt\nkubectl create -f mysql-deployment.yaml\nkubectl create -f wordpress-deployment.yaml\n```\n\n\nPod가 모두 실행 중일 때, 다음 명령을 실행하여 pod 목록을 확인하십시오.\n\n```bash\nkubectl get pods\n```\n\n다음 명령 이용 시, pod 목록이 쿠버네티스 클러스터로부터 반환됩니다.\n\n```bash\nNAME                               READY     STATUS    RESTARTS   AGE\nwordpress-3772071710-58mmd         1/1       Running   0          17s\nwordpress-mysql-2569670970-bd07b   1/1       Running   0          1m\n```\n\n이제,  [외부 링크 (external link) 이용하기](#3-외부-워드프레스-링크-이용하기)로 이동하십시오.\n\n### 2.2 Bluemix MySQL을 백엔드로 사용하기\n\n https://console.ng.bluemix.net/catalog/services/compose-for-mysql을 통해 Bluemix에 Compose for MySQL을 프로비저닝 하십시오.\n\n서비스 신임정보로 이동하여 사용자 신임정보를 확인하십시오. 아래의 그림과 같이 사용자의 MySQL 호스트네임, 포트, 사용자, 암호 등이 사용자 신임정보 uri 밑에 있습니다.\n\n![mysql](images/mysql.png)\n\n`wordpress-deployment.yaml` 파일을 수정합니다. WORDPRESS_DB_HOST 값을 사용자의 MySQL 호스트네임과 포트(`value: <hostname>:<port>`)로, WORDPRESS_DB_USER 값을 여러분의 MySQL 사용자로,  WORDPRESS_DB_PASSWORD 값을 사용자의 MySQL 암호로 변경하십시오.\n\n환경 변수는 다음과 같습니다.\n\n```yaml\n    spec:\n      containers:\n      - image: wordpress:4.7.3-apache\n        name: wordpress\n        env:\n        - name: WORDPRESS_DB_HOST\n          value: sl-us-dal-9-portal.7.dblayer.com:22412\n        - name: WORDPRESS_DB_USER\n          value: admin\n        - name: WORDPRESS_DB_PASSWORD\n          value: XMRXTOXTDWOOPXEE\n```\n\n`wordpress-deployment.yaml`수정 후에는 다음 명령들을 실행하여 워드프레스를 배포합니다.\n\n```bash\nkubectl create -f local-volumes.yaml\nkubectl create -f wordpress-deployment.yaml\n```\n\n모든 pods가 실행 중일 때, 다음 명령을 실행하여 pod 이름들을 확인하십시오.\n\n```bash\nkubectl get pods\n```\n\n명령 실행을 통해 pod 목록이 쿠버네티스 클러스터로부터 반환됩니다.\n\n```bash\nNAME                               READY     STATUS    RESTARTS   AGE\nwordpress-3772071710-58mmd         1/1       Running   0          17s\n```\n\n# 3. 외부 워드프레스 링크 이용하기\n\n>(유료 계정만 해당됨!!) 유료 계정이 있는 경우, 다음 명령을 실행하여 로드밸런서(LoadBalancer)를 생성할 수 있습니다.\n>\n>`kubectl edit services wordpress`\n>\n>  `spec`아래의 `type: NodePort` 를 `type: LoadBalancer`로 변경하십시오.\n>\n> **참고:** yaml 파일 수정 후에  `service \"wordpress\" edited` 가 나타나야 yaml 파일이 오타나 연결 오류 없이 성공적으로 수정되었다는 뜻입니다.  \n\n다음 명령을 실행하여 클러스터의 IP 주소를 확인할 수 있습니다.\n\n```bash\n$ kubectl get nodes\nNAME             STATUS    AGE\n169.47.220.142   Ready     23h\n```\n\n또한, 다음 명령을 실행하여 NodePort 번호를 확인해야 합니다.\n\n```bash\n$ kubectl get svc wordpress\nNAME        CLUSTER-IP    EXTERNAL-IP   PORT(S)        AGE\nwordpress   10.10.10.57   <nodes>       80:30180/TCP   2m\n```\n\n축하합니다. 지금부터는  **http://[IP]:[port number]** 링크를 이용하여 워드프레스 사이트에 접속할 수 있습니다.\n\n\n> **참고:** 위 예제의 링크는  http://169.47.220.142:30180 입니다.\n\n쿠버네티스 UI에서 deployment를 확인할 수 있습니다.  'kubectl proxy' 를 실행하고 URL 'http://127.0.0.1:8001/ui' 로 이동하여 워드프레스 컨테이너가 언제 준비되는지 확인하십시오.  \n![Kubernetes Status Page](images/kube_ui.png)\n\n> **참고:** pod가 완전한 기능을 하기 전까지 최대 5분이 소요될 수 있습니다.\n\n\n\n**(선택사항)** 클러스터에 리소스가 추가적으로 있는 상황에서 워드프레스 웹사이트를 확장하려면, 다음 명령을 실행하여 현재 배포 현황을 확인할 수 있습니다.\n```bash\n$ kubectl get deployments\nNAME              DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE\nwordpress         1         1         1            1           23h\nwordpress-mysql   1         1         1            1           23h\n```\n\n이제, 다음 명령을 통해 워드프레스 프론트엔드의 스케일 아웃을 할 수 있습니다.\n```bash\n$ kubectl scale deployments/wordpress --replicas=2\ndeployment \"wordpress\" scaled\n$ kubectl get deployments\nNAME              DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE\nwordpress         2         2         2            2           23h\nwordpress-mysql   1         1         1            1           23h\n```\n보이는 것과 같이 워드프레스 프론트엔드을 실행 중인 pods는 2개입니다.\n\n> **참고:** 무료 티어(free tier) 사용자에게는 리소스가 제한적이므로 최대 10개까지만 pods를 확장할 것을 권장합니다.\n\n# 4. 워드프레스 사용하기\n\n워드프레스가 실행되었고, 이제 신규 사용자로 등록 및 워드프레스 설치를 진행할 수 있습니다.\n\n![wordpress home Page](images/wordpress.png)\n\n워드프레스가 설치되면 새로운 코멘트를 포스팅할 수 있습니다.\n\n![wordpress comment Page](images/wordpress_comment.png)\n\n\n# 문제 해결\n\n줄바꿈을 통해 실수로 암호를 생성하여 MySQL 서비스에 권한을 부여할 수 없는 경우, 다음 명령을 사용하여 현재 비밀키를 삭제할 수 있습니다.\n\n```bash\nkubectl delete secret mysql-pass\n```\n\nIf you want to delete your services, deployments, and persistent volume claim, you can run\n```bash\nkubectl delete deployment,service,pvc -l app=wordpress\n```\n\nPersistentVolume (PV)를 삭제하려면, 다음 명령을 실행하십시오.\n```bash\nkubectl delete -f local-volumes.yaml\n```\n\n# 참조\n- •\t이 워드프레스 예제는 [mysql-wordpress-pd](https://github.com/kubernetes/kubernetes/tree/master/examples/mysql-wordpress-pd) 웹사이트의 쿠버네티스의  https://github.com/kubernetes/kubernetes/tree/master/examples/mysql-wordpress-pd 오픈 소스 예제를 기반으로 작성되었습니다.\n\n\n\n# 라이센스\n[Apache 2.0](LICENSE)\n"
  },
  {
    "path": "README-pt.md",
    "content": "﻿[![Build Status](https://travis-ci.org/IBM/Scalable-WordPress-deployment-on-Kubernetes.svg?branch=master)](https://travis-ci.org/IBM/Scalable-WordPress-deployment-on-Kubernetes)\n\n*Ler em outros idiomas: [한국어](README-ko.md).*\n\n# Implementação escalável do WordPress no Cluster Kubernetes\n\nEsta jornada apresenta toda a força dos clusters Kubernetes e mostra como podemos implementar a estrutura de website mais popular do mundo na plataforma de orquestração de contêineres mais popular do mundo. Fornecemos um roteiro completo para hospedar o WordPress em um Cluster Kubernetes. Cada componente é executado em um contêiner ou grupo de contêineres separado.\n\nO WordPress representa um aplicativo típico multicamada; cada componente terá seus próprios contêineres. Os contêineres do WordPress serão a camada de front-end; o contêiner do MySQL será a camada de banco de dados/backend para o WordPress. A\n\nlém da implementação no Kubernetes, mostraremos como é possível ajustar a escala da camada frontal do WordPress e como o MySQL pode ser utilizado como um serviço do Bluemix para uso pelo front-end do WordPress.\n\n![kube-wordpress](images/kube-wordpress-code.png)\n\n## Componentes inclusos\n- [WordPress (mais recente)](https://hub.docker.com/_/wordpress/)\n- [MySQL (5.6)](https://hub.docker.com/_/mysql/)\n- [Clusters Kubernetes](https://console.ng.bluemix.net/docs/containers/cs_ov.html#cs_ov)\n- [Bluemix Container Service](https://console.ng.bluemix.net/catalog/?taxonomyNavigation=apps&amp;category=containers)\n- [Bluemix Compose for MySQL](https://console.ng.bluemix.net/catalog/services/compose-for-mysql)\n- [Bluemix DevOps Toolchain Service](https://console.ng.bluemix.net/catalog/services/continuous-delivery)\n\n## Pré-requisito\n\nCrie um cluster Kubernetes com [Minikube](https://kubernetes.io/docs/getting-started-guides/minikube) para testes locais ou com o [IBM Bluemix Container Service](https://github.com/IBM/container-journey-template) para implementação na cloud. O código é testado regularmente com relação ao [Cluster Kubernetes do Bluemix Container Service](https://console.ng.bluemix.net/docs/containers/cs_ov.html#cs_ov) usando Travis.\n\n## Objetivos\n\nEste cenário fornece instruções para as tarefas a seguir: - Criar volumes persistentes locais para definir discos persistentes. - Criar um segredo para proteger dados sensíveis. - Criar e implementar o front-end do WordPress com um ou mais pods. - Criar e implementar o banco de dados do MySQL (em um contêiner ou usando o Bluemix MySQL como backend).\n\n## Implementar no Bluemix\n\nSe quiser implementar o WordPress diretamente no Bluemix, clique no botão 'Deploy to Bluemix' abaixo para criar uma cadeia de ferramentas de serviço do Bluemix DevOps e um canal para implementação da amostra do WordPress ou avance para [Etapas](##steps)\n\n[![Create Toolchain](https://github.com/IBM/container-journey-template/blob/master/images/button.png)](https://console.ng.bluemix.net/devops/setup/deploy/)\n\nSiga as [instruções da cadeia de ferramentas](https://github.com/IBM/container-journey-template/blob/master/Toolchain_Instructions_new.md) para concluir a cadeia de ferramentas e o canal.\n\n## Etapas\n1. [Configurar segredos do MySQL](#1-setup-mysql-secrets)\n2. [Criar serviços e implementações para WordPress e MySQL](#2-create-services-and-deployments-for-wordpress-and-mysql)\n- 2.1 [Usando o MySQL no contêiner](#21-using-mysql-in-container)\n- 2.2 [Usando o Bluemix MySQL](#22-using-bluemix-mysql-as-backend)\n3. [Acessando o link externo do WordPress](#3-accessing-the-external-wordpress-link)\n4. [Usando o WordPress](#4-using-wordpress)\n\n# 1. Configurar segredos do MySQL\n\n> *Opção de iniciação rápida:* Neste repositório, execute `bash scripts/quickstart.sh`.\n\nCrie um novo arquivo chamado `password.txt` no mesmo diretório e coloque a senha desejada do MySQL em `password.txt` (pode ser qualquer cadeia de caractere com caracteres ASCII).\n\nPrecisamos ter certeza de que `password.txt` não contém nenhuma linha nova posterior. Utilize o comando a seguir para remover possíveis linhas novas.\n```bash\ntr -d '\\n' <password.txt >.strippedpassword.txt &amp;&amp; mv .strippedpassword.txt password.txt\n```\n\n# 2. Criar serviços e implementações para WordPress e MySQL\n\n### 2.1 Usando o MySQL no contêiner\n> *Observação:* se quiser usar o Bluemix Compose-MySql como backend, acesse [Usando o Bluemix MySQL como backend](#22-using-bluemix-mysql-as-backend).\n\nInstale o volume persistente no armazenamento local do cluster. Em seguida, crie o segredo e serviços para MySQL e WordPress.\n\n```bash\nkubectl create -f local-volumes.yaml kubectl create secret generic mysql-pass --from-file=password.txt kubectl create -f mysql-deployment.yaml kubectl create -f wordpress-deployment.yaml\n```\n\nQuando todos os pods estiverem em execução, execute os comandos a seguir para verificar os nomes deles.\n\n```bash\nkubectl get pods\n```\nIsso deve gerar uma lista de pods a partir do cluster Kubernetes.\n```bash\nNAME READY STATUS RESTARTS AGE wordpress-3772071710-58mmd 1/1 Running 0 17s wordpress-mysql-2569670970-bd07b 1/1 Running 0 1m\n```\n Agora, prossiga para [Acessando o link externo](#3-accessing-the-external-link).\n\n### 2.2 Usando o Bluemix MySQL como backend\n\nProvision Compose for MySQL no Bluemix por meio de https://console.ng.bluemix.net/catalog/services/compose-for-mysql\n\n\nAcesse as credenciais de serviço e visualize suas credenciais. O nome do host, porta, usuário e senha do MySQL estão na URI da credencial e devem ter esta aparência:\n\n![mysql](images/mysql.png)\n\nModifique o arquivo `wordpress-deployment.yaml`, altere o valor WORDPRESS_DB_HOST para o nome do host e a porta do MySQL (ou seja, `value: <hostname>:<port>`), o valor WORDPRESS_DB_USER para o usuário do MySQL e o valor WORDPRESS_DB_PASSWORD para a senha do MySQL.\n\nAs variáveis de ambiente devem ter esta aparência:\n\n```yaml\nspec: containers: - image: wordpress:4.7.3-apache name: wordpress env: - name: WORDPRESS_DB_HOST value: sl-us-dal-9-portal.7.dblayer.com:22412 - name: WORDPRESS_DB_USER value: admin - name: WORDPRESS_DB_PASSWORD value: XMRXTOXTDWOOPXEE\n```\nDepois de modificar o `wordpress-deployment.yaml`, execute os comandos a seguir para implementar o WordPress.\n\n```bash\nkubectl create -f local-volumes.yaml kubectl create -f wordpress-deployment.yaml ``` Quando todos os pods estiverem em execução, execute os comandos a seguir para verificar os nomes deles. ```bash kubectl get pods\n```\nIsso deve gerar uma lista de pods a partir do cluster Kubernetes.\n```bash\nNAME READY STATUS RESTARTS AGE wordpress-3772071710-58mmd 1/1 Running 0 17s\n```\n\n\n# 3. Acessando o link externo do WordPress\n\n> Se tiver um cluster pago, será possível usar o LoadBalancer em vez do NodePort executando\n> >`kubectl edit services wordpress`\n\n> > Em `spec`, altere `type: NodePort` para `type: LoadBalancer`\n\n> > **Observação:** confira se `service \"wordpress\" edited` é exibido após a edição do arquivo yaml, porque isso significa que o arquivo yaml foi editado com sucesso, sem erros tipográficos ou de conexão.\n\nPara obter o endereço IP do cluster, utilize\n```bash\n $ bx cs workers <your_cluster_name>\nOK\nID                                                 Public IP        Private IP Machine   Type   State   Status\nkube-hou02-pa817264f1244245d38c4de72fffd527ca-w1   169.47.220.142   10.10.10.57          free   normal   Ready\n```\n Você também precisará executar o comando a seguir para obter o número NodePort.\n ```bash\n $ kubectl get svc wordpress NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE wordpress 10.10.10.57   <nodes>       80:30180/TCP 2m\n ```\n Parabéns. Agora, você pode usar o link **http://[IP]:[número da porta]** para acessar seu site no WordPress.\n > **Observação:** para o exemplo acima, o link seria http://169.47.220.142:30180 É possível verificar o status da implementação na interface com o usuário do Kubernetes.\n\n Execute `kubectl proxy` e acesse a URL 'http://127.0.0.1:8001/ui' para verificar quando o contêiner do WordPress ficará pronto.\n\n ![Kubernetes Status Page](images/kube_ui.png)\n\n >**Observação:** os pods podem levar até cinco minutos para começar a funcionar por completo.\n\n **(Opcional)** Se você tiver mais recursos no cluster e quiser aumentar a capacidade do website do WordPress, poderá executar os comandos a seguir para verificar as implementações atuais.\n ```bash\n $ kubectl get deployments\n NAME        DESIRED   CURRENT   UP-TO-DATE        AVAILABLE   AGE\n wordpress   1 1 1 1   23h       wordpress-mysql   1 1 1 1     23h\n ```\n Agora, é possível usar os comandos a seguir para aumentar a capacidade para o front-end do WordPress.\n ```bash\n $ kubectl scale deployments/wordpress --replicas=2 deployment \"wordpress\" scaled\n $ kubectl get deployments\n NAME        DESIRED   CURRENT   UP-TO-DATE        AVAILABLE   AGE\n wordpress   2 2 2 2   23h       wordpress-mysql   1 1 1 1     23h\n ```\n Como pode ser visto, temos dois pods que estão em execução no front-end do WordPress. > **Observação:** caso você seja um usuário de camada gratuita, recomendamos aumentar a capacidade para apenas 10 pods, uma vez que os usuários de camada gratuita têm recursos limitados.\n\n# 4. Usando o WordPress\nCom o WordPress em execução, é possível se inscrever como novo usuário e instalar o WordPress.\n\n![wordpress home Page](images/wordpress.png)\n\nDepois de instalar o WordPress, você poderá publicar novos comentários.\n\n![wordpress comment Page](images/wordpress_comment.png)\n\n# Resolução de problemas\nCaso tenha criado acidentalmente uma senha com linhas novas e não consiga autorizar o serviço do MySQL, você pode excluir o segredo atual usando\n```bash\nkubectl delete secret mysql-pass\n```\nSe quiser excluir seus serviços, implementações e a solicitação de volume persistente, você poderá executar\n```bash\nkubectl delete deployment,service,pvc -l app=wordpress\n```\nPara excluir seu volume persistente, é possível executar os comandos a seguir\n```bash\nkubectl delete -f local-volumes.yaml\n```\n\n\n# Referências\n- Este exemplo do WordPress baseia-se no exemplo de software livre do Kubernetes [mysql-wordpress-pd](https://github.com/kubernetes/kubernetes/tree/master/examples/mysql-wordpress-pd) em https://github.com/kubernetes/kubernetes/tree/master/examples/mysql-wordpress-pd.\n# Licença\n[Apache 2.0](LICENÇA)\n"
  },
  {
    "path": "README.md",
    "content": "[![Build Status](https://travis-ci.org/IBM/Scalable-WordPress-deployment-on-Kubernetes.svg?branch=master)](https://travis-ci.org/IBM/Scalable-WordPress-deployment-on-Kubernetes)\n\n# Scalable WordPress deployment on Kubernetes Cluster\n\nThis journey showcases the full power of Kubernetes clusters and shows how can we deploy the world's most popular website framework on top of world's most popular container orchestration platform. We provide a full roadmap for hosting WordPress on a Kubernetes Cluster. Each component runs in a separate container or group of containers.\n\nWordPress represents a typical multi-tier app and each component will have its own container(s). The WordPress containers will be the frontend tier and the MySQL container will be the database/backend tier for WordPress.\n\nIn addition to deployment on Kubernetes, we will also show how you can scale the front WordPress tier, as well as how you can use MySQL as a service from IBM Cloud to be used by WordPress frontend.\n\n![kube-wordpress](images/kube-wordpress-code.png)\n\n## Included Components\n- [WordPress (Latest)](https://hub.docker.com/_/wordpress/)\n- [MySQL (5.6)](https://hub.docker.com/_/mysql/)\n- [Kubernetes Clusters](https://cloud.ibm.com/docs/containers/cs_ov.html#cs_ov)\n- [IBM Cloud Compose for MySQL](https://cloud.ibm.com/catalog/services/compose-for-mysql)\n\n## Prerequisite\n\nCreate a Kubernetes cluster with either [Minikube](https://kubernetes.io/docs/setup/minikube/) for local testing, with [IBM Cloud Container Service](https://github.com/IBM/container-journey-template), or [IBM Cloud Private](https://github.com/IBM/deploy-ibm-cloud-private/blob/master/README.md) to deploy in cloud. The code here is regularly tested against [Kubernetes Cluster from IBM Cloud Container Service](https://cloud.ibm.com/docs/containers/cs_ov.html#cs_ov) using Travis.\n\n## Objectives\n\nThis scenario provides instructions for the following tasks:\n\n- Create local persistent volumes to define persistent disks.\n- Create a secret to protect sensitive data.\n- Create and deploy the WordPress frontend with one or more pods.\n- Create and deploy the MySQL database (either in a container or using IBM Cloud MySQL as backend).\n\n## Deply to IBM Cloud\n\nIf you want to deploy the WordPress directly to IBM Cloud, click on `Deploy to IBM Cloud` button below to create an IBM Cloud DevOps service toolchain and pipeline for deploying the WordPress sample, else jump to [steps](##Methods-to-Deploy)\n\n[![Deploy to IBM Cloud](https://cloud.ibm.com/devops/setup/deploy/button.png)](https://cloud.ibm.com/devops/setup/deploy?repository=https://github.com/IBM/Scalable-WordPress-deployment-on-Kubernetes&branch=master)\n\n# Methods to Deploy\n\n- [Using The Kustomization File](#Using-The-Kustomization-File)\n- [Manually deploying each file](#Manually-deploying-each-deployment)\n- [Using Compose for MySQL as Backend](#Using-IBM-Cloud-Compose-for-MySQL-as-backend)\n\n# Using The Kustomization File\n\n`kustomize` lets you customize raw, template-free YAML\nfiles for multiple purposes, leaving the original YAML\nuntouched and usable as is.\n\nCreate a new file called `password.txt` in the same directory and put your desired MySQL password inside `password.txt` (Could be any string with ASCII characters).\n\nHow does our `kustomization.yaml` file looks like:\n\n```yaml\nsecretGenerator: #generates secrets within the cluster\n- name: mysql-pass\n  files:\n  - password.txt\nresources: #runs the .yaml files which are written below\n  - local-volumes.yaml\n  - mysql-deployment.yaml\n  - wordpress-deployment.yaml\n```\n#### To run the kustomization file \n\n```bash\nkubectl apply -k ./\n```\n\n#### Output\n\n```bash\nsecret/mysql-pass-c2f8979ct6 created\nservice/wordpress-mysql created\nservice/wordpress created\ndeployment.apps/wordpress-mysql created\ndeployment.apps/wordpress created\npersistentvolume/local-volume-1 created\npersistentvolume/local-volume-2 created\npersistentvolumeclaim/mysql-pv-claim created\npersistentvolumeclaim/wp-pv-claim created\n```\n![Kubernetes Status Page](images/kube_kust.png)\n\n[To read more about kustomization please click here](https://github.com/kubernetes-sigs/kustomize)\n\nNow please move on to [Accessing the External Link](#Accessing-the-external-wordpress-link).\n\n#### To remove the deployment\n\n```bash\nkubectl delete -k ./\n```\n\n# Manually deploying each deployment\n1. [Setup MySQL Secrets](#1-setup-mysql-secrets)\n2. [Create local persistent volumes](#2-create-local-persistent-volumes)\n3. [Create Services and Deployments for WordPress and MySQL](#3-create-services-and-deployments-for-wordpress-and-mysql)\n4. [Accessing the external WordPress link](#Accessing-the-external-wordpress-link)\n5. [Using WordPress](#5-using-wordpress)\n\n### 1. Setup MySQL Secrets\n\nCreate a new file called `password.txt` in the same directory and put your desired MySQL password inside `password.txt` (Could be any string with ASCII characters).\n\n\nWe need to make sure `password.txt` does not have any trailing newline. Use the following command to remove possible newlines.\n\n```bash\ntr -d '\\n' <password.txt >.strippedpassword.txt && mv .strippedpassword.txt password.txt\n```\n\n### 2. Create Local Persistent Volumes\nTo save your data beyond the lifecycle of a Kubernetes pod, you will want to create persistent volumes for your MySQL and Wordpress applications to attach to.\n\n#### For \"lite\" IBM Cloud Kubernetes Service\nCreate the local persistent volumes manually by running\n```bash\nkubectl create -f local-volumes.yaml\n```\n#### For paid IBM Cloud Kubernetes Service OR Minikube\nPersistent volumes are created dynamically for you when the MySQL and Wordpress applications are deployed. No action is needed.\n\n### 3. Create Services and deployments for WordPress and MySQL\n\n> *Note:* If you want to use IBM Cloud Compose for MySql as your backend, please go to [Using IBM Cloud MySQL as backend](#Using-IBM-Cloud-MySQL-as-backend).\n\nInstall persistent volume on your cluster's local storage. Then, create the secret and services for MySQL and WordPress.\n\n```bash\nkubectl create secret generic mysql-pass --from-file=password.txt\nkubectl create -f mysql-deployment.yaml\nkubectl create -f wordpress-deployment.yaml\n```\n\n\nWhen all your pods are running, run the following commands to check your pod names.\n\n```bash\nkubectl get pods\n```\n\nThis should return a list of pods from the kubernetes cluster.\n\n```bash\nNAME                               READY     STATUS    RESTARTS   AGE\nwordpress-3772071710-58mmd         1/1       Running   0          17s\nwordpress-mysql-2569670970-bd07b   1/1       Running   0          1m\n```\n\nNow please move on to [Accessing the External Link](#Accessing-the-external-wordpress-link).\n\n# Using IBM Cloud Compose for MySQL as backend\n\n### Create Local Persistent Volumes\nTo save your data beyond the lifecycle of a Kubernetes pod, you will want to create persistent volumes for your Wordpress applications to attach to.\n\n#### For \"lite\" IBM Cloud Kubernetes Service\nCreate the local persistent volumes manually by running\n```bash\nkubectl create -f local-volumes-compose.yaml\n```\n#### For paid IBM Cloud Kubernetes Service OR Minikube\nPersistent volumes are created dynamically for you when the MySQL and Wordpress applications are deployed. No action is needed.\n\nProvision Compose for MySQL in IBM Cloud via https://cloud.ibm.com/catalog/services/compose-for-mysql\n\nGo to Service credentials and view your credentials (or add one if you don't see one created already). Your MySQL hostname, port, user, and password are under your credential url and it should look like this\n\n```script\ndb_type\": \"mysql\",\n  \"uri_cli_1\": \"mysql -u <<USERNAME>> -p<<PASSWORD>> --host sl-us-south-1-portal.47.dblayer.com --port 22817 --ssl-mode=REQUIRED\",\n```\n\n**Alternatively** you could also go to the manage tab and under \"Connection Strings\" you will be able to find the username, password, hostname as well as the port as shown below\n\n![mysqlmanage](images/mysql_manage.png)\n\nGo to your `wordpress-deployment-compose.yaml` file, change WORDPRESS_DB_HOST's value to your MySQL hostname and port (i.e. `value: <hostname>:<port>`), WORDPRESS_DB_USER's value to your MySQL user, and WORDPRESS_DB_PASSWORD's value to your MySQL password.\n\nAnd the environment variables should look like this\n\n```yaml\n    spec:\n      containers:\n      - image: wordpress:latest\n        name: wordpress-c\n        env:\n        - name: WORDPRESS_DB_HOST\n          value: <<ENTER YOUR DB HOST>>:<<ENTER DB PORT>>\n        - name: WORDPRESS_DB_USER\n          value: <<ENTER YOUR DB USERNAME>>\n        - name: WORDPRESS_DB_PASSWORD\n          value: <<ENTER YOUR DB PASSWORD FROM COMPOSE>>\n```\n\n\nAfter you modified the `wordpress-deployment-compose.yaml`, run the following commands to deploy WordPress.\n\n```bash\nkubectl create -f wordpress-deployment-compose.yaml\n```\n\nWhen all your pods are running, run the following commands to check your pod names.\n\n```bash\nkubectl get pods\n```\n\nThis should return a list of pods from the kubernetes cluster.\n\n```bash\nNAME                               READY     STATUS    RESTARTS   AGE\nwordpress-3772071710-58mmd         1/1       Running   0          17s\n```\n#### To access the service\n\nYou can obtain your cluster's IP address using\n\n```bash\n$ ibmcloud ks workers --cluster <your_cluster_name>\nOK\nID                                                 Public IP        Private IP     Machine Type   State    Status\nkube-hou02-pa817264f1244245d38c4de72fffd527ca-w1   169.47.220.142   10.10.10.57    free           normal   Ready\n```\n\nYou will also need to run the following command to get your NodePort number.\n\n```bash\n$ kubectl get svc wordpress-c\nNAME          TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE\nwordpress-c   NodePort   172.21.179.176   <none>        80:30126/TCP   21s\n```\n\nCongratulations. Now you can use the link **http://[IP of worker node]:[service port number]** to access your WordPress site.\n\n\n> **Note:** For the above example, the link would be http://169.47.220.142:30126\n\n### To delete your deployment \n\n````bash\nkubectl delete -f wordpress-deployment-compose.yaml\nkubectl delete -f local-volumes-compose.yaml\n````\n# Accessing the external WordPress link\n\n> If you have a paid cluster, you can use LoadBalancer instead of NodePort by running\n>\n>`kubectl edit services wordpress`\n>\n> Under `spec`, change `type: NodePort` to `type: LoadBalancer`\n>\n> **Note:** Make sure you have `service \"wordpress\" edited` shown after editing the yaml file because that means the yaml file is successfully edited without any typo or connection errors.\n\nYou can obtain your cluster's IP address using\n\n```bash\n$ ibmcloud ks workers --cluster <your_cluster_name>\nOK\nID                                                 Public IP        Private IP     Machine Type   State    Status\nkube-hou02-pa817264f1244245d38c4de72fffd527ca-w1   169.47.220.142   10.10.10.57    free           normal   Ready\n```\n\nYou will also need to run the following command to get your NodePort number.\n\n```bash\n$ kubectl get svc wordpress\nNAME        CLUSTER-IP    EXTERNAL-IP   PORT(S)        AGE\nwordpress   10.10.10.57   <nodes>       80:30180/TCP   2m\n```\n\nCongratulations. Now you can use the link **http://[IP of worker node]:[service port number]** to access your WordPress site.\n\n\n> **Note:** For the above example, the link would be http://169.47.220.142:30180\n\nYou can check the status of your deployment on Kubernetes UI. Run `kubectl proxy` and go to URL 'http://127.0.0.1:8001/ui' to check when the WordPress container becomes ready.\n\n![Kubernetes Status Page](images/kube_ui.png)\n\n> **Note:** It can take up to 5 minutes for the pods to be fully functioning.\n\n\n\n**(Optional)** If you have more resources in your cluster, and you want to scale up your WordPress website, you can run the following commands to check your current deployments.\n```bash\n$ kubectl get deployments\nNAME              DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE\nwordpress         1         1         1            1           23h\nwordpress-mysql   1         1         1            1           23h\n```\n# To Scale Your Application\n\nNow, you can run the following commands to scale up for WordPress frontend.\n```bash\n$ kubectl scale deployments/wordpress --replicas=2\ndeployment \"wordpress\" scaled\n```\n\n#### Check your added replica\n```bash\n$ kubectl get deployments\nNAME              DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE\nwordpress         2         2         2            2           23h\nwordpress-mysql   1         1         1            1           23h\n```\nAs you can see, we now have 2 pods that are running the WordPress frontend.\n\n> **Note:** If you are a free tier user, we recommend you only scale up to 10 pods since free tier users have limited resources.\n\n# 5. Using WordPress\n\nNow that WordPress is running you can register as a new user and install WordPress.\n\n![wordpress home Page](images/wordpress.png)\n\nAfter installing WordPress, you can post new comments.\n\n![wordpress comment Page](images/wordpress_comment.png)\n\n\n# Troubleshooting\n\nIf you accidentally created a password with newlines and you can not authorize your MySQL service, you can delete your current secret using\n\n```bash\nkubectl delete secret mysql-pass\n```\n\nIf you want to delete your services, deployments, and persistent volume claim, you can run\n```bash\nkubectl delete deployment,service,pvc -l app=wordpress\n```\n\nIf you want to delete your persistent volume, you can run the following commands\n```bash\nkubectl delete -f local-volumes.yaml\n```\n\nIf WordPress is taking a long time, you can debug it by inspecting the logs\n```bash\nkubectl get pods # Get the name of the wordpress pod\nkubectl logs [wordpress pod name]\n```\n\n\n# References\n- This WordPress example is based on Kubernetes's open source example [mysql-wordpress-pd](https://github.com/kubernetes/kubernetes/tree/master/examples/mysql-wordpress-pd) at https://github.com/kubernetes/kubernetes/tree/master/examples/mysql-wordpress-pd.\n\n\n## License\nThis 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](https://developercertificate.org/) and the [Apache License, Version 2](https://www.apache.org/licenses/LICENSE-2.0.txt).\n\n[Apache License FAQ](https://www.apache.org/foundation/license-faq.html#WhatDoesItMEAN)\n"
  },
  {
    "path": "docs/deploy-with-docker-on-linuxone.md",
    "content": "# Deploy with Docker on LinuxONE\n\nOpen source software has expanded from a low-cost alternative to a platform for enterprise databases, clouds and next-generation apps. These workloads need higher levels of scalability, security and availability from the underlying hardware infrastructure.\n\nLinuxONE was built for open source so you can harness the agility of the open revolution on the industry’s most secure, scalable and high-performing Linux server. In this journey we will show how to run open source Cloud-Native workloads on LinuxONE\n\n## Included Components\n\n- [LinuxONE](https://www-03.ibm.com/systems/linuxone/open-source/index.html)\n- [Docker](https://www.docker.com)\n- [Docker Store](https://sore.docker.com)\n- [WordPress](https://workpress.com)\n- [MariaDB](https://mariadb.org)\n\n## Prerequisites\n\nRegister at [LinuxONE Community Cloud](https://developer.ibm.com/linuxone/) for a trial account.\nWe will be using a Ret Hat base image for this journey, so be sure to chose the\nred 'Request your trial' button on the lower left side of this page:\n![testdrive](../images/linuxone_testdrive.png)\n\n## Steps\n\n[Docker Hub](https://hub.docker.com) makes it rather simple to get started with\ncontainers, as there are quite a few images ready to for your to use.  You can\nbrowse the list of images that are compatable with LinuxONE by doing a search\non the ['s390x'](https://hub.docker.com/search/?isAutomated=0&isOfficial=0&page=1&pullCount=0&q=s390x&starCount=0) tag.\nWe will start off with everyone's favorite demo: an installation of WordPress.\nThese instructions assume a base RHEL 7.2 image.  If you are using Ubuntu,\nplease follow the separate [instructions](docs/ubuntu.md)\n\n### 1. Install docker\n```text\n:~$ yum install docker.io\n```\n\n### 2. Install docker-compose\n\nInstall dependencies\n\n```text\nsudo yum install -y python-setuptools\n```\n\nInstall pip with easy_install\n\n```text\nsudo easy_install pip\n```\n\nUpgrade backports.ssl_match_hostname\n\n```text\nsudo pip install backports.ssl_match_hostname --upgrade\n```\n\nFinally, install docker-compose itself\n```text\nsudo pip install docker-compose\n```\n\n### 3. Run and install WordPress\n\nNow that we have docker-compose installed, we will create a docker-compose.yml\nfile.  This will specify a couple of containers from the Docker Store that\nhave been specifically written for z systems.\n\n```text\nvim docker-compose.yml\n```\n\n```text\nversion: '2'\n\nservices:\n\n  wordpress:\n    image: s390x/wordpress\n    ports:\n      - 8080:80\n    environment:\n      WORDPRESS_DB_PASSWORD: example\n\n  mysql:\n    image: brunswickheads/mariadb-5.5-s390x\n    environment:\n      MYSQL_ROOT_PASSWORD: example\n```\n\nAnd finally, run docker-compose (from the same directory you created the .yml)\n\n```text\nsudo docker-compose up -d\n```\n\nAfter all is installed, you can check the status of your containers\n```text\n:~$ sudo docker-compose ps\n       Name                     Command               State          Ports         \n----------------------------------------------------------------------------------\nlinux1_mysql_1       /docker-entrypoint.sh mysq ...   Up      3306/tcp             \nlinux1_wordpress_1   /entrypoint.sh apache2-for ...   Up      0.0.0.0:8080->80/tcp\n```\nand checkout your new blog by using a webbrowser to access 'http://[Your LinuxONE IP Address]:8080'\n\n![after_deploy](../images/wpinstall-language.png)\n\nYou will see the default setup screen requesting your language.  The following\nscreen will ask you to specify a default username/password for the WordPress\ninstallation, after which you will be up and running!\n"
  },
  {
    "path": "docs/ubuntu.md",
    "content": "### 1. Install docker\n```text\n:~$ apt install docker.io\n```\n\n### 2. Install docker-compose\n\nInstall dependencies\n\n```text\nsudo apt-get update\nsudo apt-get install -y python-pip\npip install --upgrade\n```\n\nThen docker-compose itself\n```text\nsudo pip install docker-compose\n```\n"
  },
  {
    "path": "kustomization.yaml",
    "content": "---\nsecretGenerator:\n  - name: mysql-pass\n    files:\n      - password.txt\nresources:\n  - local-volumes.yaml\n  - mysql-deployment.yaml\n  - wordpress-deployment.yaml\n"
  },
  {
    "path": "local-volumes-compose.yaml",
    "content": "---\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: local-volume-3\n  labels:\n    type: local\nspec:\n  capacity:\n    storage: 20Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: /tmp/data/lv-3\n  persistentVolumeReclaimPolicy: Recycle\n"
  },
  {
    "path": "local-volumes.yaml",
    "content": "---\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: local-volume-1\n  labels:\n    type: local\nspec:\n  capacity:\n    storage: 20Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: /tmp/data/lv-1\n  persistentVolumeReclaimPolicy: Recycle\n---\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: local-volume-2\n  labels:\n    type: local\nspec:\n  capacity:\n    storage: 20Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: /tmp/data/lv-2\n  persistentVolumeReclaimPolicy: Recycle\n"
  },
  {
    "path": "mysql-deployment.yaml",
    "content": "apiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress-mysql\nspec:\n  ports:\n  - port: 3306\n  selector:\n    app: wordpress-mysql\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress-mysql\n  labels:\n    app: wordpress-mysql\nspec:\n  selector:\n    matchLabels:\n      app: wordpress-mysql\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress-mysql\n    spec:\n      containers:\n      - image: mysql:5.6\n        name: mysql\n        env:\n        - name: MYSQL_DATABASE\n          value: wordpress\n        - name: MYSQL_ROOT_PASSWORD\n          valueFrom:\n            secretKeyRef:\n              name: mysql-pass\n              key: password\n        ports:\n        - containerPort: 3306\n          name: mysql\n        volumeMounts:\n        - name: mysql-persistent-storage\n          mountPath: /var/lib/mysql\n      volumes:\n      - name: mysql-persistent-storage\n        persistentVolumeClaim:\n          claimName: mysql-pv-claim\n---\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: mysql-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 20Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/tmp/mysql/data\"\n  persistentVolumeReclaimPolicy: Recycle\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: mysql-pv-claim\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n"
  },
  {
    "path": "scripts/bx_auth.sh",
    "content": "#!/bin/bash -e\n\n# This script is intended to be run by Travis CI. If running elsewhere, invoke\n# it with: TRAVIS_PULL_REQUEST=false [path to script]\n# If no credentials are provided at runtime, bx will use the environment\n# variable BLUEMIX_API_KEY. If no API key is set, it will prompt for\n# credentials.\n\n# shellcheck disable=SC1090\nsource \"$(dirname \"$0\")\"/../scripts/resources.sh\n\nBLUEMIX_ORG=\"Developer Advocacy\"\nBLUEMIX_SPACE=\"dev\"\n\nis_pull_request \"$0\"\n\necho \"Authenticating to Bluemix\"\nbx login -a https://api.ng.bluemix.net\n\necho \"Targeting Bluemix org and space\"\nbx target -o \"$BLUEMIX_ORG\" -s \"$BLUEMIX_SPACE\"\n\necho \"Initializing Bluemix Container Service\"\nbx cs init\n"
  },
  {
    "path": "scripts/install.sh",
    "content": "#!/bin/bash -e\n\n# This script is intended to be run by Travis CI. If running elsewhere, invoke\n# it with: TRAVIS_PULL_REQUEST=false [path to script]\n\n# shellcheck disable=SC1090\nsource \"$(dirname \"$0\")\"/../scripts/resources.sh\n\nis_pull_request \"$0\"\n\necho \"Install Bluemix CLI\"\ncurl -L https://public.dhe.ibm.com/cloud/bluemix/cli/bluemix-cli/latest/IBM_Cloud_CLI_amd64.tar.gz > Bluemix_CLI.tar.gz\ntar -xvf Bluemix_CLI.tar.gz\nsudo ./Bluemix_CLI/install_bluemix_cli\n\necho \"Install kubectl\"\ncurl -LO https://storage.googleapis.com/kubernetes-release/release/\"$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)\"/bin/linux/amd64/kubectl\nchmod 0755 kubectl\nsudo mv kubectl /usr/local/bin\n\necho \"Configuring bx to disable version check\"\nbx config --check-version=false\necho \"Checking bx version\"\nbx --version\necho \"Install the Bluemix container-service plugin\"\nbx plugin install container-service -r Bluemix\n\nif [[ -n \"$DEBUG\" ]]; then\n  bx --version\n  bx plugin list\nfi\n"
  },
  {
    "path": "scripts/quickstart.sh",
    "content": "#!/bin/bash\necho 'password' > password.txt\ntr -d '\\n' <password.txt >.strippedpassword.txt && mv .strippedpassword.txt password.txt\nkubectl apply -k ./"
  },
  {
    "path": "scripts/resources.sh",
    "content": "#!/bin/bash\n\n# This script contains functions used by many of the scripts found in scripts/\n# and tests/.\n\ntest_failed(){\n    echo -e >&2 \"\\033[0;31m$1 test failed!\\033[0m\"\n    exit 1\n}\n\ntest_passed(){\n    echo -e \"\\033[0;32m$1 test passed!\\033[0m\"\n}\n\nis_pull_request(){\n  if [[ \"$TRAVIS_PULL_REQUEST\" != \"false\" ]]; then\n      echo -e \"\\033[0;33mPull Request detected; not running $1!\\033[0m\"\n      exit 0\n  fi\n}\n"
  },
  {
    "path": "test-requirements.txt",
    "content": "yamllint\n"
  },
  {
    "path": "tests/deploy-minikube.sh",
    "content": "#!/bin/bash -e\n\n# shellcheck disable=SC1090\nsource \"$(dirname \"$0\")\"/../pattern-ci/scripts/resources.sh\n\nkubectl_deploy() {\n    echo \"Running scripts/quickstart.sh\"\n    \"$(dirname \"$0\")\"/../scripts/quickstart.sh\n\n    echo \"Waiting for pods to be running...\"\n    i=0\n    while [[ $(kubectl get pods -l app=wordpress | grep -c Running) -ne 2 ]]; do\n        if [[ ! \"$i\" -lt 24 ]]; then\n            echo \"Timeout waiting on pods to be ready\"\n            test_failed \"$0\"\n        fi\n        sleep 10\n        echo \"...$i * 10 seconds elapsed...\"\n        ((i++))\n    done\n    kubectl get pods\n    echo \"All pods are running\"\n}\n\nverify_deploy(){\n    echo \"Verifying deployment...\"\n    kubectl get services\n    sleep 60\n    if ! curl -sS \"$(minikube service --url wordpress)\"; then\n        test_failed \"$0\"\n    fi\n}\n\nmain(){\n    if ! kubectl_deploy; then\n        test_failed \"$0\"\n    elif ! verify_deploy; then\n        test_failed \"$0\"\n    else\n        test_passed \"$0\"\n    fi\n}\n\nmain\n"
  },
  {
    "path": "tests/test-kubernetes.sh",
    "content": "#!/bin/bash\n\n# This script is intended to be run by Travis CI. If running elsewhere, invoke\n# it with: TRAVIS_PULL_REQUEST=false [path to script]\n# CLUSTER_NAME must be set prior to running (see environment variables in the\n# Travis CI documentation).\n\n# shellcheck disable=SC1090\nsource \"$(dirname \"$0\")\"/../scripts/resources.sh\n\nkubectl_clean() {\n    echo \"Cleaning cluster\"\n    kubectl delete --ignore-not-found=true svc,pvc,deployment -l app=wordpress\n    kubectl delete --ignore-not-found=true secret mysql-pass\n    kubectl delete --ignore-not-found=true -f local-volumes.yaml\n    kuber=$(kubectl get pods -l app=wordpress)\n    while [ ${#kuber} -ne 0 ]\n    do\n        sleep 5s\n        kubectl get pods -l app=wordpress\n        kuber=$(kubectl get pods -l app=wordpress)\n    done\n}\n\nkubectl_config() {\n    echo \"Configuring kubectl\"\n    #shellcheck disable=SC2091\n    $(bx cs cluster-config \"$CLUSTER_NAME\" | grep export)\n}\n\nkubectl_deploy() {\n    kubectl_clean\n\n    echo \"Modifying yaml files to ignore storage-class\"\n    sed -i '$!N;/PersistentVolumeClaim.*\\n.*metadata/a \\ \\ annotations: \\n\\ \\ \\ \\ volume.beta.kubernetes.io/storage-class: \"\"' mysql-deployment.yaml\n    sed -i '$!N;/PersistentVolumeClaim.*\\n.*metadata/a \\ \\ annotations: \\n\\ \\ \\ \\ volume.beta.kubernetes.io/storage-class: \"\"' wordpress-deployment.yaml\n\n    echo \"Running scripts/quickstart.sh\"\n    \"$(dirname \"$0\")\"/../scripts/quickstart.sh\n\n    echo \"Waiting for pods to be running...\"\n    i=0\n    while [[ $(kubectl get pods -l app=wordpress | grep -c Running) -ne 2 ]]; do\n        if [[ ! \"$i\" -lt 24 ]]; then\n            echo \"Timeout waiting on pods to be ready\"\n            test_failed \"$0\"\n        fi\n        sleep 10\n        echo \"...$i * 10 seconds elapsed...\"\n        ((i++))\n    done\n    echo \"All pods are running\"\n    sleep 30\n}\n\nverify_deploy() {\n    echo \"Verifying deployment was successful\"\n    IPS=$(bx cs workers \"$CLUSTER_NAME\" | awk '{ print $2 }' | grep '[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}')\n    for IP in $IPS; do\n        if ! curl -sS http://\"$IP\":30180/version; then\n            test_failed \"$0\"\n        fi\n    done\n}\n\nmain(){\n    is_pull_request \"$0\"\n\n    if ! kubectl_config; then\n        test_failed \"$0\"\n    elif ! kubectl_deploy; then\n        test_failed \"$0\"\n    elif ! verify_deploy; then\n        test_failed \"$0\"\n    else\n        test_passed \"$0\"\n        kubectl_clean\n    fi\n}\n\nmain\n"
  },
  {
    "path": "wordpress-deployment-compose.yaml",
    "content": "---\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress-c\n  labels:\n    app: wordpress-c\nspec:\n  ports:\n    - port: 80\n  selector:\n    app: wordpress-c\n    tier: frontend-c\n  type: NodePort\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: wpc-pv-claim\n  labels:\n    app: wordpress-c\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1    # for versions before 1.9.0 use apps/v1beta2\nkind: Deployment\nmetadata:\n  name: wordpress-c\n  labels:\n    app: wordpress-c\nspec:\n  selector:\n    matchLabels:\n      app: wordpress-c\n      tier: frontend-c\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress-c\n        tier: frontend-c\n    spec:\n      containers:\n        - image: wordpress:latest\n          name: wordpress-c\n          env:\n            - name: WORDPRESS_DB_HOST\n              value: <<ENTER YOUR DB HOST>>:<<ENTER DB PORT>>\n            - name: WORDPRESS_DB_USER\n              value: <<ENTER YOUR DB USERNAME>>\n            - name: WORDPRESS_DB_PASSWORD\n              value: <<ENTER YOUR DB PASSWORD FROM COMPOSE>>\n          ports:\n            - containerPort: 80\n              name: wordpress-c\n          volumeMounts:\n            - name: wordpress-c-persistent-storage\n              mountPath: /var/www/html\n      volumes:\n        - name: wordpress-c-persistent-storage\n          persistentVolumeClaim:\n            claimName: wpc-pv-claim\n"
  },
  {
    "path": "wordpress-deployment.yaml",
    "content": "---\napiVersion: v1\nkind: Service\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\n    tier: frontend\nspec:\n  ports:\n    - port: 80\n  selector:\n    app: wordpress\n    tier: frontend\n  type: NodePort\n---\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: wp-pv-volume\n  labels:\n    type: local\nspec:\n  storageClassName: manual\n  capacity:\n    storage: 20Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/tmp/wp/data\"\n  persistentVolumeReclaimPolicy: Recycle\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: wp-pv-claim\n  labels:\n    app: wordpress\nspec:\n  storageClassName: manual\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 20Gi\n---\napiVersion: apps/v1   # versions before 1.9.0 use apps/v1beta2\nkind: Deployment\nmetadata:\n  name: wordpress\n  labels:\n    app: wordpress\n    tier: frontend\nspec:\n  selector:\n    matchLabels:\n      app: wordpress\n      tier: frontend\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: wordpress\n        tier: frontend\n    spec:\n      containers:\n        - image: wordpress:5.8.1-php7.4\n          name: wordpress\n          env:\n            - name: WORDPRESS_DB_HOST\n              value: wordpress-mysql\n            - name: WORDPRESS_DB_NAME\n              value: wordpress\n            - name: WORDPRESS_DB_USER\n              value: root\n            - name: WORDPRESS_DB_PASSWORD\n              valueFrom:\n                secretKeyRef:\n                  name: mysql-pass\n                  key: password\n          ports:\n            - containerPort: 80\n              name: wordpress\n          volumeMounts:\n            - name: wordpress-persistent-storage\n              mountPath: /var/www/html\n      volumes:\n        - name: wordpress-persistent-storage\n          persistentVolumeClaim:\n            claimName: wp-pv-claim\n"
  }
]