Skip to content

Commit

Permalink
[docs] Gitpod integration with Moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
sarjona committed Dec 1, 2023
1 parent bdefd3e commit 09b2880
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 73 additions & 0 deletions general/development/tools/gitpod.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
title: Gitpod
tags:
- tools
- Gitpod
---
<!-- cspell:ignore Tampermonkey -->

[Gitpod](https://www.gitpod.io/) is a free, cloud-based, with IDE integration and a suitable development environment right in a browser.

It has been integrated with [moodle-docker](https://github.com/moodlehq/moodle-docker/) so that you can open any Moodle repository/branch in a Gitpod workspace.

When launching a workspace in Gitpod, it will automatically:

1. Clone the Moodle repo into the `<workspace>/moodle` folder.
1. Initialise the Moodle database.
1. Start the Moodle webserver.

More information about the Gitpod integration with moodle-docker, like the parameters it supports, can be found in the [project's page](https://github.com/moodlehq/moodle-docker/#quick-start-with-gitpod).

:::caution Important

Gitpod is an alternative to local development and completely optional. We recommend setting up a local development environment if you plan to contribute regularly.

:::

## How to use Gitpod with Moodle?

A [Tampermonkey](https://www.tampermonkey.net/) script has been created to facilitate the initiation of a Gitpod workspace from any Moodle repository/branch. When the script is installed, a button is displayed near each branch in the [Moodle tracker](https://tracker.moodle.org/) within the Moodle repository, facilitating the initiation of a Gitpod workspace. It can be used for testing any Moodle repository/branch without requiring a local environment installed.

![Gitpod integration with Moodle tracker](./_gitpod/trackerintegration.png)

To use it, follow these steps:

1. Install the [Tampermonkey extension](https://www.tampermonkey.net/) for your favourite browser.
1. Go to **Dashboard** in the Tampermonkey extension and access the **Utilities** tab.
1. In the **Import from URL** field, paste the following Gitpod script: https://gist.githubusercontent.com/sarjona/9fc728eb2d2b41a783ea03afd6a6161e/raw/gitpod.js
1. Go to the [Moodle Tracker](https://tracker.moodle.org/) and open any issue.
1. Click the **Open in Gitpod** button that should appear near any of the branches in the issue.

The first time you open a workspace, you will need to register in [gitpod.io](https://www.gitpod.io/) (you can use your Github account).

After waiting for 5-8 minutes, a Moodle site will open in your IDE (web VSCode by default) and you'll be able to start playing with it!!

:::info

The password for the `admin` user is `test` ;-)

:::

## About the Gitpod workspaces

- By default, any Gitpod workspace is automatically suspended after 30 minutes of inactivity.
- Workspaces are automatically removed after 14 days.
- You can see the workspaces list in the [Gitpod dashboard](https://gitpod.io/workspaces/). From there, you can open any existing workspace. It will be resumed, displaying the Moodle site in the IDE the same way as when it was left when suspended.
- It's recommended to rename them manually to something more meaningful (like the tracker issue).

## What can be done with this integration?

The following list is just a sample of the things that can be done with the integration of Gitpod with Moodle:

- Test Moodle Tracker issues easily. Especially useful for non-developers or QA testers.
- Test third-party plugins.
- Remote development environment.
- Run tests (behat, PHPUnit…).

## See also

- [Moodle docker](https://github.com/moodlehq/moodle-docker/#quick-start-with-gitpod)
- [Gitpod samples](https://github.com/gitpod-samples)
- [gitpod.yml](https://www.gitpod.io/docs/references/gitpod-yml)
- [gitpod-cli](https://www.gitpod.io/docs/references/gitpod-cli)
- [Environment variables](https://www.gitpod.io/docs/configure/projects/environment-variables)

0 comments on commit 09b2880

Please sign in to comment.