Erlang/Elixir UPYUN 支持 Elixir hex.pm 国内镜像

jsvisa · November 18, 2016 · Last by belltoy replied at January 06, 2021 · 12375 hits

最近 Elixir 语言使用者不少,Elixir 使用 Hex 管理依赖,但是这个站点的数据默认是放在 S3 上面,在国内使用会比较吃力,Elixir 作为一门优秀的语言,我们觉得有必要反馈给社区一些资源,于是乎最近我们向老大申请了 https://hexpm.upyun.com 作为 https://repo.hex.pm 的国内镜像站点,各位可以放心使用我们的资源,使用方法请参见 https://hex.pm/docs/mirrors 官方说明,或者配置下列环境变量:

export HEX_MIRROR="https://hexpm.upyun.com"
export HEX_CDN="https://hexpm.upyun.com"

如果遇到下面问题:

** (Mix) Could not verify authenticity of fetched registry file. This may happen because a proxy or some entity is interfering with the download or because you don't have a public key to verify the registry.

You may try again later or check if a new public key has been released in our public keys page: https://hex.pm/docs/public_keys

请先运行 mix local.hex,参见 #reply16

👍🏼 虽然我一直都用 jsDelivr,国内访问挺好的

赞!(PS: 妈蛋,国内什么都要镜像加速)

UPYUN 也在用 Elixir 吧

支持,提示下,如果遇到下面这个错误,先运行下 mix local.hex

** (Mix) Could not verify authenticity of fetched registry file. This may happen because a proxy or some entity is interfering with the download or because you don't have a public key to verify the registry.

You may try again later or check if a new public key has been released in our public keys page: https://hex.pm/docs/public_keys

#15 楼 @lidashuang 我们线上的存储系统使用了 Erlang, 存储和 CDN 中间的接入层使用了 Elixir

#19 楼 @jsvisa 多谢这个服务,用了两天很稳定

赞!我自己架的镜像终于可以退休了!@jsvisa 如果有计划长期更新的话,可以提个 pr 更新到 https://hex.pm/docs/mirrors 。最下面那个 China 的是我搞的,直接替换掉就好了!

@falood 已经给官方提了 PR,已经合并但还没更新到线上,你们那个先留着,或者你们另外提个 PR 去除吧😄

#24 楼 @jsvisa cool! PR 已提 :D 瞬间感觉轻松了好多,每天都担心我的镜像会不会挂掉。。。

使用这个源后,经常遇到 edeliver 安装不上的问题。卡在这里:

Package cf-0.2.1 not found. Fetching registry updates and trying again

目前使用上了,比一个月前好多了,整体 rebar3 编译都 ok 非常感谢

hexpm/hex今天更新到了0.16.0,原HEX_MIRROR及mirror_url等写法已经不支持了。 可用 mix hex.repo 方式改变仓库源。写法详见https://hex.pm/docs/tasks#hex_repo, 简单的方式可以直接将 hexpm 地址改为 upyun,如下

mix hex.repo set url hexpm https://hexpm.upyun.com
Reply to wlchn

谢谢,解决了大问题

34#更新:hex最新版本到了hex-0.17.1,设置upyun的命令有所改变:

mix hex.repo set hexpm --url https://hexpm.upyun.com

@jsvisa 想搭建一个公司级镜像站点,该怎么做呢?

https://s3.amazonaws.com/s3.hex.pm/tarballs 对应我们这镜像的地址是啥呀

我这边有代码写死这种地址,我想换成国内的地址

这个是不是不能用了?报一堆的

:failed_connect, [{:to_address, {'hexpm.upyun.com', 443}}, {:inet, [:inet], {:tls_alert, {:handshake_failure, 'TLS client: In state certify at ssl_handshake.erl:1840 generated CLIENT ALERT: Fatal - Handshake Failure\n {bad_cert,hostname_check_failed}'}}}]

这样的错误。

Reply to chriszou

http://hexpm.upyun.com 可以,不知道是不是证书的问题

刚在 awschina 上装了一下,以下方法可行

下载 hex, rebar 和 rebar3 到自己电脑上,scp 到服务器后在本地安装

hex: https://repo.hex.pm/installs/1.10.0/hex-0.20.5.ez
rebar: https://repo.hex.pm/installs/1.0.0/rebar
rebar3: https://repo.hex.pm/installs/1.0.0/rebar3

mix archive.install ./hex-0.20.5.ez
mix local.rebar rebar ./rebar
mix local.rebar rebar3 ./rebar3

安装依赖

HEX_MIRROR=http://hexpm.upyun.com mix deps.get

@jsvisa https://hexpm.upyun.com/ 还维护着吗?昨天 publish 了一个 package,今天也没拉到更新

--------- 更新 ----------
package 更新到了,貌似就是 SSL 证书有问题了,现在只能用 http 协议

今天下载plug_crypto-1.1.2.tar时报 504

Reply to Aetherus

我后来在服务器上装代理了。。。

Reply to goofansu

我通常用 docker 发布的。ARG http_proxy 已经成了标配了 😅

Reply to goofansu

我一直是用 export HEX_UNSAFE_HTTPS=1 就可以了

这个问题确实是和证书有关,但不是 UPYUN 证书的问题,UPYUN 镜像用的证书是用通配符的。

目前的 hex 版本下用 https://hexpm.upyun.com 是有问题的。原因是 OTP 23 开始 hex 的实现没更新。 https://github.com/hexpm/hex/issues/797 这个 issue 提到了,也修复了。但问题是目前 elixir 带的 hex 版本是 0.20.5,最新的 hex 版本是 0.20.6,而这个修复并没有放在 0.20.6 上,而是放在了 main 分支上,还没有发布,所以就算用 mix local.hex 来更新也只能更新到 0.20.6,解决不了问题。而且 main 主分支并不稳定,不合适直接安装 main 的最新 commit。

如果要用 UPYUN 镜像(或者自建通配符证书的仓库),现在的解决方法一是用 http,另一种方法是手动更新 hex 到这个修复的 commit

mix archive.install github hexpm/hex ref 6d7ff1236

等之后官方 release 了这个修复到最新的发布版本,用 mix local.hex 更新就行了。

UPDATE: 更新到 0.21 以上就好了。

You need to Sign in before reply, if you don't have an account, please Sign up first.