FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GitHub Viewer

# solid-server in Node [![](https://img.shields.io/badge/project-Solid-7C4DFF.svg?style=flat-square)](https://github.com/solid/solid) [![Build Status](https://travis-ci.org/solid/node-solid-server.svg?branch=master&style=flat-square)](https://travis-ci.org/solid/node-solid-server) [![NPM Version](https://img.shields.io/npm/v/solid-server.svg?style=flat-square)](https://npm.im/solid-server) [![Gitter chat](https://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg?style=flat-square)](http://gitter.im/solid/node-solid-server) > [Solid](https://github.com/solid) server in [NodeJS](https://nodejs.org/) `solid-server` lets you run a Solid server on top of the file-system. You can use it as a [command-line tool](https://github.com/solid/node-solid-server/blob/master/README.md#command-line-usage) (easy) or as a [library](https://github.com/solid/node-solid-server/blob/master/README.md#library-usage) (advanced). The [solid test suite](https://github.com/nodeSolidServer/node-solid-server/blob/main/test/surface/run-solid-test-suite.sh) runs as part of GitHub Actions on this repository, ensuring that this server is always (to the best of our knowledge) fully spec compliant. ## Solid Features supported - [x] [Linked Data Platform](http://www.w3.org/TR/ldp/) - [x] [Web Access Control](http://www.w3.org/wiki/WebAccessControl) - [x] [WebID+TLS Authentication](https://www.w3.org/2005/Incubator/webid/spec/tls/) - [x] [Real-time live updates](https://github.com/solid/solid-spec#subscribing) (using WebSockets) - [x] Identity provider for WebID - [x] CORS proxy for cross-site data access - [x] Group members in ACL - [x] Email account recovery ## Command Line Usage ### Install You can install and run the server either using Node.js directly or using [Docker](https://www.docker.com/). This and the following sections describe the first approach, for the second approach see the section [use Docker](#use-docker) Section below. **Note**: If using Git for Windows, it is helpful to use the -verbose flag to see the progress of the install. To install, first install [Node](https://nodejs.org/en/) and then run the following ```bash $ npm install -g solid-server ``` ### Run a single-user server (beginner) The easiest way to setup `solid-server` is by running the wizard. This will create a `config.json` in your current folder ```bash $ solid init ``` **Note**: If prompted for an SSL key and certificate, follow the instructions below. To run your server, simply run `solid start`: ```bash $ solid start # Solid server (solid v0.2.24) running on https://localhost:8443/ ``` If you prefer to use flags instead, the following would be the equivalent ```bash $ solid start --port 8443 --ssl-key path/to/ssl-key.pem --ssl-cert path/to/ssl-cert.pem # Solid server (solid v0.2.24) running on https://localhost:8443/ ``` If you want to run `solid` on a particular folder (different from the one you are in, e.g. `path/to/folder`): ```bash $ solid start --root path/to/folder --port 8443 --ssl-key path/to/ssl-key.pem --ssl-cert path/to/ssl-cert.pem # Solid server (solid v0.2.24) running on https://localhost:8443/ ``` By default, `solid` runs in `debug all` mode. To stop the debug logs, use `-q`, the quiet parameter. ```bash $ DEBUG="solid:*" solid start -q # use quiet mode and set debug to all # DEBUG="solid:ACL" logs only debug.ACL's ``` ### Running in development environments Solid requires SSL certificates to be valid, so you cannot use self-signed certificates. To switch off this security feature in development environments, you can use the `bin/solid-test` executable, which unsets the `NODE_TLS_REJECT_UNAUTHORIZED` flag and sets the `rejectUnauthorized` option. If you want to run in multi-user mode on localhost, do the following: * configure the server as such with `bin/solid-test init` * start the server with `bin/solid-test start` * visit https://localhost:8443 and register a user, for instance 'myusername'. * Edit your hosts file and add a line `127.0.0.1 myusername.localhost` * Now you can visit https://myusername.localhost:8443. ##### How do I get an SSL key and certificate? You need an SSL certificate from a _certificate authority_, such as your domain provider or [Let's Encrypt!](https://letsencrypt.org/getting-started/). For testing purposes, you can use `bin/solid-test` with a _self-signed_ certificate, generated as follows: ``` $ openssl req -outform PEM -keyform PEM -new -x509 -sha256 -newkey rsa:2048 -nodes -keyout ../privkey.pem -days 365 -out ../fullchain.pem ``` Note that this example creates the `fullchain.pem` and `privkey.pem` files in a directory one level higher from the current, so that you don't accidentally commit your certificates to `solid` while you're developing. If you would like to get rid of the browser warnings, import your fullchain.pem certificate into your 'Trusted Root Certificate' store. ### Running Solid behind a reverse proxy (such as NGINX) See [Running Solid behind a reverse proxy](https://github.com/solid/node-solid-server/wiki/Running-Solid-behind-a-reverse-proxy). ### Run multi-user server (intermediate) You can run `solid` so that new users can sign up, in other words, get their WebIDs _username.yourdomain.com_. Pre-requisites: - Get a [Wildcard Certificate](https://en.wikipedia.org/wiki/Wildcard_certificate) - Add a Wildcard DNS record in your DNS zone (e.g.`*.yourdomain.com`) - (If you are running locally) Add the line `127.0.0.1 *.localhost` to `/etc/hosts` ```bash $ solid init .. ? Allow users to register their WebID (y/N) # write `y` here .. $ solid start ``` Otherwise, if you want to use flags, this would be the equivalent ```bash $ solid start --multiuser --port 8443 --ssl-cert /path/to/cert --ssl-key /path/to/key --root ./data ``` Your users will have a dedicated folder under `./data` at `./data/.`. Also, your root domain's website will be in `./data/`. New users can create accounts on `/api/accounts/new` and create new certificates on `/api/accounts/cert`. An easy-to-use sign-up tool is found on `/api/accounts`. ##### How can I send emails to my users with my Gmail? > To use Gmail you may need to configure ["Allow Less Secure Apps"](https://www.google.com/settings/security/lesssecureapps) in your Gmail account unless you are using 2FA in which case you would have to create an [Application Specific](https://security.google.com/settings/security/apppasswords) password. You also may need to unlock your account with ["Allow access to your Google account"](https://accounts.google.com/DisplayUnlockCaptcha) to use SMTP. also add to `config.json` ``` "useEmail": true, "emailHost": "smtp.gmail.com", "emailPort": "465", "emailAuthUser": "xxxx@gmail.com", "emailAuthPass": "gmailPass" ``` ### Upgrading from version

Back | FazBrowse Home | New Git URL