Skip to content

Conversation

@tfenster
Copy link
Contributor

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
Contributor 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
Contributor 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
Contributor 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
Contributor 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
Contributor 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
Contributor Author

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

@andig
Copy link
Member

andig commented Oct 18, 2024

Open Folder. I did not get clone to work. It ends in a different error that I cannot copy out since its overlaid by a dialog box. That said: I don't have the need and do not personally care. Feels like building giga-byte Docker images takes longer than just installing the little tooling we need, at least if not running on Windows.
However: if people are happy with this we should merge it.

@tfenster
Copy link
Contributor Author

Great, thanks. I won't follow all issues here, but if anything comes up related to devcontainers, please let me know

@andig andig merged commit 04721ef into evcc-io:master Oct 18, 2024
6 checks passed
@andig
Copy link
Member

andig commented Oct 18, 2024

Cloning repo into container:

Screenshot 2024-10-18 at 18 16 44

@tfenster
Copy link
Contributor Author

Very weird and as I can't repro, I struggle a bit. I'll try to find someone with a Mac...

@lippertmarkus
Copy link

Also can't repro on my Mac

naltatis pushed a commit that referenced this pull request Oct 24, 2024
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