node-SESAM-server is a c't SESAM sync server written in node.js
The configuration file is in config/default.json. It contains the config for the webservice port, your redis connections and all users which are allowed to access the service.
Example:
{
"port": 3000,
"redis": {
"host": "127.0.0.1",
"port": 6379
},
"users" : {
"test": "test"
}
}Configure the port the server is running on.
Configure the host and port of the redis database
Defines a set of allowed users. The key is the user name and the value the given password. The password is only for the access of the service, not the actual master password.
- install redis-server, nodejs and npm on your machine (ask google how to do this)
- create a local user for the node process
- clone the repository e.g. into /home/sesam/
- update the configuration, see above
- as root install pm2 by executing
sudo npm -g install pm2. - as user install needed node modules by executing
npm installin the project directory - as user add the server to pm2 by executing ```pm2 start index.js --name "sesam"
- configure your webserver
- test the server by accessing http://127.0.0.1:3000/api (via curl or wget)
- test the server by accessing https://your.server.tld/api in your browser.
<VirtualHost server.tld:443>
ServerName your.server.tld
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/sesam.crt
SSLCertificateKeyFile /etc/apache2/ssl/sesam.key
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location /api>
ProxyPass http://127.0.0.1:3000/
ProxyPassReverse http://127.0.0.1:3000/
</Location>
</VirtualHost>
You have to create the needed certificates by yourself. Ask google if you have any problems with the certificate creation or the apache configuration in general.
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
server_name your.server.tld;
ssl_certificate /etc/nginx/ssl/sesam.crt;
ssl_certificate_key /etc/nginx/ssl/sesam.key;
location ~ /api {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
expires off;
}
}
You have to create the needed certificates by yourself. Ask google if you have any problems with the certificate creation or the nginx configuration in general.
The root url, user name and password depend on your server and configuration. The root url for the examples above will be https://your.server.tld/api/.
Use this urls:
- read:
read - write:
write - delete:
delete