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

Add Devcontainer Support #1620

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

Add Devcontainer Support #1620

wants to merge 3 commits into from

Conversation

aroop
Copy link

@aroop aroop commented Jul 18, 2024

Description

This PR adds support for Devcontainers to streamline the development environment setup process using Visual Studio Code. With this update, developers can easily configure and launch the project within a containerized environment, ensuring consistency across different development setups.

Changes

  • Added .devcontainer directory with necessary configuration files.
  • Updated database.yml to use the ENV variables if they are set
  • Created new bin/setup-devcontainer which does not install Postgres and Redis as they are available as services

Instructions to Test

  1. Clone the Repository:

git clone git@github.com:bullet-train-co/bullet_train.git your_new_project_name

  1. Navigate to the Project Directory:

cd your_new_project_name

  1. Run Initial Configuration:

./bin/configure

Note: This step needs to be run locally once at the time of project setup.

Open in VS Code:

  • Open the project in Visual Studio Code.
  • Select "Reopen in Container" to complete the setup.

This setup ensures a consistent development environment and simplifies new project setup

@aroop
Copy link
Author

aroop commented Jul 18, 2024

This PR helps with issue like

#1608
#1606

@jagthedrummer
Copy link
Contributor

Hey, @aroop, thanks for the PR! I don't use VSC so I'm not really equipped to give this a full review. I'm going to ping some of the other folks on the core team and see if one of them can give it a run.

@gazayas
Copy link
Contributor

gazayas commented Aug 20, 2024

Hey @aroop, this looks great! I like the idea of running the app in a docker container this way. A couple things:

  1. The initial steps you laid out look like this:
    1. Clone the Repository
    2. Navigate to the Project Directory
    3. Run Initial Configuration: ./bin/configure
      If we're trying to solve problems bin/setup doesn't tell me how to fix NodeJS version or yarn issue #1608, I'm curious if we should prompt the developer to open VS Code first and run ./bin/configure from the terminal there. I saw your note that says "This step needs to be run locally once at the time of project setup." concerning ./bin/configure. What's the rationale for running ./bin/configure first as opposed to checking node/Ruby versions within the container itself? I'm not saying the order is incorrect, I'm just trying to understand the flow for starting/using the docker container.
  2. This is probably just a lack of understanding on my part of docker, but I'm having trouble running the container itself. Docker seems to be working properly on my side:
> docker --version
Docker version 27.1.2, build d01f264
> whoami
gazayas
> cat /etc/group | grep docker
docker:x:998:gazayas

However, when I open VS Code and try to reopen it with the container, I get a permission denied error:
image
I also tried to add the user to devcontainer.json:

"remoteUser": "gazayas",
"containerUser": "gazayas"

No luck here either. I also tried changing the VS Code profile from Default to gazayas, to no avail. Anything I'm missing?

Either way, I do like the idea and think adding it to the project would be really helpful!

# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)
ports:
- 45678:45678

Choose a reason for hiding this comment

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

I'd propose adding an env variable to improve the corepack prompt on the install process

environment:
      COREPACK_ENABLE_DOWNLOAD_PROMPT: 0 # prevent yarn install y/n prompt

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.

4 participants