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

feat(dev): add devcontainer config, add instructions to README #16677

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tfenster
Copy link

Similar to evcc-io/app#17, to have an easier and cleaner way to set up a development environment, I added a devcontainer configuration and described in the README how it works. I tested building and running evcc in the container, which works fine.

Please let me know if you want any adjustments. Also, if you disagree with the approach, I can just keep my fork and would of course accept that

Thanks for your work!

@andig
Copy link
Member

andig commented Oct 16, 2024

What's the difference to #15301?

@andig andig added the infrastructure Basic functionality label Oct 16, 2024
@tfenster
Copy link
Author

@andig Sorry, I didn't see that one. Going through that conversation, it looks to me like you didn't succeed in setting it up, so I created a quick video what the result looks like. I go from only VS Code and Docker Desktop installed on a Windows machine within 3 minutes to running evcc:

evcc in devcontainer

If you want, I'd be happy to give you access to a Windows VM in the Cloud so that you can try for yourself.

This configuration would even open up the possibility of Github Codespaces. Again, to give you an idea, I created the following video. Here I cheated a bit, because I went through the initial setup steps and make and the video only starts after that, but it works exactly the same. As a result you can see evcc running in a Codespace

image

If you don't see the benefits or don't want to have it in the main repo, I would offer to maintain a fork on my Github account that you could link to, stating that you don't support it and I would do support on a best-effort basis. I would very much prefer to have it in your repo as I really think it would lower the barrier for contributions, but that of course is your decision

@tfenster
Copy link
Author

Additional comment as that was a concern in the other PR as well: make lint, make lint-ui and make docs all work for me out of the box

@tfenster
Copy link
Author

And a last one: I would of course also look at issues with devcontainers if support is merged into the main repo. But also just on a best effort basis. I already do some open source work and am active in a few communities, so I have some experience, but time is limited, to be honest

@andig
Copy link
Member

andig commented Oct 16, 2024

Tried to rebuild it:

[248942 ms] Start: Run in container: /bin/sh -c make install-ui && make install
fatal: detected dubious ownership in repository at '/workspaces/evcc'
To add an exception for this directory, call:

        git config --global --add safe.directory /workspaces/evcc
fatal: detected dubious ownership in repository at '/workspaces/evcc'
To add an exception for this directory, call:

        git config --global --add safe.directory /workspaces/evcc
npm ci
(node:942) ExperimentalWarning: Support for loading ES Module in require() is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)

Any idea what that it?

And (after restart):

vscode ➜ /workspaces/evcc $ ./evcc
bash: ./evcc: cannot execute binary file: Exec format error
vscode ➜ /workspaces/evcc $ make
fatal: detected dubious ownership in repository at '/workspaces/evcc'
To add an exception for this directory, call:

        git config --global --add safe.directory /workspaces/evcc
fatal: detected dubious ownership in repository at '/workspaces/evcc'
To add an exception for this directory, call:

        git config --global --add safe.directory /workspaces/evcc
npm run build

> build
> vite build

sh: 1: vite: not found
make: *** [Makefile:46: ui] Error 127

@tfenster
Copy link
Author

I guess the first problem breaks it. Are you running on Linux? Never saw this before. I found this https://www.kenmuse.com/blog/avoiding-dubious-ownership-in-dev-containers/ as potential solution

@andig
Copy link
Member

andig commented Oct 16, 2024

Running on Mac

@tfenster
Copy link
Author

@lippertmarkus would you have any idea why this breaks on a Mac?

@lippertmarkus
Copy link

lippertmarkus commented Oct 17, 2024

Seems to be related with the volume mount of the source code (unusual ownership & file modes). I have the same issue when opening the locally cloned repository in a devcontainer.

However, when using "Clone in volume" for the devcontainer instead it works for me (M1 Mac).

@tfenster
Copy link
Author

Ah, good pointer. @andig, did you use "clone in volume" or did you try the "open folder in container" option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Basic functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants