Solid Wiki Journal

Home

Sync the dev environment

Currently, I am syncing the solid user data from the development environment to the remote server over rsync. But while I was writing this post, I realised that it could be further simplified, by running the server locally with docker.

With a local server

The easiest way to sync the user data from your development environment to a running Solid Server, is to link your development data folder to the servers data folder. With docker, you can quickly get an NSS running locally. To link the folders, mount the project folder ~/your/project/data to /user/src/app/data in the container.

docker pull nodesolidserver/node-solid-server
sudo docker run -p 8443:8443 -v ~/your/project/data/:/usr/src/app/data  nodesolidserver/node-solid-server

Once the server is running, you can create a user. Let’s call that user “alice”. After you created the user, check if you can see the files belonging to alice under ~/your/project/data/alice.localhost/. Do you see them? Great, from now on, you can edit the Turtle files directly. As an example edit the username in ~/your/project/data/alice.localhost/profile/card$.ttl . The changes should be available under https://alice.localhost:8443/profile/ as soon as you save the file.

With rsync to remote NSS

Rsync is a great tool, which can help us to sync a Solid user data folder to a Solid remote server. To run this command, you need access to the remote machine and authenticate with your public key. Make sure to edit the local folder ~/folder/to/alice.solid.example.org, the ssh user sshUserName, the remote example.org (which could also be an IP Address) and the remote folder /var/www/solid.example.org/data/ according to your setup.

rsync -avzhe ssh \
  ~/folder/to/alice.solid.example.org \
  sshUserName@example.org:/var/www/solid.example.org/data/ \
  -T /tmp/ \
  --checksum \
  --chown=solid:www-data \
  --chmod=771 \
  --delete-before