Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable "Dev Containers" development environment (VSCode, GitHub Codespace, etc.) #7107

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

skkdevcraft
Copy link

Context

Enable development via the "Dev Containers" VSCode feature. This also makes the repo compatible with the GitHub "Codespace" feature.

Working withing dev container provides better isolation than WSL2 on windows and is virtually identical on both MacOS and Windows.

Docs change

The dev containers feature will allow to extend the Local Setup page with:

  • Add a tab "Docker for Desktop" (Mac or Windows) in the Prerequisites
  • Add a tab "Docker for Desktop" to Step 1 and Step 2 with the following instructions:
  1. Open VSCode;
  2. Press (Ctrl + Shift + P) to open the command palette (or use the View -> Command Palette ... menu);
  3. Then type: "Dev Containers: Clone Repository in Container Volume..."
  • Add a tab "Docker for Desktop" to Step 3:
postgres-on-devcontainer

Copy link

Welcome!

Hello there, congrats on your first PR! We're excited to have you contributing to this project.
By submitting your Pull Request, you acknowledge that you agree with the terms of our Contributor License Agreement.

Generated by 🚫 dangerJS against 16383c6

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR introduces Dev Container support for the Twenty project, enhancing development environment consistency across platforms.

  • Added .devcontainer/ directory with Dockerfile, devcontainer.json, and docker-compose.yml for Dev Container configuration
  • Modified /packages/twenty-front/vite.config.ts to allow configurable host via VITE_HOST environment variable
  • Added new 'postgres-on-devcontainer' targets in root Makefile and /packages/twenty-postgres/Makefile for PostgreSQL provisioning
  • Updated documentation to include instructions for Docker for Desktop setup in Local Setup guide

6 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings

environment:
PGHOST: db
PGUSER: postgres
PGPASSWORD: postgres
Copy link

Choose a reason for hiding this comment

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

logic: Exposing database credentials in the docker-compose file is a security risk. Consider using environment variables or a secrets management system.

Copy link
Author

Choose a reason for hiding this comment

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

[dx] the "db" container is accessible only by the "app" container as in a "private network". providing the credentials as environment variables allows us to use the psql cli directly (from the "app" container) without specifying them each time. for example psql --list should we need external access to the database server, the recommended approach is to add a container with pgadmin or similar.

- ../..:/workspaces:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
Copy link

Choose a reason for hiding this comment

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

style: Using 'sleep infinity' as the command may not be the best practice for keeping the container running. Consider using a more robust solution like a proper init system.

Copy link
Author

Choose a reason for hiding this comment

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

the container is started and stopped manually by the IDE and is not intended for production life-cycle management

@skkdevcraft
Copy link
Author

Hey everyone!

I've been switching between my Windows desktop and my M2 MacBook lately, and I wanted to share something that's really improved my workflow: using dev containers. It's been a fantastic developer experience, and I thought it might be helpful for others too!

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