GitHub Codespaces is a very fast way to get started with Discourse development. Their free tier is good for 30 hours per month of a 4-core machine.
Getting Started
-
Navigate to the github repository
-
Press the , (comma) key on your keyboard, to open GitHub codespaces
-
Use ‘change options’ to customize the machine. Technically, the 2-core machine will work, but we recommend using at least 4-core for a better experience.
-
Click “Create Codespace”
-
Wait for the container to download and start. When it’s done, the README will appear, and you’ll see the Discourse filesystem in the sidebar.
-
Run the default build task using Ctrl + Shift + B (Cmd + Shift + B on mac).
This will install dependencies, migrate the database, and start the server. It’ll take a few minutes, especially on the lower-end machines. You’ll see “Build successful” in the terminal when it’s done.
-
Visit the “Ports” tab, and click the button for port 4200. This will open a new tab showing your development copy of Discourse
-
All done! You can now make changes in the codespace and see them reflected in the preview.
The VSCode environment will automatically be configured with our recommended settings and extensions, including automatic linting and formatting.
To minimize usage, make sure to run “Codespaces: Stop Current Codespace” from the command palette (Ctrl + Shift + P or Cmd + Shift + P) when you’re finished. If you forget to do this, the Codespace should be shut down automatically after your account’s configured idle time (default 30 mins). But, there are some situations where the codepace will not be detected as idle, so it’s best to stop it deliberately.
Tips
-
You can launch a codespace from specific branches/PRs - just visit it, and press ,
-
You can manage all your codespaces at Sign in to GitHub · GitHub
-
Discourse’s sample vscode
.vscode/settings.json
and.vscode/tasks.json
will be copied when you first boot the codespace. From that point forward, if you want to use the latest sample config, you’ll need to manually copy.vscode/settings.json.sample
to.vscode/settings.json
.
This document is version controlled - suggest changes on github.