Skip to content

Instantly share code, notes, and snippets.

@kevin-smets
Last active August 12, 2021 23:04
Show Gist options
  • Save kevin-smets/7884006325f0e98bab54b3897457d4d8 to your computer and use it in GitHub Desktop.
Save kevin-smets/7884006325f0e98bab54b3897457d4d8 to your computer and use it in GitHub Desktop.
Run a Solid server locally, with all the quirks and features

Solid server locally

This readme applies to v5.0.0-beta.5. Version 4.4.0 (stable at the time of release) is broken.

Generate self-signed certificate

Create a secrets file:

touch ~/.secret

Make sure it looks like this:

#!/bin/bash;
PASSPHRASE=mysecretpassphrase

Then source it:

. ~/.secret

And generate the necessary files:

openssl genrsa -des3 -passout pass:$PASSPHRASE -out server.pass.key 2048;
openssl rsa -passin pass:$PASSPHRASE -in server.pass.key -out server.key;
openssl req -new -key server.key -out server.csr;
openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt;

Clone and run the solid server

git clone https://github.com/solid/node-solid-server.git;
cd node-solid-server;
git checkout v5.0.0-beta.5; #IMPORTANT
npm install;
npm run solid init;

Make sure to disable multiuser!

Fill in the info, after that a ./config.json file will be made, this is what mine looks like:

{
  "root": "/Users/kevin/git/node-solid-server/data",
  "port": "8443",
  "serverUri": "https://localhost:8443",
  "webid": true,
  "mount": "/",
  "configPath": "./config",
  "configFile": "./config.json",
  "dbPath": "./.db",
  "sslKey": "/Users/kevin/server.key",
  "sslCert": "/Users/kevin/server.crt",
  "multiuser": false,
  "server": {
    "name": "localhost",
    "description": "",
    "logo": ""
  }
}

Then start the server with some magic to allow for self signed certificates:

export NODE_TLS_REJECT_UNAUTHORIZED=0 && npm run solid start -- --no-reject-unauthorized

Hosts file entry

Before anything else, edit your hosts file:

sudo nano /etc/hosts

And add 127.0.0.1 *.localhost to it.

Huzzah!

You should now see your frontend on https://localhost:8443/, you'll need to click through the warning messages of the self signed certificate of course.

Sometimes the register or login buttons will not be visible, so you may have to go to https://localhost:8443/register directly to create a new account.

Get through the even more quirky stuff

Applicable to v5.0.0-beta.5

In my example I registered the account kevin, so then go to https://kevin.localhost:8443 and click login. For some reason if you want to auth using kevin.localhost:8443, you'll get an Unatuhorized message.

Instead, click on another domain, I tried "Solid Test Space". Then go back and authorization using kevin.localhost:8443 should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment