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

Allow the server to be downloaded outside of an editor #159

Open
mesa123123 opened this issue Oct 23, 2020 · 11 comments
Open

Allow the server to be downloaded outside of an editor #159

mesa123123 opened this issue Oct 23, 2020 · 11 comments

Comments

@mesa123123
Copy link

Is your feature request related to a problem? Please describe.

I'm working behind a proxy and vscode's relationship with it is temperamental at best...
However working through the browser works just fine, so being able to download server files as a whole works well.
Describe the solution you'd like

The ability to click a download button, download the metals server and then be able to connect the editors i like to said server.
If this is already possible I'd like documentation that shows me how to do it
image
This is very sparse and doesn't help in the least
Describe alternatives you've considered

Working through vscode which just causes the editor to whine about how it can't download the server
Additional context

Search terms:

@ckipp01
Copy link
Member

ckipp01 commented Oct 23, 2020

Thanks for the feature request. Have you taken a look at the portion of the site about proxies and mirrors? There is quite a bit of information there that can guide you through the process. Since Metals if fully reliant on Coursier here, have you also taken a look at the linked Coursier Proxy information?

An alternative installation method that we would recommend would just be to use Coursier manually, so you'll probably run into the same issues that you're having. Please read through those pages and feel free to ask for help on anything you're getting stuck on.

@ckipp01
Copy link
Member

ckipp01 commented Nov 29, 2020

Have you gotten a chance to read through those pages and see if it solves your issue @mesa123123?

@Geronium
Copy link

Geronium commented Jan 21, 2021

hello, thanks for your advices tgodzik, i followed what you said, and i'm again lock with an error, when i run this step

Step 23/23 : RUN ./cs -J-Dhttps.proxyHost=myproxyip -J-Dhttps.proxyPort=myproxyport launch org.scalameta:metals_2.12:0.9.10 -M scala.meta.metals.DownloadDependencies

"
...................
Downloading https://repo1.maven.org/maven2/org/openjdk/jol/jol-core/0.14/jol-core-0.14.jar
Downloaded https://repo1.maven.org/maven2/org/scalameta/fastparse-utils_2.12/1.0.1/fastparse-utils_2.12-1.0.1.jar
Downloading https://repo1.maven.org/maven2/com/lihaoyi/ujson_2.12/1.2.2/ujson_2.12-1.2.2.jar
Downloaded https://repo1.maven.org/maven2/org/openjdk/jol/jol-core/0.14/jol-core-0.14.jar
Downloading https://repo1.maven.org/maven2/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.jar
Downloaded https://repo1.maven.org/maven2/com/lihaoyi/ujson_2.12/1.2.2/ujson_2.12-1.2.2.jar
Downloaded https://repo1.maven.org/maven2/com/google/guava/guava/30.1-jre/guava-30.1-jre.jar
Downloaded https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.6.0/jna-5.6.0.jar
Downloaded https://repo1.maven.org/maven2/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.jar
Downloaded https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.12.13/scala-library-2.12.13.jar
Downloaded https://repo1.maven.org/maven2/ch/epfl/scala/bloop-launcher_2.12/1.4.6-21-464e4ec4/bloop-launcher_2.12-1.4.6-21-464e4ec4.jar
2021.01.21 15:24:06 INFO Downloading mdoc
Exception in thread "main" coursierapi.error.SimpleResolutionError$1: Error downloading org.scalameta:mdoc_2.13:2.2.15
not found: /root/.ivy2/local/org.scalameta/mdoc_2.13/2.2.15/ivys/ivy.xml
download error: Caught java.net.UnknownHostException: repo1.maven.org (repo1.maven.org) while downloading https://repo1.maven.org/maven2/org/scalameta/mdoc_2.13/2.2.15/mdoc_2.13-2.2.15.pom
download error: Caught java.net.UnknownHostException: oss.sonatype.org (oss.sonatype.org) while downloading https://oss.sonatype.org/content/repositories/public/org/scalameta/mdoc_2.13/2.2.15/mdoc_2.13-2.2.15.pom
download error: Caught java.net.UnknownHostException: oss.sonatype.org (oss.sonatype.org) while downloading https://oss.sonatype.org/content/repositories/snapshots/org/scalameta/mdoc_2.13/2.2.15/mdoc_2.13-2.2.15.pom
at coursierapi.error.SimpleResolutionError.of(SimpleResolutionError.java:11)
at coursierapi.shaded.coursier.internal.api.ApiHelper$.simpleResError(ApiHelper.scala:326)
at coursierapi.shaded.coursier.internal.api.ApiHelper$.doFetch(ApiHelper.scala:359)
at coursierapi.shaded.coursier.internal.api.ApiHelper.doFetch(ApiHelper.scala)
at coursierapi.Fetch.fetchResult(Fetch.java:244)
at coursierapi.Fetch.fetch(Fetch.java:239)
at scala.meta.internal.metals.Embedded$.downloadDependency(Embedded.scala:213)
at scala.meta.internal.metals.Embedded$.downloadMdoc(Embedded.scala:246)
at scala.meta.metals.DownloadDependencies$.$anonfun$downloadMdoc$2(DownloadDependencies.scala:51)
at scala.collection.immutable.List.foreach(List.scala:431)
at scala.meta.metals.DownloadDependencies$.downloadMdoc(DownloadDependencies.scala:50)
at scala.meta.metals.DownloadDependencies$.main(DownloadDependencies.scala:28)
at scala.meta.metals.DownloadDependencies.main(DownloadDependencies.scala)
"

if someone have an idea.

thanks

@Geronium
Copy link

Geronium commented Jan 21, 2021

ok after one day, i finally find, we need to use the previous method for the proxy, with the coursier.jar

RUN java -Dhttps.proxyHost=ipproxy -Dhttps.proxyPort=port-proxy -jar ./coursier.jar launch org.scalameta:metals_2.12:0.9.10 -M scala.meta.metals.DownloadDependencies

i don't why, with the new method, that's look like after the info, we lost the proxy parameters.

thank you

@Geronium
Copy link

Geronium commented Jan 22, 2021

(bis repetita)

My docker build finished without error, but i have the same problem, does i need to add parameters ? maybe a target directory for the extension ?

error

"Java home: /usr/lib/jvm/jre-1.8.0-openjdk
Metals version: 0.9.10
Error while downloading https://repo1.maven.org/maven2/com/github/alexarchambault/case-app-util_2.12/2.0.0-M9/case-app-util_2.12-2.0.0-M9.jar: repo1.maven.org, ignoring it
Error while downloading https://repo1.maven.org/maven2/com/github/alexarchambault/case-app-annotations_2.12/2.0.0-M9/case-app-annotations_2.12-2.0.0-M9.jar: repo1.maven.org, ignoring it
Error while downloading https://repo1.maven.org/maven2/com/chuusai/shapeless_2.12/2.3.3/shapeless_2.12-2.3.3.jar: repo1.maven.org, ignoring it
Error while downloading https://repo.typesafe.com/typesafe/ivy-releases/com.lightbend/emoji_2.12/1.2.1/jars/emoji_2.12.jar: repo.typesafe.com, ignoring it"

my dockerfile

RUN yum install -y java-1.8.0-openjdk.x86_64
RUN echo "export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk" >> /etc/profile
RUN echo "export JRE_HOME=/usr/lib/jvm/jre" >> /etc/profile
RUN source /etc/profile
RUN yum install -y wget
RUN wget https://downloads.lightbend.com/scala/2.12.13/scala-2.12.13.rpm
RUN yum install -y scala-2.12.13.rpm
RUN curl -sL https://rpm.nodesource.com/setup_15.x | bash -
RUN yum install -y nodejs
RUN yum clean packages
RUN /opt/code-server/code-server-3.2.0-linux-x86_64/code-server --extensions-dir /opt/code-server/code-server-3.2.0-linux-x86_64/extensions --install-extension ms-python.python
RUN /opt/code-server/code-server-3.2.0-linux-x86_64/code-server --extensions-dir /opt/code-server/code-server-3.2.0-linux-x86_64/extensions --install-extension scalameta.metals**
RUN /opt/code-server/code-server-3.2.0-linux-x86_64/code-server --extensions-dir /opt/code-server/code-server-3.2.0-linux-x86_64/extensions --install-extension formulahendry.code-runner
RUN /opt/code-server/code-server-3.2.0-linux-x86_64/code-server --extensions-dir /opt/code-server/code-server-3.2.0-linux-x86_64/extensions --install-extension tushortz.python-extended-snippets
RUN /opt/code-server/code-server-3.2.0-linux-x86_64/code-server --extensions-dir /opt/code-server/code-server-3.2.0-linux-x86_64/extensions --install-extension cymonk.sql-formatter
RUN python -m pip install pylint
RUN curl -fLo cs https://git.io/coursier-cli-"$(uname | tr LD ld)"
RUN chmod +x cs
RUN curl -fLo coursier.jar https://github.com/coursier/coursier/releases/download/v2.0.9/coursier.jar
RUN java -Dhttps.proxyHost=ipproxy -Dhttps.proxyPort=portproxy -jar ./coursier.jar install --only-prebuilt=true bloop
RUN java -Dhttps.proxyHost=ipproxy -Dhttps.proxyPort=portproxy -jar ./coursier.jar install sbt
#RUN java -Dhttps.proxyHost=ipproxy -Dhttps.proxyPort=portproxy -jar ./coursier.jar launch org.scalameta:metals_2.12:0.9.10 -M scala.meta.metals.DownloadDependencies
RUN java -Dhttps.proxyHost=ipproxy -Dhttps.proxyPort=portproxy -jar ./coursier.jar fetch org.scalameta:metals_2.12:0.9.10
RUN java -Dhttps.proxyHost=ipproxy -Dhttps.proxyPort=portproxy -jar ./coursier.jar fetch org.scalameta:scalafmt-cli_2.12:2.7.5
RUN java -Dhttps.proxyHost=ipproxy -Dhttps.proxyPort=portproxy -jar ./coursier.jar launch org.scalameta:metals_2.12:0.9.10 -M scala.meta.metals.DownloadDependencies

RUN ls -a /

Thanks again

@tgodzik
Copy link
Contributor

tgodzik commented Jan 22, 2021

Looks like it might be coursier bootstrap trying to download itself - https://github.com/scalameta/metals-vscode/blob/master/coursier

Maybe it would be possible to invoke coursier inside the vscode extension? Something like:
RUN ~/.vscode/extensions/scalameta.metals-1.9.13/coursier
?

Coursier bootstrap is this minimal jar that we use to keep the extension size small. More info here: https://get-coursier.io/docs/cli-bootstrap.

@Geronium
Copy link

Geronium commented Jan 22, 2021

Hello, done, and it doesnt work, the jar are in the /root/.cache

[root@fd92172c3406 /]# locate case-app-util_2.12-2.0.0-M9.jar
/root/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/alexarchambault/case-app-util_2.12/2.0.0-M9/case-app-util_2.12-2.0.0-M9.jar
[root@fd92172c3406 /]#

the dockerfile

RUN yum install -y java-1.8.0-openjdk.x86_64
RUN echo "export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk" >> /etc/profile
RUN echo "export JRE_HOME=/usr/lib/jvm/jre" >> /etc/profile
RUN source /etc/profile
RUN yum install -y wget
RUN wget https://downloads.lightbend.com/scala/2.12.13/scala-2.12.13.rpm
RUN yum install -y scala-2.12.13.rpm
RUN curl -sL https://rpm.nodesource.com/setup_15.x | bash -
RUN yum install -y nodejs
RUN yum clean packages
RUN /opt/code-server/code-server-3.2.0-linux-x86_64/code-server --extensions-dir /opt/code-server/code-server-3.2.0-linux-x86_64/extensions --install-extension ms-python.python
RUN /opt/code-server/code-server-3.2.0-linux-x86_64/code-server --extensions-dir /opt/code-server/code-server-3.2.0-linux-x86_64/extensions --install-extension scalameta.metals
RUN /opt/code-server/code-server-3.2.0-linux-x86_64/code-server --extensions-dir /opt/code-server/code-server-3.2.0-linux-x86_64/extensions --install-extension formulahendry.code-runner
RUN /opt/code-server/code-server-3.2.0-linux-x86_64/code-server --extensions-dir /opt/code-server/code-server-3.2.0-linux-x86_64/extensions --install-extension tushortz.python-extended-snippets
RUN /opt/code-server/code-server-3.2.0-linux-x86_64/code-server --extensions-dir /opt/code-server/code-server-3.2.0-linux-x86_64/extensions --install-extension cymonk.sql-formatter
RUN python -m pip install pylint
RUN cd /opt/code-server/code-server-3.2.0-linux-x86_64/extensions/scalameta.metals-1.9.13 && java -Dhttps.proxyHost=iprpoxy -Dhttps.proxyPort=portproxy -jar coursier launch org.scalameta:metals_2.12:0.9.10 -M scala.meta.metals.DownloadDependencies

Thanks again

@tgodzik
Copy link
Contributor

tgodzik commented Jan 22, 2021

Not sure then, maybe you could replace the minimal bootstrap with a full coursier boostrap, that will not need to download anything? You would need to replace the coursier in the extension directory.

Alternatively we could add a parameter for specifying coursier in Metals vscode extension or maybe have an alternative extension with everything packaged 🤔

@Geronium
Copy link

Geronium commented Jan 22, 2021

hello, thank you for your support, so i downloaded this version of coursier

https://github.com/coursier/coursier/releases/download/v2.0.9/coursier.jar

v2.0.9 (32 Mo)

en i did an mv to replace the previous coursier inside the directory extension

mv /opt/code-server/code-server-3.2.0-linux-x86_64/extensions/scalameta.metals-1.9.13/coursier.jar /opt/code-server/code-server-3.2.0-linux-x86_64/extensions/scalameta.metals-1.9.13/coursier

After that, when i run vscode, i have this error

Java home: /usr/lib/jvm/jre-1.8.0-openjdk
Metals version: 0.9.10
Downloading https://repo1.maven.org/maven2/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
Downloaded https://repo1.maven.org/maven2/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
Downloading https://repo1.maven.org/maven2/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom.sha1
Downloaded https://repo1.maven.org/maven2/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom.sha1
Downloading https://dl.bintray.com/scalacenter/releases/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
Downloaded https://dl.bintray.com/scalacenter/releases/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
Downloading https://dl.bintray.com/scalacenter/releases/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom.sha1
Downloaded https://dl.bintray.com/scalacenter/releases/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom.sha1
Downloading https://oss.sonatype.org/content/repositories/public/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
Downloaded https://oss.sonatype.org/content/repositories/public/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
Downloading https://oss.sonatype.org/content/repositories/public/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom.sha1
Downloaded https://oss.sonatype.org/content/repositories/public/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom.sha1
Downloading https://oss.sonatype.org/content/repositories/snapshots/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
Downloaded https://oss.sonatype.org/content/repositories/snapshots/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
Downloading https://oss.sonatype.org/content/repositories/snapshots/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom.sha1
Downloaded https://oss.sonatype.org/content/repositories/snapshots/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom.sha1
Downloading https://repo1.maven.org/maven2/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
Downloaded https://repo1.maven.org/maven2/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
Downloading https://repo1.maven.org/maven2/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom.sha1
Downloaded https://repo1.maven.org/maven2/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom.sha1
Downloading https://dl.bintray.com/scalacenter/releases/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
Downloaded https://dl.bintray.com/scalacenter/releases/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
Downloading https://dl.bintray.com/scalacenter/releases/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom.sha1
Downloaded https://dl.bintray.com/scalacenter/releases/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom.sha1
Downloading https://oss.sonatype.org/content/repositories/public/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
Downloaded https://oss.sonatype.org/content/repositories/public/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
Downloading https://oss.sonatype.org/content/repositories/public/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom.sha1
Downloaded https://oss.sonatype.org/content/repositories/public/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom.sha1
Downloading https://oss.sonatype.org/content/repositories/snapshots/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
Downloaded https://oss.sonatype.org/content/repositories/snapshots/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
Downloading https://oss.sonatype.org/content/repositories/snapshots/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom.sha1
Downloaded https://oss.sonatype.org/content/repositories/snapshots/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom.sha1
Resolution error: Error downloading org.scalameta:metals_2.12:0.9.10
not found: /home/test/.ivy2/local/org.scalameta/metals_2.12/0.9.10/ivys/ivy.xml
download error: Caught java.net.UnknownHostException: repo1.maven.org (repo1.maven.org) while downloading https://repo1.maven.org/maven2/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
download error: Caught java.net.UnknownHostException: dl.bintray.com (dl.bintray.com) while downloading https://dl.bintray.com/scalacenter/releases/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
download error: Caught java.net.UnknownHostException: oss.sonatype.org (oss.sonatype.org) while downloading https://oss.sonatype.org/content/repositories/public/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom
download error: Caught java.net.UnknownHostException: oss.sonatype.org (oss.sonatype.org) while downloading https://oss.sonatype.org/content/repositories/snapshots/org/scalameta/metals_2.12/0.9.10/metals_2.12-0.9.10.pom

@tgodzik
Copy link
Contributor

tgodzik commented Jan 22, 2021

Weirdly enough it seem to be looking only in ivy and not tin the coursier cache, maybe that's the problem?

@Geronium
Copy link

maybe because the coursier cache is in /root/

/root/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/alexarchambault/case-app-util_2.12/2.0.0-M9/case-app-util_2.12-2.0.0-M9.jar

and i'm using and other user "test" and the home directory is /home/test

i need to copy .cache/coursier/v1/https/repo1.maven.org/maven2/com/github/alexarchambault/case-app-util_2.12/2.0.0-M9/case-app-util_2.12-2.0.0-M9.jar

inside the home directory of the user ?

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

No branches or pull requests

4 participants