Run mix phx.gen.cert without adding phoenix as a project dependency?

I’m looking for a convenient way to generate ssl certificates for local testing but the openssl config is horrible.

I’d like to be able to do two things, generate ssl certs and Root CA that I would install on containers/vms - something like lets encrypt but without having to talk to any online service from my datacentre.

I’ve found run mix phx.gen.cert but don’t know what dependency to use.

Goal is to make an easy to run HTTPS server but packaged a bit more neatly than this guide - https://tech.labs.oliverwyman.com/blog/2018/01/23/a-basic-recipe-for-an-elixir-ssl-server/ - goal is just to have something that can be run in a container and used whenever I want a HTTPS proxy for testing.

I think I’ve found what I was looking for, the canonical elixir plug guide gives a good explanation.

Ok - third question - is it possible to run the phoenix task directly without having to create a new phoenix project, anyone done this before?

Phoenix is open source software. You can just use the code.

1 Like

If you just want to make yourself some cert keys and identities, I have a checklist set of directions in the readme here: https://github.com/ityonemo/pony_express/blob/master/README.md

1 Like

that bit is fine - couldn’t find an example of how to package a downloadable hex task

thanks, nice resource for this sort of scaffolding

Just had to run this for GRPC plugin - will copy the protobuf library layout for the script :

# mix escript.install hex protobuf 
Resolving Hex dependencies...
Dependency resolution completed:
New:
  protobuf 0.6.3
* Getting protobuf (Hex package)
All dependencies are up to date
Compiling 20 files (.ex)
Generated protobuf app
Generated escript protoc-gen-elixir with MIX_ENV=prod
Are you sure you want to install "protoc-gen-elixir"? [Yn] Y
* creating xxxxxxxxx.asdf/installs/elixir/1.9.4-otp-22/.mix/escripts/protoc-gen-elixir