Skip to content

Github integration

This page describes how to configure Gaia to integrate with Github to:

  • be able to login using a Github account
  • be able to import Terraform modules directly from Github

Note

only public repositories of the Github user can be imported for now.

Create a Github OAuth App

On Github, create a new OAuth App (in an organization or in your personnal account).

Go to https://github.com/settings/developers, and click Register a new application.

Screenshot of OAuth Apps screen on Github

Enter the following information:

  • Application name : Gaia
  • Homepage URL : The URL of your Gaia instance (http://localhost:8080 if running a development instance)
  • Application description: Gaia
  • Authorization callback URL : Homepage URL + /auth/oauth2/github/callback

Screenshot of OAuth App creation screen on Github

Take note of the Client ID, generate a Client secret, and take note of it too.

Screenshot the OAuth App showing Client ID and Client Secret on Github

Configure Gaia for Github

With docker-compose

Edit your docker-compose.yml file to activate the github Spring profile, and to add your Client ID and Client Secret for the Github registration :

version: "3"
services:
  gaia:
    image: gaiaapp/gaia
    ports:
      - '8080:8080'
    environment:
      - "GAIA_MONGODB_URI=mongodb://mongo/gaia"
      - "GAIA_EXTERNAL_URL=http://172.17.0.1:8080"
      - "GAIA_RUNNER_API_PASSWORD=123456"
      - "SPRING_PROFILES_ACTIVE=github"
      - "SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_GITHUB_CLIENT_ID=<CLIENT_ID>"
      - "SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_GITHUB_CLIENT_SECRET=<CLIENT_SECRET>"

Login with Github

On the Login page, the github button should appear:

Screenshot the login page on Gaia

Import a module from Github

On the Import Module page, you should now be able to select a module from the repositories of your Github user.

Screenshot the login page on Gaia