76.3 Community Solid Server System Management

20220604 We will set up a public solid server to save data in /opt/solid/server and to place a log file into /opt/solid/log both which we first need to create. Be sure you are logged into the solid user account.

sudo -su solid
mkdir /opt/solid/server /opt/solid/log

Start the Solid server (changing example.org to your domain) and visit your domain:

community-solid-server --baseUrl https://solid.example.org \
                       --port 3000 \
                       --config @css:config/file-no-setup.json \
                       --rootFilePath /opt/solid/server/

We can create a shell script /opt/solid/manage_solid_server.sh to handle the server management.

emacs /opt/solid/manage_solid_server.sh

The contents should be as below, changing example.com to your own domain name.

#!/usr/bin/env bash

URL="https://solid.example.com/" # EDIT ME!
PORT=3000
LOG="/opt/solid/log/solid.log"
DATA="/opt/solid/server/"

export NVM_DIR="$HOME/.nvm"; [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

case "${1}" in
    start|run)
        if pgrep -f community-solid-server; then
            echo "Server is already currently running.";
        else community-solid-server --baseUrl ${URL} --port ${PORT} \
                                    --config @css:config/file-no-setup.json \
                                    --rootFilePath ${DATA} >> ${LOG} 2>&1 & disown;
             pgrep -f community-solid-server; fi;;
    status|check)
        if pgrep -f community-solid-server; then
            echo "Server is currently running.";
        else echo "Server is not running"; fi;;
    see|log)
        cat ${LOG};;
    stop|kill)
        if pgrep -f community-solid-server; then
            pgrep -f community-solid-server | xargs kill
        else echo "Server is not running"; fi;;
    *)
        echo "Supported commands: start, stop, status, log.";;
esac;

Make the script executable:

chmod a+x /opt/solid/manage_solid_server.sh

See Section 76.4 to utilise the script and to configure systemd to start the server on boot.



Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0