Skip to content

Latest commit

 

History

History
76 lines (63 loc) · 4.68 KB

bot-setup.md

File metadata and controls

76 lines (63 loc) · 4.68 KB

Online DevOps Dojo coach setup

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.

Steps

  1. 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).

  2. Set AWS_STAGE & AWS_REGION in GitHub Secrets of <my_account>/online-devops-dojo. For example dev or prod & us-east-1.

  3. Since the workflow which uploads the lambda function is triggered by a push:

    1. Commit a small change like a space in index.js in the repository <my_account>/online-devops-dojo in master branch.
    2. Click on Actions tab and verify that the workflow runs without error.
  4. GitHub app creation

    1. From the AWS Console, open the lambda devops-dojo-robot-dev-lambda, click on API Gateway and copy the API endpoint.

    2. Create a new GitHub app with this link to get a prefilled form then complete it with the following steps.

    3. Set a unique GitHub App name of your own.

    4. Paste the API endpoint in both fields:

      • User authorization callback URL
      • Webhook URL
    5. Complete Homepage URL with the URL of <my_account>/online-devops-dojo repository.

    6. On a terminal, create a Webhook secret with:

      ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'

      copy the returned string, then:

      1. Paste it in GitHub app form Webhook secret,
      2. Paste it a new GitHub secret named WEBHOOK_SECRET of <my_account>/online-devops-dojo.
    7. The correct permissions and events have already been pre-filled.

    8. To Where can this GitHub App be installed? answer Any account.

    9. Click Create GitHub app.

    10. Click on Generate a private key (at the bottom), save it in a file like certificate.private-key.pem.

    11. 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
    12. Copy the output string into a new <my_account>/online-devops-dojo secret named PRIVATE_KEY.

    13. 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.

    14. 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.

  5. GitHub App installation

    1. In GitHub app Install app menu, on Repository access, click Only select repositories and select your forked pet-clinic repository.
    2. Click Install.
    3. 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.

Note

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).