WS GCP Part3: Setting up WS repo and connection to Github - Gapminder/waffle-server GitHub Wiki
WARNING! This article may change without notice since both GCP and Waffle Server are in active development
This instruction explains how to create SSH keys for Waffle Server and register them in Github. This is needed, because WS has to fetch data repos from Github, both private and public ones. The operations below are to be performed on what we call a deploy VM
— a machine with all the environment needed to manage GCP waffle server.
See previous chapters:
- WS GCP Part1: Getting started with Google Cloud Web GUI
- WS GCP Part2: Prepare a deploy virtual machine (VM)
1. Create a pair of ssh keys following the commands below (more info)
- Generate a key pair (replace the email with your google cloud account email)
ssh-keygen -t rsa -b 4096 -C "[email protected]"
-
Enter a file in which to save the key (id_rsa): [Press enter]
-
You can leave passphrase empty: [Press enter twice]
-
Add the generated result to your local SSH key agent and print the public key:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub
- Log into your github: for real deployments we advise having a dedicated corporate account, like we have gapminder-deploy)
note: for obvious reasons this Github account should be given access to the data repos
-
Go to github.com
-
Open account settings
-
SSH and GPG keys
-
Press [New SSH Key]
-
Write a title, something like "WS deploy from Google Cloud"
-
Paste the SSH key from the Google Cloud window to the SSH key text field
-
Press [Add SSH key]
-
Enter your password if you're prompted
-
See the result:
- Go back to the deploy VM command line
cd //home/$USER
git clone [email protected]:Gapminder/waffle-server.git
-
Confirm adding github.com: type yes, hit enter
-
Switch to a magic branch, pull the latest changes and install dependencies
cd waffle-server
git checkout ws-autodeploy-with-mongo
git pull
npm install
note: if kerberos error occurs during npm install (Error: make failed), run npm install again
cp ~/.ssh/id_rsa //home/$USER/waffle-server/dev
cp ~/.ssh/id_rsa.pub //home/$USER/waffle-server/dev.pub
Next chapter: WS GCP Part4: Waffle server deployment to GCP