Developing Discourse on GitHub Codespaces


目录

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

  1. Navigate to the github repository

  2. Press the , (comma) key on your keyboard, to open GitHub codespaces

  3. 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.

    Codespace config|1186x920,20%

  4. Click "Create Codespace"

  5. 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.

    Discourse in codespace editor|2286x1316,20%

  6. Run the default build task using Cmd/Ctrl + Shift + B.

    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.

  7. Run the dev/admin/create task. Open the command palette with Cmd/Ctrl + Shift + P and search for "Tasks: Run Tasks". It will present a menu of tasks; select dev/admin/create off of that list. You'll be prompted to enter an email address and a password for your admin user.

  8. Visit the "Ports" tab, and click the :globe_with_meridians: button for port 3000. This will open a new tab showing your development copy of Discourse

    Codespaces ports tab|1198x282,40%

  9. All done! You can now make changes in the codespace and see them reflected in the preview.

    Discourse loaded in codespace environment|2110x1358,20%

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 codespace will not be detected as idle, so it's best to stop it deliberately.

Running tests

The first time you run tests, you'll need to install testing dependencies, including Playwright and the discourse_test DB. You can run the deps/testing task to install those. Open the command palette, select "Tasks: Run Tasks". It will present a menu of tasks; select deps/testing off of that list.

Once the test dependencies are installed, you can run bin/lint, bin/qunit, or the system specs

Tips


版本号 #2
由 壳壳虫 创建于 2026-10-31 13:27:27 UTC
由 壳壳虫 更新于 2026-10-31 13:27:27 UTC