nginx / unit-docs

NGINX Unit's official website and documentation
https://unit.nginx.org
Creative Commons Attribution 4.0 International
49 stars 97 forks source link

Homepage installation script one-liner #139

Open danielledeleo opened 1 month ago

danielledeleo commented 1 month ago

Part of improving the first touch experience. (See #137)

The NGINX Unit home page should prominently feature an easy way to get started with Unit.

Summary: we need a script that installs a CLI to control Unit and Unit itself. Our current scripts and guides are not suited to a one-liner.

Inspiration

rustup.rs offers a particularly spartan way to get going.

rustup.rs screenshot

Several ideas have been floated so far in private discussions in Unit team as to the best way to go from zero to serving requests with Unit.

Docker

Many production deployments of Unit use Docker, and it also happens to be a relatively simple way to get Unit onto developers' computers. We already have a fairly in-depth guide to running Unit in Docker, but it's not simple enough as is to be put on the home page as a one liner.

Current friction points when running Unit inside of Docker:

What this could look like today

rustup.rs screenshot

Questions:

Personally, I don't think the above image presents a great first touch experience, and I'd be thrown off if all that happened from a shell piped script.

Local install

These options could be displayed intelligently on the home page by reading the client user agent.

On macOS with Homebrew, we already have a very good one-liner:

brew install nginx/unit/unit

On Linux (including WSL), we have our existing setup-unit script:

wget https://raw.githubusercontent.com/nginx/unit/master/tools/setup-unit && chmod +x setup-unit
sudo ./setup-unit repo-config
# ... apt, yum, etc.

What's missing is a reasonable way to run something in Unit quickly.

Proposed Solution

curl --proto '=https' --tlsv1.2 -sSf https://<SOME_URL>/setup.sh | sh

What this script should do is out of scope for this issue. See (todo: link to CLI issue)

avahahn commented 4 weeks ago

I am a huge fan of having GH releases that offer a static compiled binary. I think if we can settle on a path forward for our CLI we can offer a CLI binary that will deploy docker containers of NGINX Unit into a user's environment, and even configure them automatically.

Then we dont have to tell users to curl scripts into their shell, but can still offer a really fast self-serve experience.

avahahn commented 4 weeks ago

Current friction points when running Unit inside of Docker: Control socket requires running curl inside the container (or restarting the container to pick up modified config file) unitc handles this problem in a clever way Users must manually compose images to get certain combinations of modules to work (PHP+Python+Wasm, e.g.) We used to provide -full images to get around this. Users have to get their application code into the container (usually a Docker --mount)

Can I ask when we stopped providing the full images and why? I figure a CLI could automatically mount a user's application project directory at time of deployment.