thiagohdeplima

thiagohdeplima

Self hosted hex repo

My team is building various micro-services using elixir.

Some of needs of systems is shared (for example: authentication).

To not duplicate code in each system, we create a some libraries implementing shared code between systems. This libraries contains business rules, therefore, not be open-sourced.

I would like create a private repository in our infrastructure, but, I dont find a documentation wich describe the process of it to me.

Analising the mix deps.get behavior, I see it gets packages from repo.hex.pm, which in turn is a S3 bucket, therefore, I conclude that it is not very hard.

Can someone help-me to found the documentation about it?

Most Liked

aseigo

aseigo

There is good documentation at https://hex.pm itself. You can host your own internal installation of hexpm (it’s a Phoenix app, yay! :slight_smile: ) and then you can use the :repo option in the relevant depencies in the mix.exs file as noted in the docs here.

zazaian

zazaian

Apparently I’m still locked on this topic - @wojtekmach introduced MiniRepo roughly three months ago which looks like a good way to get a quick, private hex server up and running if cloning and deploying all of hex.pm proves to be overkill.

That said, I’ve found @ericmj and the hex.pm team to be extremely helpful and supportive. Seems like any of the above options will work well. Really just depends on personal preferences.

josevalim

josevalim

Creator of Elixir

Git works if you have one or two packages but at the moment you have multiple packages and they depend each other, Hex private is probably the best option since we can’t perform dependency resolution on top of Git.

zazaian

zazaian

One more note here - I recently spent a couple of hours digging through the hex.pm application source code and deploying the application locally. While it’s pretty easy to get it going in development, the prod environment has a few runtime dependencies for services like a Fastly-backed CDN, Rollbar error handling, AWS credentials for S3 access, and mailer credentials, which may be overkill for a small internal deployment.

Here is the full scope of the environment variables required by a production release:

import Config

config :hexpm,
  secret: System.fetch_env!("HEXPM_SECRET"),
  private_key: System.fetch_env!("HEXPM_SIGNING_KEY"),
  s3_bucket: System.fetch_env!("HEXPM_S3_BUCKET"),
  docs_bucket: System.fetch_env!("HEXPM_DOCS_BUCKET"),
  logs_buckets: System.fetch_env!("HEXPM_LOGS_BUCKETS"),
  docs_url: System.fetch_env!("HEXPM_DOCS_URL"),
  cdn_url: System.fetch_env!("HEXPM_CDN_URL"),
  email_host: System.fetch_env!("HEXPM_EMAIL_HOST"),
  ses_rate: System.fetch_env!("HEXPM_SES_RATE"),
  fastly_key: System.fetch_env!("HEXPM_FASTLY_KEY"),
  fastly_hexrepo: System.fetch_env!("HEXPM_FASTLY_HEXREPO"),
  billing_key: System.fetch_env!("HEXPM_BILLING_KEY"),
  billing_url: System.fetch_env!("HEXPM_BILLING_URL"),
  levenshtein_threshold: System.fetch_env!("HEXPM_LEVENSHTEIN_THRESHOLD")

config :ex_aws,
  access_key_id: System.fetch_env!("HEXPM_AWS_ACCESS_KEY_ID"),
  secret_access_key: System.fetch_env!("HEXPM_AWS_ACCESS_KEY_SECRET")

config :rollbax,
  access_token: System.fetch_env!("HEXPM_ROLLBAR_ACCESS_TOKEN")

config :kernel,
  inet_dist_listen_min: String.to_integer(System.fetch_env!("BEAM_PORT")),
  inet_dist_listen_max: String.to_integer(System.fetch_env!("BEAM_PORT"))

Hex.pm releases are also configured for Docker by default, backed by Kubernetes, which may additionally prove overkill for a smaller setup with a handful of users. That said, bootstrapping an edeliver config is not difficult for this setup and was easy to get going.

chulkilee

chulkilee

Another option: use git (if you use git :slight_smile: )

You can specify git url and ref/tag (see git options), or use submodule with path option.

There is also Private packages in Hex (currently in beta), which has different pros & cons.

From my experience on using private repo for ruby gem… git way is much simpler since you can use git+ssh authentication like the main repo. There are some benefits of having private package repo for backup and audit purpose, but that usually applies only when you fetch all packages from the repo.

There is already a request to support hex on Artifactory - RTFACT-14011: Support for Erlang “hex” repos.

Where Next?

Popular in Questions Top

pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

Other popular topics Top

yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New

We're in Beta

About us Mission Statement