Running your own Hex server

almirsarajcic

almirsarajcic

Created 7 months ago

Whatever the reason, you might want to run your local Hex server and install a dependency that way. Here’s a quick way to do it.

# prepare the dir
mkdir -p acme/public/tarballs

# build your package
mix hex.build

# host your package
cd acme
cp ../pack-0.1.0.tar public/tarballs/
openssl genrsa -out private_key.pem
mix hex.registry build public --name=acme --private-key=private_key.pem
mix hex.repo add acme http://localhost:8000 --public-key=public/public_key
erl -s inets -eval 'inets:start(httpd,[{port,8000},{server_name,"localhost"},{server_root,"."},{document_root,"public"}]).'

# add to mix.exs file
{:pack, "~> 0.1", repo: "acme"}

TA-DA 🎉

Here’s more about it: