Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
node_modules/
*~
# Keep this in sync with .npmignore
*.swp
.tern-port
npm-debug.log
/config/account-template
/config/email-templates
*~
/.idea
/.nyc_output
/.tern-port
/.db
/accounts
/profile
/inbox
/.acl
/config.json
/config/account-template
/config/email-templates
/config/templates
/config/views
/settings
/.db
.nyc_output
coverage
/data
/data
/coverage
/node_modules
/npm-debug.log
28 changes: 20 additions & 8 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
config.json.bck
config.json
test
./accounts
./settings
./profile
./.acl
./inbox
# Keep this in sync with .gitignore
*.swp
*~
/.idea
/.nyc_output
/.tern-port
/.db
/accounts
/config.json
/config/account-template
/config/email-templates
/config/templates
/config/views
/data
/coverage
/node_modules
/npm-debug.log

# Additional .npmignore entries (not in .gitignore)
/test
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
sudo: false
language: node_js
node_js:
- "6.0"
- "8.0"
- "8.10"
- "10.0"
- "node"
env:
- CXX=g++-4.8
Expand Down
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:8.11.2-onbuild
EXPOSE 8443
COPY config.json-default config.json
RUN openssl req \
-new \
-newkey rsa:4096 \
-days 365 \
-nodes \
-x509 \
-subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" \
-keyout cert.key \
-out cert.pem
CMD npm run solid start
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@

### 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.

To install, first install [Node](https://nodejs.org/en/) and then run the following

```bash
Expand Down Expand Up @@ -189,6 +194,27 @@ $ solid start --help
-v, --verbose Print the logs to console
```

## Use Docker

Build with:

```bash
docker build -t node-solid-server .
```

Run with:
```bash
docker run -p 8443:8443 --name solid node-solid-server
```

Modify the config as follows:

- Copy the config to the current directory with: `docker cp solid:/usr/src/app/config.json .`
- Edit the `config.json` file
- Copy the file back with `docker cp config.json solid:/usr/src/app/`
- Restart the server with `docker restart solid`


## Library Usage

### Install Dependencies
Expand Down
6 changes: 3 additions & 3 deletions bin/lib/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const fs = require('fs')
const options = require('./options')
const camelize = require('camelize')

var questions = options
let questions = options
.map((option) => {
if (!option.type) {
if (option.flag) {
Expand Down Expand Up @@ -56,8 +56,8 @@ module.exports = function (program) {
})

// write config file
var config = JSON.stringify(camelize(answers), null, ' ')
var configPath = process.cwd() + '/config.json'
const config = JSON.stringify(camelize(answers), null, ' ')
const configPath = process.cwd() + '/config.json'

fs.writeFile(configPath, config, (err) => {
if (err) {
Expand Down
22 changes: 22 additions & 0 deletions bin/lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ module.exports = [
default: './config',
prompt: true
},
{
name: 'config-file',
question: 'Path to the config file (for example: ./config.json)',
default: './config.json',
prompt: true
},
{
name: 'db-path',
question: 'Path to the server metadata db directory (for users/apps etc)',
Expand Down Expand Up @@ -301,6 +307,22 @@ module.exports = [
when: (answers) => {
return answers.useApiApps
}
},
{ // copied from name: 'owner'
name: 'redirect-http-from',
help: 'HTTP port or \',\'-separated ports to redirect to the solid server port (e.g. "80,8080").',
prompt: false,
validate: function (value) {
if (!value.match(/^[0-9]+(,[0-9]+)*$/)) {
return 'direct-port(s) must be a comma-separated list of integers.'
}
let list = value.split(/,/).map(v => parseInt(v))
let bad = list.find(v => { return v < 1 || v > 65535 })
if (bad.length) {
return 'redirect-http-from port(s) ' + bad + ' out of range'
}
return true
}
}
]

Expand Down
5 changes: 3 additions & 2 deletions bin/lib/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = function (program, server) {
options
.filter((option) => !option.hide)
.forEach((option) => {
var name = '--' + option.name
let name = '--' + option.name
if (!option.flag) {
name += ' [value]'
}
Expand All @@ -24,8 +24,9 @@ module.exports = function (program, server) {

start.action((opts) => {
let argv = extend({}, opts, { version: program.version() })
let configFile = argv['configFile'] || './config.json'

fs.readFile(process.cwd() + '/config.json', (err, file) => {
fs.readFile(configFile, (err, file) => {
// No file exists, not a problem
if (err) {
console.log(colors.cyan.bold('TIP'), 'create a config.json: `$ solid init`')
Expand Down
6 changes: 3 additions & 3 deletions common/js/solid-auth-client.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion common/js/solid-auth-client.bundle.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions common/popup.html

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions config.json-default
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"root": "./data",
"port": "8443",
"serverUri": "https://localhost:8443",
"webid": true,
"mount": "/",
"configPath": "./config",
"dbPath": "./.db",
"sslKey": "./cert.key",
"sslCert": "./cert.pem",
"multiuser": true,
"corsProxy": "/proxy"
}
8 changes: 8 additions & 0 deletions config/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,12 @@ module.exports = {
'serverUri': 'https://localhost:8443',
'webid': true,
'dataBrowserPath': 'default'

// For use in Enterprises to configure a HTTP proxy for all outbound HTTP requests from the SOLID server (we use
// https://www.npmjs.com/package/global-tunnel-ng).
// "httpProxy": {
// "tunnel": "neither",
// "host": "proxy.example.com",
// "port": 12345
// }
}
3 changes: 3 additions & 0 deletions default-templates/new-account/.acl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
a acl:Authorization;

acl:agent <{{webId}}> ;
{{#if addOwlSameAs}}
acl:agent <{{extWebId}}>;
{{/if}}

# Optional owner email, to be used for account recovery:
{{#if email}}acl:agent <mailto:{{{email}}}>;{{/if}}
Expand Down
3 changes: 3 additions & 0 deletions default-templates/new-account/.meta.acl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

acl:agent
<{{webId}}>;
{{#if addOwlSameAs}}
acl:agent <{{extWebId}}>;
{{/if}}

acl:accessTo </.meta>;

Expand Down
3 changes: 3 additions & 0 deletions default-templates/new-account/favicon.ico.acl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

acl:agent
<{{webId}}>;
{{#if addOwlSameAs}}
acl:agent <{{extWebId}}>;
{{/if}}

acl:accessTo </favicon.ico>;

Expand Down
3 changes: 3 additions & 0 deletions default-templates/new-account/inbox/.acl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

acl:agent
<{{webId}}>;
{{#if addOwlSameAs}}
acl:agent <{{extWebId}}>;
{{/if}}

acl:accessTo <./>;
acl:defaultForNew <./>;
Expand Down
Loading