From 1e722f6f5a0cdd7a5e388f9705571d6d612543ec Mon Sep 17 00:00:00 2001 From: Alison Joseph Date: Wed, 14 Aug 2019 11:27:38 -0500 Subject: [PATCH 1/2] docs: update readme and add files for deployment --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++ README.md | 34 ++++++- Staticfile | 1 + docs/CNAME | 1 + docs/deployment.md | 41 ++++++++ docs/lets-encrypt.md | 174 ++++++++++++++++++++++++++++++++++ manifest.next.yml | 9 ++ manifest.production.yml | 11 +++ manifest.random.yml | 6 ++ 9 files changed, 476 insertions(+), 2 deletions(-) create mode 100644 LICENSE create mode 100644 Staticfile create mode 100644 docs/CNAME create mode 100644 docs/deployment.md create mode 100644 docs/lets-encrypt.md create mode 100644 manifest.next.yml create mode 100644 manifest.production.yml create mode 100644 manifest.random.yml diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000000..99cfe63a27e --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018 IBM Corp. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 36eb18a3a38..1b01fbb4ef9 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,38 @@ -Built using https://gatsby-theme-carbon.now.sh +# Carbon Design System -## Development +This is the [Carbon Design System website](http://www.carbondesignsystem.com) which is built using the [gatsby-theme-carbon](https://gatsby-theme-carbon.now.sh/) with GatsbyJS. +## 📂 Structure + +``` +src +├── components +├── data +├── gatsby-theme-carbon +├── images +├── pages +├── styles +├── util +``` + +## 👩‍💻 Development + +- 🤝 [Contribution Guidelines](.github/CONTRIBUTING.md) +- 📚 [Content/Markdown Guidelines](https://gatsby-theme-carbon.now.sh/components/markdown) +- 🗺 [Navigation Guidelines](https://gatsby-theme-carbon.now.sh/guides/navigation/sidebar) + +- `yarn install` – install dependencies - `yarn dev` – start the development server - `yarn dev:clean` – use this if you have cache issues - `lint:js` – lint your javascript files - `format` - run prettier + +If you need more detailed information on how to setup your machine to develop locally, please take a look at our [wiki](https://github.com/carbon-design-system/carbon-website-gatsby/wiki). + +## 🚀 Build + +Runing the build commands generates all the files and places them in the `public` folder. + +``` +yarn build +``` diff --git a/Staticfile b/Staticfile new file mode 100644 index 00000000000..3ae036794b3 --- /dev/null +++ b/Staticfile @@ -0,0 +1 @@ +root: public diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 00000000000..667065a34ba --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +www.carbondesignsystem.com \ No newline at end of file diff --git a/docs/deployment.md b/docs/deployment.md new file mode 100644 index 00000000000..4f79006b7f1 --- /dev/null +++ b/docs/deployment.md @@ -0,0 +1,41 @@ +# Deployments + +## Random (for staging or test links) + +```bash +# Build +yarn build + +# Login +ibmcloud login --sso -a https://api.stage1.ng.bluemix.net -o 'carbon@us.ibm.com' -s production + +# Deploy to random url +ibmcloud cf push -f manifest.random.yml +``` + +## Live + +```bash +# Build +yarn build + +# Run build locally +npx serve public + +# Test local production build of website +http://localhost:5000 + +## Login and push +ibmcloud login --sso -a https://api.ng.bluemix.net -o carbon-design-system -s production + +# Make sure you have blue-green-deploy installed as a plugin for cf +ibmcloud cf add-plugin-repo CF-Community https://plugins.cloudfoundry.org +ibmcloud cf install-plugin blue-green-deploy -r CF-Community + +# Deploy the external website +ibmcloud cf blue-green-deploy carbon-website -f manifest.production.yml --delete-old-apps + +# Deploy external website without blue-green +ibmcloud cf push -f manifest.production.yml + +``` diff --git a/docs/lets-encrypt.md b/docs/lets-encrypt.md new file mode 100644 index 00000000000..74542250901 --- /dev/null +++ b/docs/lets-encrypt.md @@ -0,0 +1,174 @@ +# Let's encrypt + +[Let's Encrypt](https://letsencrypt.org/) is a free, automated way to get SSL +certificates for custom domains. Certificates generated with this tool last for +three months. Before they expire, one can renew them automatically using the +same tools that are used to generate a certificate. + +## Generating a certificate + +We can use the DNS challenge that is a part of the manual process outlined +[here](https://certbot.eff.org/docs/using.html#manual) to generate a certificate +for wildcard domains for our `carbondesignsystem.com` TLD. + +To get started, you will need to install the +[`certbot`](https://certbot.eff.org/lets-encrypt/osx-other.html) utillity. If +you're using homebrew, you can install this software by running the following in +your terminal: + +```bash +brew install certbot +``` + +Once the `certbot` utility is available in your terminal, you can run the +following command: + +```bash +certbot certonly \ + --config-dir config \ + --work-dir work \ + --logs-dir logs \ + --manual \ + --preferred-challenges dns \ + -d '*.carbondesignsystem.com' +``` + +The directory that you specify can be any directory, so feel free to change +those paths to whatever works for your machine. For example, you can create a +folder at `~/letsencrypt` and run the following: + +```bash +certbot certonly \ + --manual \ + --preferred-challenges dns \ + -m 'carbon@us.ibm.com' \ + --agree-tos \ + --config-dir ~/letsencrypt/config \ + --work-dir ~/letsencrypt/work \ + --logs-dir ~/letsencrypt/logs \ + -d '*.carbondesignsystem.com' +``` + +After running this command, you should see an interactive prompt that asks a +couple of questions. The most notable of which is: + +```bash +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +NOTE: The IP of this machine will be publicly logged as having requested this +certificate. If you're running certbot in manual mode on a machine that is not +your server, please ensure you're okay with that. + +Are you OK with your IP being logged? +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +(Y)es/(N)o: +``` + +For this question, you will need to select `(Y)es`, otherwise you will be unable +to move forward with this process. + +The last step before you need to update the DNS for `carbondesignsystem.com` +will be the following prompt: + +```bash +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Please deploy a DNS TXT record under the name +_acme-challenge.carbondesignsystem.com with the following value: + +ABCDEFGH-_HIJK_LM_NOPQRSTUVWXYZ + +Before continuing, verify the record is deployed. +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Press Enter to Continue +``` + +At this point, you will need to add the TXT record to our DNS provider. The name +of the sub-domain will be `_acme-challenge`. The type for the record will be +`TXT`. The value will be the value provided in that prompt above. You can verify +that the TXT record has been updated by running the following command in your +terminal: + +```bash +nslookup -q=txt _acme-challenge.carbondesignsystem.com +``` + +After you add this record with your DNS provider, you can press enter to +continue. + +If everything works properly, you should see the following prompt in your +terminal: + +```bash +IMPORTANT NOTES: + - Congratulations! Your certificate and chain have been saved at: + /letsencrypt/config/live/carbondesignsystem.com/fullchain.pem + Your key file has been saved at: + /letsencrypt/config/live/carbondesignsystem.com/privkey.pem + Your cert will expire on 2019-01-07. To obtain a new or tweaked + version of this certificate in the future, simply run certbot + again. To non-interactively renew *all* of your certificates, run + "certbot renew" + - Your account credentials have been saved in your Certbot + configuration directory at /letsencrypt/config. You + should make a secure backup of this folder now. This configuration + directory will also contain certificates and private keys obtained + by Certbot so making regular backups of this folder is ideal. + - If you like Certbot, please consider supporting our work by: + + Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate + Donating to EFF: https://eff.org/donate-le +``` + +If you navigate to the directory inside of `config/live/carbondesignsystem.com`, you should +see a `README.md` file that contains the following descriptions of the generate +files: + +``` +This directory contains your keys and certificates. + +`privkey.pem` : the private key for your certificate. +`fullchain.pem`: the certificate file used in most server software. +`chain.pem` : used for OCSP stapling in Nginx >=1.3.7. +`cert.pem` : will break many server configurations, and should not be used + without reading further documentation (see link below). + +WARNING: DO NOT MOVE THESE FILES! + Certbot expects these files to remain in this location in order + to function properly! + +We recommend not moving these files. For more information, see the Certbot +User Guide at https://certbot.eff.org/docs/using.html#where-are-my-certificates. +``` + +We will use the `fullchain.pem` file in our deployments with IBM Cloud. + +### IBM Cloud + +After generating the certificate files in the steps above, we will need to add +this certificate to IBM Cloud for our custom domain. + +1. Click on "Manage > Account" in the top navigation +2. Click "Cloud Foundry Orgs" +3. Under the "... actions dropdown" click "domains" +4. Under the "..." menu for carbondesignsystem.com click "delete SSL Certificate" +5. Refresh the page if it freezes + +In the table on the page, you should see an entry for `carbondesignsystem.com`. +In one of the columns, there should be a link to upload our certificates that we +generated in the steps above. After clicking that link, there should be a way to +choose a file for the certificate. The description for this option will roughly +be: + +``` +Certificate +Allowed file extensions: cert, cer, der, crt, pem, p7b, p7r, spc +``` + +You should upload the `fullchain.pem` file under this option. In addition, there +should be a field for the Private Key where you will upload the `privkey.pem` +file. Afterwards, continue the process and complete the upload step. + +Once you have uploaded the files, you should see the SSL Certificate status set +to `Pending`. It should resolve in a couple of minutes! Once it shows as secure, +you should be able to visit any Cloud foundry applications with the secured +sub-domain (in this case \*.carbondesignsystem.com) and see the UI report that +the route is now secured with SSL 🎉. diff --git a/manifest.next.yml b/manifest.next.yml new file mode 100644 index 00000000000..a48a3291a6a --- /dev/null +++ b/manifest.next.yml @@ -0,0 +1,9 @@ +--- +applications: +- name: carbon-website-next + memory: 64M + buildpack: https://github.com/cloudfoundry/staticfile-buildpack.git + routes: + - route: next.carbondesignsystem.com + env: + FORCE_HTTPS: true diff --git a/manifest.production.yml b/manifest.production.yml new file mode 100644 index 00000000000..dddfc8557df --- /dev/null +++ b/manifest.production.yml @@ -0,0 +1,11 @@ +--- +applications: +- name: carbon-website + memory: 64M + buildpack: https://github.com/cloudfoundry/staticfile-buildpack.git + routes: + - route: www.carbondesignsystem.com + - route: carbondesignsystem.com + - route: design-system.mybluemix.net + env: + FORCE_HTTPS: true diff --git a/manifest.random.yml b/manifest.random.yml new file mode 100644 index 00000000000..1e161d5f26a --- /dev/null +++ b/manifest.random.yml @@ -0,0 +1,6 @@ +--- +applications: +- name: carbon-website-random + memory: 64M + buildpack: https://github.com/cloudfoundry/staticfile-buildpack.git + random-route: true From 99883916c7aa76982f338b4fbb4632e7f0f06e33 Mon Sep 17 00:00:00 2001 From: Alison Joseph Date: Wed, 14 Aug 2019 11:28:30 -0500 Subject: [PATCH 2/2] chore: typo --- docs/deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/deployment.md b/docs/deployment.md index 4f79006b7f1..82917c9ead3 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -13,7 +13,7 @@ ibmcloud login --sso -a https://api.stage1.ng.bluemix.net -o 'carbon@us.ibm.co ibmcloud cf push -f manifest.random.yml ``` -## Live +## Production ```bash # Build