Skip to content

Add support for dev containers.#2248

Merged
ymc9 merged 3 commits into
zenstackhq:devfrom
sanny-io:devcontainer
Oct 13, 2025
Merged

Add support for dev containers.#2248
ymc9 merged 3 commits into
zenstackhq:devfrom
sanny-io:devcontainer

Conversation

@sanny-io

Copy link
Copy Markdown
Contributor

This pull request adds support for dev containers, which are pre-configured developer environments that make contributing to projects significantly easier, as there is little to no setup required for new contributors to get started.

Per the contributing guidelines, the workspace is pre-configured to use Node.js v20 and pnpm v9.15.9

It also comes with a Postgres database upon which tests can be ran. I've looked at the test suite on GitHub actions, and it appears to run against the latest version of Postgres, so I have set the Postgres container to also pull the latest Postgres image.

The workspace also comes with the Langium and Jest Runner extensions for Visual Studio Code installed, which I see are recommend here.

Finally, upon initializing the container, it automatically installs dependencies, builds the project, and scaffolds the tests.

To get started:

  1. Install and configure the Dev Containers extension.
  2. Clone and open the ZenStack repo.
  3. Re-open the project in a container with Ctrl + Shift + P
image

Still to do: document this process in the contributing guidelines.

@coderabbitai

coderabbitai Bot commented Sep 17, 2025

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds a new .devcontainer/.env with Postgres and ZenStack test DB credentials for local development, and updates .gitignore to ignore .pnpm-store.

Changes

Cohort / File(s) Summary
Devcontainer env config
`.devcontainer/.env`
New environment file with key=value pairs for Postgres and ZenStack test database settings.
Git ignore updates
`.gitignore`
Added `.pnpm-store` to ignored paths.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly and concisely summarizes the main change of adding dev container support without extraneous detail.
Description Check ✅ Passed The description provides details about the dev container setup and is directly related to the changes in the pull request, explaining the environment configuration and remaining tasks.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sanny-io

sanny-io commented Oct 1, 2025

Copy link
Copy Markdown
Contributor Author

@ymc9 I didn't realize there was a separate repo for v3, which already seems to have a dev container JSON file.

I don't see an included postgres container or automatic installation of the extensions, however.

How would you like this to proceed?

@ymc9

ymc9 commented Oct 1, 2025

Copy link
Copy Markdown
Member

Hi @sanny-io , thanks for working on this! The change looks great, let's get it merged.

Yes, v3 resides in a separate repo for now. There's a devcontainer config and it uses the postgresql feature. I'm not sure what real difference it makes from an explicit container, but it seems to be working fine (although I haven't used dev container extensively).

@ymc9

ymc9 commented Oct 2, 2025

Copy link
Copy Markdown
Member

Hi @sanny-io , do you think this PR is in a completed status? Asking cause it's still Draft now.

@sanny-io

sanny-io commented Oct 2, 2025

Copy link
Copy Markdown
Contributor Author

@ymc9 with the release of Postgres 18, I haven't finished looking into the changes needed for docker-compose files. I know for one thing, the volume has changed from /var/lib/postgresql/data to /var/lib/postgresql

This PR should be ready within a few days 👍

@sanny-io sanny-io marked this pull request as ready for review October 5, 2025 10:12

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.devcontainer/.env (1)

11-11: Add the trailing newline to satisfy dotenv linting.

dotenv-linter flags the missing newline at EOF; adding one keeps the file compliant and silences the warning.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 80ebb55 and eba1522.

⛔ Files ignored due to path filters (2)
  • .devcontainer/devcontainer.json is excluded by !**/*.json
  • .devcontainer/docker-compose.yml is excluded by !**/*.yml
📒 Files selected for processing (2)
  • .devcontainer/.env (1 hunks)
  • .gitignore (1 hunks)
🧰 Additional context used
🪛 dotenv-linter (3.3.0)
.devcontainer/.env

[warning] 2-2: [UnorderedKey] The POSTGRES_PASSWORD key should go before the POSTGRES_USER key

(UnorderedKey)


[warning] 3-3: [UnorderedKey] The POSTGRES_DB key should go before the POSTGRES_PASSWORD key

(UnorderedKey)


[warning] 4-4: [UnorderedKey] The POSTGRES_HOST key should go before the POSTGRES_PASSWORD key

(UnorderedKey)


[warning] 5-5: [UnorderedKey] The POSTGRES_PORT key should go before the POSTGRES_USER key

(UnorderedKey)


[warning] 8-8: [UnorderedKey] The ZENSTACK_TEST_DB_PASS key should go before the ZENSTACK_TEST_DB_USER key

(UnorderedKey)


[warning] 9-9: [UnorderedKey] The ZENSTACK_TEST_DB_NAME key should go before the ZENSTACK_TEST_DB_PASS key

(UnorderedKey)


[warning] 10-10: [UnorderedKey] The ZENSTACK_TEST_DB_HOST key should go before the ZENSTACK_TEST_DB_NAME key

(UnorderedKey)


[warning] 11-11: [EndingBlankLine] No blank line at the end of the file

(EndingBlankLine)


[warning] 11-11: [UnorderedKey] The ZENSTACK_TEST_DB_PORT key should go before the ZENSTACK_TEST_DB_USER key

(UnorderedKey)

@sanny-io

sanny-io commented Oct 5, 2025

Copy link
Copy Markdown
Contributor Author

@ymc9 this should be good to go. Delete the previous volume that Postgres was using if you haven't already, or the container won't work properly.

@ymc9 ymc9 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sanny-io ! LGTM and I'm merging it.

@ymc9 ymc9 merged commit 07ab028 into zenstackhq:dev Oct 13, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants