Commit c0e8fa84 authored by Aral Balkan's avatar Aral Balkan

Update readme

parent 9d297311
...@@ -12,10 +12,26 @@ Indie Web Server is a secure and seamless [Small Tech](https://ar.al/2019/03/04/ ...@@ -12,10 +12,26 @@ Indie Web Server is a secure and seamless [Small Tech](https://ar.al/2019/03/04/
[Watch a short 4-minute video](https://ar.al/2019/03/14/introducing-indie-web-server-video/) demonstrating how easy Indie Web Server is to install and use. [Watch a short 4-minute video](https://ar.al/2019/03/14/introducing-indie-web-server-video/) demonstrating how easy Indie Web Server is to install and use.
(Note: the video is about two weeks old and so it does not demonstrate the new `--live` feature for deployments. I will record a new one as soon as I find some time.) (Note: the video is about two weeks old and so it does not demonstrate the new `--live` feature for seamless deployments or the native binary distributions. I will record a new one as soon as I find some time.)
## Install ## Install
Copy and paste the following commands into your terminal:
### Linux
```
wget https://ind.ie/web-server/linux/7.2.0.zip && unzip 7.2.0.zip && chmod +x web-server && sudo mv web-server /usr/local/bin/
```
### macOS
```
wget https://ind.ie/web-server/macos/7.2.0.zip && unzip 7.2.0.zip && chmod +x web-server && sudo mv web-server /usr/local/bin/
```
### Node.js
```sh ```sh
npm i -g @ind.ie/web-server npm i -g @ind.ie/web-server
``` ```
...@@ -32,7 +48,7 @@ $ web-server ...@@ -32,7 +48,7 @@ $ web-server
### Staging ### Staging
Start serving the _site_ directory at your _hostname_ using globally-trusted Let’s Encrypt certificates: Start serving the _site_ directory at your _hostname_ as a regular process using globally-trusted Let’s Encrypt certificates:
```shell ```shell
$ web-server --staging site $ web-server --staging site
...@@ -42,13 +58,13 @@ For example, use [ngrok](https://ngrok.com/) (Pro+) with a custom domain name th ...@@ -42,13 +58,13 @@ For example, use [ngrok](https://ngrok.com/) (Pro+) with a custom domain name th
### Live ### Live
Start serving the _site_ directory at your _hostname_ as a daemon that will run at startup and be restarted if it crashes, etc.: Start serving the _site_ directory at your _hostname_ as a daemon that is automatically run at system startup and restarted if it crashes:
```shell ```shell
$ web-server --live site $ web-server --live site
``` ```
The `--live` option sets up your server to (re)start automatically when you server (re)starts (requires `sudo`) and/or crashes, etc. The `--live` option sets up your server to (re)start automatically when your server (re)starts and/or crashes, etc. Requires superuser privileges on first run to set up the launch item.
For example, if you run the command on a connected server that has the ar.al domain pointing to it and `ar.al` set in _/etc/hostname_ (on Unix/Linux/macOS), you will be able to access the site at https://ar.al. The first time you hit it, it will take a little longer to load as your Let’s Encrypt certificates are being automatically provisioned by ACME TLS. For example, if you run the command on a connected server that has the ar.al domain pointing to it and `ar.al` set in _/etc/hostname_ (on Unix/Linux/macOS), you will be able to access the site at https://ar.al. The first time you hit it, it will take a little longer to load as your Let’s Encrypt certificates are being automatically provisioned by ACME TLS.
...@@ -59,10 +75,12 @@ With a running live server, you can also use the following commands: ...@@ -59,10 +75,12 @@ With a running live server, you can also use the following commands:
- `--info`: Display detailed information about the server. - `--info`: Display detailed information about the server.
- `--offline`: Take the server offline and remove it from startup items. - `--offline`: Take the server offline and remove it from startup items.
The live server uses the [pm2](https://pm2.io/runtime/) process manager internally. Beyond the commands listed above that Indie Web Server proxies to pm2, you can make use of all pm2 functionality via the pm2 command directly should you need to. The live server uses the [pm2](https://pm2.io/runtime/) process manager internally. Beyond the commands listed above that Indie Web Server supports natively (and proxies to pm2), you can make use of all pm2 functionality via the pm2 command directly should you need to.
## Build and test from source ## Build and test from source
### Global Node.js module
```shell ```shell
# Clone and install. # Clone and install.
git clone https://source.ind.ie/hypha/tools/web-server.git git clone https://source.ind.ie/hypha/tools/web-server.git
...@@ -77,15 +95,56 @@ npm test ...@@ -77,15 +95,56 @@ npm test
web-server test/site web-server test/site
``` ```
### Native binaries
```shell
# Clone and install.
git clone https://source.ind.ie/hypha/tools/web-server.git
cd web-server
npm i # Install modules and development dependencies.
# Run unit tests.
npm test
# Build the native binaries
npm run build
# Serve the test site (visit https://localhost to view).
# e.g., To run the version 7.2.0 Linux binary:
dist/linux/7.2.0/web-server test/site
```
## Syntax ## Syntax
```sh ```shell
web-server [folder-to-serve] [--port N] [--global] [--version] web-server [folder-to-serve] [options]
``` ```
* __folder-to-serve:__ Path to the folder to serve (defaults to current folder).
### Options:
* __--port=N:__ The port to start the server on (defaults to 443).
* __--version:__ Display the version and exit.
* __--staging:__ Launch server as regular process with globally-trusted certificates.
* __--live:__ Launch server as startup daemon with globally-trusted certificates.
### With a running live server, you can also:
* __--monitor:__ Monitor the server.
* __--logs:__ Display and tail the server logs.
* __--info:__ Display detailed information about the server.
* __--offline:__ Take the server offline and remove it from startup items.
All command-line arguments are optional. By default, Indie Web Server will serve your current working folder over port 433 with locally-trusted certificates. All command-line arguments are optional. By default, Indie Web Server will serve your current working folder over port 433 with locally-trusted certificates.
If you specify the `--global` flag, globally-trusted Let’s Encrypt TLS certificates are automatically provisioned for you using ACME TLS the first time you hit your hostname. The hostname for the certificates is automatically set from the hostname of your system (and the _www._ subdomain is also automatically provisioned). If you launch with the `--staging` or `--global` options, globally-trusted Let’s Encrypt TLS certificates are automatically provisioned for you using ACME TLS the first time you hit your hostname. The hostname for the certificates is automatically set from the hostname of your system (and the _www._ subdomain is also automatically provisioned).
## Native 404 → 302 support for an evergreen web ## Native 404 → 302 support for an evergreen web
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment