This BigWaffleOps repository contains various components that can be used to support DevOps for managing a BigWaffle deployment.
Service
Scripts
YAML configuration file
Slack commands
Workflow
Troubleshooting
Google Cloud Functions
The /service package is a HTTP service that can be used to act upon triggers from 3rd party services. Currently it only supports Slack commands. The top level Dockerfile builds a NodeJs image that exposes the service on port 8888.
The service essentially translates a trigger into a command for the BigWaffle CLI. To make development slightly easier the /scripts directory contains auxiliary scripts that should be installed on the big-waffle-master
instance.
The Slack service uses a YAML configuration file, the current version assumes that the file name is slack.yaml
and that this file is available in a Google Cloud Storage bucket the name of which should be set in the environment variable: CONFIG_BUCKET
, which defaults to org-gapminder-big-waffle-functions
.
See the loadConfig
function in the service/utils module.
The configuration file should contain the following entries:
- bwMaster: the domain name, or ip address of the BigWaffle master
- privateKey: the complete private key to log into the BigWaffle master
- user: the user name to use to log into the BigWaffle master. This user should have (symbolic links to) the /scripts in directory
~/bin
, and the correct environment variables for the scripts in~/.bashrc
. - signingSecret: the Signing Secret generated for your Slack application.
Your slack.yaml should look like:
bwMaster: <ipaddress or domain name>
user: <big-waffler username>
privateKey: |
-----BEGIN RSA PRIVATE KEY-----
....
....
....
....
-----END RSA PRIVATE KEY-----
signingSecret: <signing secret generated by Slack>
/bwlist [<dataset>]
List all versions of all datasets. Provide a dataset name to see all versions of (only) that dataset.
Example: /bwlist SG
/bwload [[-N | --name] <name>] [--publish] [-D | --dateversion] [--ddfdir <ddfdirectory>]
<gitCloneUrl>
[<branch>]
Load (a new version of) a dataset into BigWaffle. This can take 1-60 minutes!
Example: /bwload -N SG https://github.com/open-numbers/ddf--gapminder--systema_globalis.git
/bwpublish <dataset>
Publish the most recently loaded version of a dataset. This unsets any default version, which means that the most recent version will be served by default.
Example: /bwpublish SG
/bwdefault <dataset> <version>
Make a given version of a dataset the default version. Use this to “revert” to an earlier version.
Example: /bwdefault SG 2019032501
/bwpurge <dataset>
Remove old versions of a given dataset. This will remove versions that were loaded before the current default version, except the version loaded right before the current default.
Example: /bwpurge SG
- User sends a command message in
big-waffle
channel on Slack, e.g./bwload -N fasttrackQA --publish https://github.com/open-numbers/ddf--gapminder--fasttrack.git autogenerated
- The command gets interpreted by the BigWaffle slack app, which Angie, Fredrik and [email protected] have access to and can add others as Collaborators. Note you need to look in Slack apps --> Build --> Your apps, not in the installed apps of the gapminder workspace.
- The slack app sends the requests further to the endpoints configured in the slack app slash commands, which points to the IP address used by the load balancer big-waffle-ops-test (this is the production endpoint, not a test endpoint)
- big-waffle-ops-test load balancer forwards the request to the internal kubernetes big-waffle-ops service which runs the code auto-deployed on github master branch push of the big-waffle-ops repo
- logging is made in gcp on https://console.cloud.google.com/kubernetes/deployment/europe-north1-a/ops-cluster/default/bigwaffle-ops/logs?project=big-waffle the service's code then loads config from a gcp bucket (includes the ssh key and ip address to big-waffle-master) and ssh-exec's commands on big-waffle-master as user "github". The user name is important because MariaDB has exactly that user configured
- the script that gets run by the load command is in /gapminders/github/bin/loadgit
- big-waffle-master runs a local database, connects to it locally and loads the data using the cli.js code, see big-waffle repo for more info
Check logs inside the instance properties, it is possible that the instance ran out of space.
Expand the volume the instance is using in Google cloud storage.
Restart the instance so that it can see the new volume size. This may change IP address of the instance and reset /gapminders/github/.ssh/authorized_keys
file
One needs gcloud SDK to do that. Install SDK, log in with gcloud auth login
.
Then run gcloud compute ssh --zone "europe-north1-a" "big-waffle-master" --project "big-waffle"
.
Alternatively gcloud compute ssh big-waffle-master
if zone and project were set up in SDK during the login process.
slack.yaml
should have the correct ID address of thebig-waffle-master
instance (could be changed upon restart)slack.yaml
should have the correct RSA private key in PEM format/gapminders/github/.ssh/authorized_keys
should have the correct RSA public key- The public key should probably also be listed in the web interface, in SSH properties of big-waffle-master instance, with "github" as user
Convert openssh key to PEM format
link: Gcloud web interface --> Kubernetes --> Workloads --> bigwaffle-ops --> LOGS
See example here
sudo su
su github
/gapminders/github/
The Google Cloud Functions are deprecated, and will be moved into the service.