This document is useful only for contributors who wants improve the DevOps Dojo
coach and install their own instance.
Student who wants to run the training can ignore this page.
This setup requires:
- an AWS user with policies allowing to create an API Gateway and Lambda function, for example this;
- a fork of dxc-technology/online-devops-dojo
repository. We will name it below
<my_account>\online-devops-dojo
where you will substitute<my_account>
by your GitHub account.
-
Get credentials of your AWS user: (AWS_ACCESS_KEY & AWS_SECRET_KEY) from the AWS Console in IAM (Users / Select a user / Security Credentials / Create Access Key) and store each in a GitHub secret of
<my_account>/online-devops-dojo
(click repository tab Settings, then Secrets). -
Set AWS_STAGE & AWS_REGION in GitHub Secrets of
<my_account>/online-devops-dojo
. For exampledev
orprod
&us-east-1
. -
Since the workflow which uploads the lambda function is triggered by a push:
- Commit a small change like a space in
index.js
in the repository<my_account>/online-devops-dojo
in master branch. - Click on Actions tab and verify that the workflow runs without error.
- Commit a small change like a space in
-
GitHub app creation
-
From the AWS Console, open the lambda
devops-dojo-robot-dev-lambda
, click on API Gateway and copy the API endpoint. -
Create a new GitHub app with this link to get a prefilled form then complete it with the following steps.
-
Set a unique GitHub App name of your own.
-
Paste the API endpoint in both fields:
- User authorization callback URL
- Webhook URL
-
Complete Homepage URL with the URL of
<my_account>/online-devops-dojo
repository. -
On a terminal, create a Webhook secret with:
ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'
copy the returned string, then:
- Paste it in GitHub app form Webhook secret,
- Paste it a new GitHub secret named WEBHOOK_SECRET of
<my_account>/online-devops-dojo
.
-
The correct permissions and events have already been pre-filled.
-
To Where can this GitHub App be installed? answer Any account.
-
Click Create GitHub app.
-
Click on Generate a private key (at the bottom), save it in a file like
certificate.private-key.pem
. -
In a terminal, run the following command on the
.pem
file in order to get a single-line string:cat certificate.private-key.pem | base64 -w 0
-
Copy the output string into a new
<my_account>/online-devops-dojo
secret named PRIVATE_KEY. -
On the top of the GitHub app About page, copy the App ID and paste it in a new
<my_account>/online-devops-dojo
secret named APP_ID. -
Commit a minor change on
index.js
(like a space) in master branch. This will trigger the Action workflow again and set the PRIVATE_KEY in lambda environment.
-
-
GitHub App installation
- In GitHub app Install app menu, on Repository access, click Only select repositories and select your forked pet-clinic repository.
- Click Install.
- On the menu, click Public page and note its URL: this is the URL that must be documented in Welcome module to invite students to install the bot.
Upload action had to run twice: before and after the GitHub app creation because the installations are mutually dependent (App requires AWS' generated API endpoint, and AWS requires App's generated PRIVATE KEY).