Quick Start
This document will go over the quickest way to get this platform up and running. Here we will choose the simplest approach for automation and hosting, which are to use CircleCI.com and Github.com. Note, however, that there are alternatives to this approach, as detailed under the Automation and Hosting sections.
Downloading Git¶
Windows¶
You will first need to install Git for Windows.
Mac¶
You will first need to install Git for Mac.
Note for Mac users: Once you click the download file you might be faced with an error saying that the installer "can’t be opened because it is from an unidentified developer". To resolve this issue, right click on the installer and click Open. This will bypass the error.
Signing up and creating forks¶
- If you don't already have a Github.com account, go to Github.com to sign up and then log in.
- In the same browser, go to CircleCI.com and click "Log In With Github". Accept any prompts until you are logged in.
- Go here and click "Fork" in the upper right. Choose your username to fork the project to your account.
- Bookmark the forked repository -- this is your "site repository".
- Go here and click "Fork" in the upper right. Choose your username to fork the project to your account.
- Bookmark the forked repository -- this is your "data repository".
Create SSH keys¶
This part may be painful if you are not accustomed to command-line work. But don't worry - it is pretty fast.
- Open your operating system's Terminal application (use Git BASH, if on Windows).
-
Create the SSH keys by entering the command below, substituting
my-email-address@example.com
with the email address bound to your GitHub account. It might be worth creating a new folder for your keys:ssh-keygen -m pem -t rsa -b 4096 -C "my-email-address@example.com"
- When prompted "Enter file in which to save the key", enter
my-site-key
- When prompted "Enter passphrase", just hit
Enter
. - When prompted "Enter same passphrase again", just hit
Enter
again. - Repeat the previous steps, only use
my-data-key
instead ofmy-site-key
.
- When prompted "Enter file in which to save the key", enter
Confirm that 4 files have been created:
- my-site-key
- my-site-key.pub
- my-data-key
- my-data-key.pub
Add the SSH keys to Github.com¶
- Go to your "site repository" on Github.com that you bookmarked earlier
- Click "Settings" near the top-right.
- Click "Deploy keys" in the left menu.
- Click "Add deploy key"
- For "Title" enter anything, such as
CircleCI key
- For "Key" paste in the contents of
my-site-key.pub
(created earlier)- Tip: A quick way to see the contents of the file is to go back to the terminal and enter:
cat my-site-key.pub
. Drag-select this output to copy it into your clipboard. On MacOS you can usecat my-site-key.pub | pbcopy
to copy the contents ofmy-site-key.pub
straight to your clipboard
- Tip: A quick way to see the contents of the file is to go back to the terminal and enter:
- Check "Allow write access"
- Click "Add key"
- Select and copy the "Fingerprint" that appears (you may need to refresh the page)
- Click "Code" near the top left to get back to the list of files
- In the list of files, drill down to the
.circleci/config.yml
file:.circleci └─config.yml
- On the right, click the Pencil icon ("Edit this file").
- Paste the copied "Fingerprint" over
PASTE_STAGING_FINGERPRINT_HERE
. - At the bottom, click "Commit changes".
- In the list of files, drill down to the
- Repeat the above steps, but this time for the "data repository", and using the contents of
my-data-key.pub
instead.
Add projects to CircleCI.com¶
- Go to the CircleCI dashboard.
- In the left sidebar, click "Add Projects".
- Across from "open-sdg-site-starter" click "Set Up Project".
- Scroll down and click "Start Building".
- At this point, CircleCI will attempt to "build" the project, and will fail. You can ignore this and continue below.
- Click the gear icon in the upper right.
- Click "SSH Permissions" in the left sidebar.
- Click "Add SSH Key".
- Under "Hostname" enter: gh-staging
- Under "Private key", enter the contents of
my-site-key
(the file without the ".pub", created earlier) - Click "Add SSH key".
- Go back to step #3 above and repeat the process with the "open-sdg-data-starter" repository.
Update the deployment scripts¶
- Go to your fork of the data repository (bookmarked earlier).
- In the list of files, drill down to the
scripts/deploy/circleci/deploy_staging.sh
file:scripts └─deploy └─circleci └─deploy_staging.sh
- On the right, click the Pencil icon ("Edit this file").
- Update the file as directed in the comments.
- At the bottom, click "Commit changes".
- In the list of files, drill down to the
- Repeat these steps for the site repository (bookmarked earlier).
Update the site Jekyll configuration¶
- Go to your fork of the site repository (bookmarked earlier).
- In the list of files, click
_config.yml
. - On the right, click the Pencil icon ("Edit this file").
- Update the file as directed in the comments.
- At the bottom, click "Commit changes".
View the site¶
- CircleCI and Github will now build and publish the site. Wait about 5 minutes.
- View site at: https://my-github-org.github.io/open-sdg-site-starter/ (replacing "my-github-org" as needed).
Results¶
At this point, any new updates in the "develop" branches of the repositories will trigger "builds" which automatically deploy to the github.io URLs. These github.io URLs are your staging environments.