Skip to content

Commit 5cd89ed

Browse files
authored
Switch from Gitpod to GitHub Codespaces (#5653)
We had Gitpod support and documentation for easy online development. But GitHub now supports Codespaces which is easier to use. Also I've seen that Gitpod [is renamed](https://ona.com/stories/gitpod-is-now-ona) to Ona now with more AI focus. I think it's time to switch from Gitpod to GitHub Codespaces. Apart from the documentation, this PR adds a devcontainer config which is used by Codespaces. I tested it manually in VSCode and it works as expected. One minor annoying thing is that whenever you open up your vscode, it suggests devcontainers if that plugin is installed. But you can click on "don't show this again" to hide that popup on startup (Or remove the plugin? Not so sure if it comes preinstalled or if I installed it before, but my local vscode already had it).
2 parents d442348 + a10d1fb commit 5cd89ed

File tree

8 files changed

+111
-62
lines changed

8 files changed

+111
-62
lines changed

.devcontainer/devcontainer.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "Firefox Profiler",
3+
"image": "mcr.microsoft.com/devcontainers/javascript-node:22",
4+
"features": {
5+
"ghcr.io/devcontainers/features/node:1": {
6+
"version": "22"
7+
}
8+
},
9+
"forwardPorts": [4242],
10+
"portsAttributes": {
11+
"4242": {
12+
"label": "Firefox Profiler",
13+
"onAutoForward": "openBrowser"
14+
}
15+
},
16+
"postCreateCommand": "yarn install",
17+
"postStartCommand": "FX_PROFILER_HOST=\"0.0.0.0\" yarn start",
18+
"customizations": {
19+
"vscode": {
20+
"extensions": [
21+
"dbaeumer.vscode-eslint",
22+
"esbenp.prettier-vscode",
23+
"stylelint.vscode-stylelint"
24+
],
25+
"settings": {
26+
"editor.formatOnSave": true,
27+
"editor.defaultFormatter": "esbenp.prettier-vscode"
28+
}
29+
}
30+
}
31+
}

.gitpod.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,11 @@ module.exports = function (config, serverConfig) {
5252

5353
This project uses [TypeScript](https://www.typescriptlang.org/).
5454

55-
## Using Gitpod
55+
## Using GitHub Codespaces
5656

57-
Alternatively, you can also develop the Firefox Profiler online in a pre-configured development environment:
57+
Alternatively, you can also develop the Firefox Profiler online in a pre-configured development environment using [GitHub Codespaces](https://github.com/features/codespaces).
5858

59-
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/firefox-devtools/profiler)
60-
61-
Gitpod will automatically install all dependencies; start the webpack server for you; and open the web app in a new browser tab. Please look at our [gitpod documentation](./docs-user/gitpod.md) for more information.
59+
GitHub Codespaces will automatically install all dependencies, start the webpack server for you, and forward port 4242 so you can access the web app. Please look at our [GitHub Codespaces documentation](./docs-developer/codespaces.md) for more information.
6260

6361
## Loading in profiles for development
6462

README.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,20 @@ yarn start
4343

4444
This project uses [TypeScript](https://www.typescriptlang.org/).
4545

46-
You can also develop the Firefox Profiler online in a pre-configured development environment.
46+
You can also develop the Firefox Profiler online in a pre-configured development environment using [GitHub Codespaces](https://github.com/features/codespaces).
4747

48-
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/firefox-devtools/profiler)
49-
50-
Please look at our [gitpod documentation](./docs-user/gitpod.md) for more information.
48+
Please look at our [GitHub Codespaces documentation](./docs-developer/codespaces.md) for more information.
5149

5250
For more detailed information on getting started contributing. We have plenty of docs available to get you started.
5351

54-
| | |
55-
| -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
56-
| [Contributing](./CONTRIBUTING.md) | Find out in detail how to get started and get your local development environment configured. |
57-
| [Code of Conduct](./CODE_OF_CONDUCT.md) | We want to create an open and inclusive community, we have a few guidelines to help us out. |
58-
| [Developer Documentation](./docs-developer) | Want to know how this whole thing works? Get started here. |
59-
| [Source Files](./src) | Dive into the inner workings of the code. Most folders have a `README.md` providing more information. |
60-
| [End-User Documentation](https://profiler.firefox.com/docs/#/) | These docs are customized for actual users of the profiler, not just folks contributing. |
61-
| [Gitpod documentatation](./docs-user/gitpod.md) | Start here if you want to set up a work space on gitpod. |
52+
| | |
53+
| ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
54+
| [Contributing](./CONTRIBUTING.md) | Find out in detail how to get started and get your local development environment configured. |
55+
| [Code of Conduct](./CODE_OF_CONDUCT.md) | We want to create an open and inclusive community, we have a few guidelines to help us out. |
56+
| [Developer Documentation](./docs-developer) | Want to know how this whole thing works? Get started here. |
57+
| [Source Files](./src) | Dive into the inner workings of the code. Most folders have a `README.md` providing more information. |
58+
| [End-User Documentation](https://profiler.firefox.com/docs/#/) | These docs are customized for actual users of the profiler, not just folks contributing. |
59+
| [GitHub Codespaces documentation](./docs-developer/codespaces.md) | Start here if you want to set up a workspace on GitHub Codespaces. |
6260

6361
### Discussion
6462

@@ -68,7 +66,7 @@ Say hello on Matrix in the [_Firefox Profiler_ channel (_#profiler:mozilla.org_)
6866

6967
[MPL v2](./LICENSE) is designed to encourage contributors to share modifications they make to the code, while still allowing them to combine the code with code under other licenses (open or proprietary) with minimal restrictions.
7068

71-
We are very grateful to the the **zlib compression library (Jean-loup Gailly, Mark Adler and team)** for their contribution to the project.
69+
We are very grateful to the **zlib compression library (Jean-loup Gailly, Mark Adler and team)** for their contribution to the project.
7270

7371
[matrix]: https://chat.mozilla.org/#/room/#profiler:mozilla.org
7472

docs-developer/codespaces.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Setting up profiler on GitHub Codespaces
2+
3+
Instead of configuring a local setup, you can also use [GitHub Codespaces](https://github.com/features/codespaces), a cloud-based development environment with minimal setup.
4+
5+
## Getting Started
6+
7+
You can create a new Codespace directly from the repository:
8+
9+
1. Navigate to the [Firefox Profiler repository](https://github.com/firefox-devtools/profiler)
10+
2. Click the green `Code` button
11+
3. Click on the `Codespaces` tab
12+
4. Click `Create codespace on main` (or on your branch)
13+
14+
GitHub will automatically:
15+
16+
- Create a new development environment
17+
- Install all dependencies using `yarn install`
18+
- Start the development server on port 4242
19+
20+
## Open the profiler UI in your web browser
21+
22+
Once the Codespace is ready, GitHub will automatically forward port 4242. You'll see a notification that a service is available on this port.
23+
24+
- Click `Open in Browser` to open the profiler UI in a new tab
25+
- Alternatively, you can access forwarded ports from the `PORTS` tab at the bottom of the VS Code interface
26+
27+
## Load custom profiles
28+
29+
If you want to load profiles for development, you can follow the steps described in [Loading in profiles for development](../CONTRIBUTING.md#loading-in-profiles-for-development) section.
30+
31+
## Advanced usage
32+
33+
### Opening a specific branch or pull request
34+
35+
You can create a Codespace for any branch or pull request:
36+
37+
1. Navigate to the branch or pull request you want to work on
38+
2. Click the `Code` button
39+
3. Select the `Codespaces` tab
40+
4. Click `Create codespace on [branch-name]`
41+
42+
### Using the GitHub CLI
43+
44+
You can also create and manage Codespaces using the [GitHub CLI](https://cli.github.com/):
45+
46+
```bash
47+
# Create a new codespace
48+
gh codespace create --repo firefox-devtools/profiler
49+
50+
# List your codespaces
51+
gh codespace list
52+
53+
# Connect to a codespace
54+
gh codespace code
55+
```
56+
57+
### Configuration
58+
59+
The Codespace is configured using the `.devcontainer/devcontainer.json` file in the repository. This includes:
60+
61+
- Node.js environment
62+
- Automatic port forwarding for port 4242
63+
- Pre-installed VS Code extensions (ESLint, Prettier, Stylelint)
64+
- Automatic dependency installation and server startup

docs-user/gitpod.md

Lines changed: 0 additions & 34 deletions
This file was deleted.

res/photon/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const port = process.env.FX_PROFILER_PHOTON_PORT || 4243;
66
const host = process.env.FX_PROFILER_PHOTON_HOST || 'localhost';
77

88
const serverConfig = {
9-
allowedHosts: ['localhost', '.gitpod.io'],
9+
allowedHosts: ['localhost', '.app.github.dev'],
1010
host,
1111
port,
1212
static: false,

server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ config.cache = {
2929
type: 'filesystem',
3030
};
3131
const serverConfig = {
32-
allowedHosts: ['localhost', '.gitpod.io'],
32+
allowedHosts: ['localhost', '.app.github.dev'],
3333
host,
3434
port,
3535
// We disable hot reloading because this takes lot of CPU and memory in the

0 commit comments

Comments
 (0)