Skip to content

Adding a Project#

Add the project to Lagoon#

  1. Run this command:

    Add project
    lagoon add project \
      --git-url <YOUR-GITHUB-REPO-URL> \
      --deploytarget 1 \
      --production-environment <YOUR-PROD-ENV> \
      --branches <THE-BRANCHES-YOU-WANT-TO-DEPLOY> \
      --project <YOUR-PROJECT-NAME>
    
    • The value for --deploytarget is the ID of your Kubernetes cluster.
    • Your production environment should be the name of the branch you want to have as your production environment.
    • The branches you want to deploy might look like this: “^(main|develop)$”
    • The name of your project is anything you want - “Company Website,” “example,” etc.
  2. Go to the Lagoon UI, and you should see your project listed!

Add the deploy key to your Git repository#

Lagoon creates a deploy key for each project. You now need to add it as a deploy key in your Git repository to allow Lagoon to download the code.

  1. Run the following command to get the deploy key:

    Get project-key
    lagoon get project-key --project <YOUR-PROJECT-NAME>
    
  2. Copy the key and save it as a deploy key in your Git repository.

GitHub GitLab Bitbucket

Add the webhooks endpoint to your Git repository#

In order for Lagoon to be able to deploy on code updates, it needs to be connected to your Git repository

  1. Add your Lagoon cluster's webhook endpoint to your Git repository

    • Payload URL: <LAGOON-WEBHOOK-INGRESS>
    • Content Type: JSON
    • Active: Active (allows you to enable/disable as required)
    • Events: Select the relevant events, or choose All. Usually push, branch create/delete are required

GitHub GitLab Bitbucket