A platform for community discussion. Free, open, simple.
DEV: Document installing admin + playwright/test DB in dev container (#40380)
Dan Fabulich64ee16f7b9ef
diff --git a/.devcontainer/scripts/start.rb b/.devcontainer/scripts/start.rbindex e208afa5e04..ed948cfb019 100755--- a/.devcontainer/scripts/start.rb+++ b/.devcontainer/scripts/start.rb@@ -25,5 +25,10 @@ puts <<~TXTNext steps:1. Cmd/Ctrl + Shift + B to run the shortcuts/boot-dev task2. Wait for the server to start- 3. Open your browser to http://localhost:4200+ 3. Run the "dev/admin/create" task once to create an admin account+ 4. Open your browser to http://localhost:4200++ Running tests:+ Run the "deps/testing" task once to install Playwright + discourse_test DB+ Then you can run qunit and rspec tests (boot-dev server should be running)TXTdiff --git a/.vscode/tasks.json.sample b/.vscode/tasks.json.sampleindex c7640bb5e32..3fd0b7657a3 100644--- a/.vscode/tasks.json.sample+++ b/.vscode/tasks.json.sample@@ -33,6 +33,17 @@],"problemMatcher": []},+ {+ "label": "deps/playwright",+ "type": "shell",+ "command": "pnpm playwright-install && sudo pnpm exec playwright install-deps chromium",+ "presentation": {+ "reveal": "always",+ "group": "deps",+ "close": true+ },+ "problemMatcher": []+ },{"label": "dev/migrate","type": "shell",@@ -57,6 +68,17 @@"problemMatcher": [],"isBackground": true},+ {+ "label": "dev/admin/create",+ "type": "shell",+ "command": "bin/rake admin:create",+ "presentation": {+ "reveal": "always",+ "group": "dev",+ "close": true+ },+ "problemMatcher": []+ },{"label": "shortcuts/boot-dev","dependsOn": [@@ -77,6 +99,20 @@"command": "RAILS_ENV=test bin/rake db:create db:migrate parallel:create parallel:migrate","problemMatcher": [],},+ {+ "label": "deps/testing",+ "dependsOn": [+ "deps/playwright",+ "spec/migrate"+ ],+ "dependsOrder": "sequence",+ "presentation": {+ "reveal": "always",+ "group": "deps",+ "close": true+ },+ "problemMatcher": []+ },{"label": "spec/run-all","type": "shell",diff --git a/docs/developer-guides/docs/02-development-environments/01-devcontainer.md b/docs/developer-guides/docs/02-development-environments/01-devcontainer.mdindex 55ad7fc36ac..6c714c9637d 100644--- a/docs/developer-guides/docs/02-development-environments/01-devcontainer.md+++ b/docs/developer-guides/docs/02-development-environments/01-devcontainer.md@@ -28,14 +28,22 @@ Dev Containers can be used in a number of different IDEs, or directly using thei1. 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.-1. Run the default build task using <kbd>Ctrl + Shift + B</kbd> (<kbd>Cmd + Shift + B</kbd> on mac).+1. Run the default build task using <kbd>Cmd/Ctrl + Shift + B</kbd>.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.+1. Run the `dev/admin/create` task. Open the command palette 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.+1. Visit `http://localhost:4200` in your browser to see your new Discourse instance1. All done! You can now make changes to Discourse's source code and see them reflected in the preview.+## 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`](https://meta.discourse.org/t/132947), [`bin/qunit`](https://meta.discourse.org/t/66857), or the [system specs](https://meta.discourse.org/t/325937)+## Applying config/container updatesEvery so often, the devcontainer config and the associated container image will be updated. VSCode should prompt you to "rebuild" to apply the changes. Alternatively, you can run "Dev Containers: Rebuild Container" from the VSCode command palette. The working directory, and your Redis/Postgres data will be preserved across rebuilds.diff --git a/docs/developer-guides/docs/02-development-environments/02-github-codespaces.md b/docs/developer-guides/docs/02-development-environments/02-github-codespaces.mdindex 0b4756e5309..0c2bcee2865 100644--- a/docs/developer-guides/docs/02-development-environments/02-github-codespaces.md+++ b/docs/developer-guides/docs/02-development-environments/02-github-codespaces.md@@ -10,27 +10,29 @@ id: github-codespaces1. Navigate to [the github repository](https://github.com/discourse/discourse)-2. Press the <kbd>,</kbd> (comma) key on your keyboard, to open GitHub codespaces+1. Press the <kbd>,</kbd> (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.+1. 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.-4. Click "Create Codespace"+1. 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.+1. 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.-6. Run the default build task using <kbd>Ctrl + Shift + B</kbd> (<kbd>Cmd + Shift + B</kbd> on mac).+1. Run the default build task using <kbd>Cmd/Ctrl + Shift + B</kbd>.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. Visit the "Ports" tab, and click the :globe_with_meridians: button for port 4200. This will open a new tab showing your development copy of Discourse+1. Run the `dev/admin/create` task. Open the command palette with <kbd>Cmd/Ctrl + Shift + P</kbd> 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.++1. Visit the "Ports" tab, and click the :globe_with_meridians: button for port 4200. This will open a new tab showing your development copy of Discourse-8. All done! You can now make changes in the codespace and see them reflected in the preview.+1. All done! You can now make changes in the codespace and see them reflected in the preview.@@ -38,6 +40,12 @@ The VSCode environment will automatically be configured with our recommended setTo minimize usage, make sure to run "Codespaces: Stop Current Codespace" from the command palette (<kbd>Ctrl + Shift + P</kbd> or <kbd>Cmd + Shift + P</kbd>) 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`](https://meta.discourse.org/t/132947), [`bin/qunit`](https://meta.discourse.org/t/66857), or the [system specs](https://meta.discourse.org/t/325937)+# Tips- You can launch a codespace from specific branches/PRs - just visit it, and press <kbd>,</kbd>