changelog.com icon indicating copy to clipboard operation
changelog.com copied to clipboard

Docker: Get ElixirLS fully working in dev

Open lawik opened this issue 4 years ago • 4 comments

Running the project on Docker has some inconsistencies. I'll try to note them as I go. This is one where we should make sure ElixirLS can run fully during development.

Gotta polish up the Docker way of running this stuff so Jerod can start using it ;)

{
	"resource": "/root/changelog.com/mix.exs",
	"owner": "_generated_diagnostic_collection_name_#0",
	"severity": 8,
	"message": "an exception was raised:\n    ** (Mix.Error)   Could not run `make`.\n  Please check if `make` and either `clang` or `gcc` are installed\n\n        /root/changelog.com/deps/cmark/mix.exs:88: Mix.Tasks.Compile.Cmark.run/1\n        (mix 1.10.3) lib/mix/task.ex:330: Mix.Task.run_task/3\n        (mix 1.10.3) lib/mix/tasks/compile.all.ex:76: Mix.Tasks.Compile.All.run_compiler/2\n        (mix 1.10.3) lib/mix/tasks/compile.all.ex:56: Mix.Tasks.Compile.All.do_compile/4\n        (mix 1.10.3) lib/mix/tasks/compile.all.ex:27: anonymous fn/2 in Mix.Tasks.Compile.All.run/1\n        (mix 1.10.3) lib/mix/tasks/compile.all.ex:43: Mix.Tasks.Compile.All.with_logger_app/2\n        (mix 1.10.3) lib/mix/task.ex:330: Mix.Task.run_task/3\n        (mix 1.10.3) lib/mix/tasks/compile.ex:96: Mix.Tasks.Compile.run/1",
	"source": "ElixirLS",
	"startLineNumber": 1,
	"startColumn": 1,
	"endLineNumber": 1,
	"endColumn": 1
}

lawik avatar Jul 25 '20 08:07 lawik

If you run Elixir / Phoenix in Docker then your local code editor with ElixirLS isn't going to be aware of the libraries installed inside of Docker, because ElixirLS's view of the world is based on your local file system.

VSCode gets around this by having a "remote containers" feature which runs a VSCode server inside of your container. It does this behind the scenes without you having to configure much beyond a few lines of JSON, but this feature isn't something that a lot of code editors support. I think Jetbrains' editors might do something to support Docker too but you'll be out of luck with Vim and most other editors.

nickjj avatar Jul 25 '20 09:07 nickjj

I'm on VSCode and I did install ElixirLS on my remote.. But hmm, I probably installed it on the server which runs my containers, not inside the containers.. Might work for normal people.

lawik avatar Jul 25 '20 10:07 lawik

I no longer use Docker. Pretty sure that @jerodsanto doesn't use it either. @adamstac might, but I'm less certain.

Instead of continuing down this path, should we capture instead the manual steps of how to configure a dev environment? The message from https://shipit.show/44 still rings strong: "Document, document, document".

I know that Jerod had to do this setup recently, and I have a new Mac ARM where I did not set this up yet, so maybe between the two of us we can knock something together that would address this issue, and all the other Docker-related ones.

What do you all think?

gerhard avatar Aug 23 '22 23:08 gerhard

I'm in favor of this, as long as we document on both macOS and Linux so that either path is 💯

jerodsanto avatar Aug 30 '22 20:08 jerodsanto

I've done the macOS path in this PR: https://github.com/thechangelog/changelog.com/pull/434/files#diff-eca12c0a30e25b4b46522ebf89465a03ba72a03f540796c979137931d8f92055R88-R135

Can someone help with the Linux version?

gerhard avatar Nov 15 '22 08:11 gerhard