Reformat Readme.MD.

This commit is contained in:
Robin Davies
2021-08-15 12:55:07 -04:00
parent d8a6022947
commit dc66f9ac50
+26 -25
View File
@@ -1,28 +1,31 @@
How to Debug PiPedal.
### How to Debug PiPedal.###
You must stop the pipdeal service before launching a debug instance of pipedal:
sudo systemctl stop pipedal
> sudo systemctl stop pipedal
or
pipedalconfig -stop
> pipedalconfig -stop
But there's no harm in running a debug react server that's configured to connect to the web
socket of a production instance of pipedal.
PipPedal consists of two subprojects:
PipPedal consists of the following subprojects:
A web application build in React.
* A web application build in React.
pipedal: a Web server, written in C++, serving a web socket, and pre-built HTML components from the React app.
All audio services are provided by the pipedal process.
* pipedald: a Web server, written in C++, serving a web socket, and pre-built HTML components from the React app.
All audio services are provided by the pipedal process.
In production, the pipedal web server serves the PiPedal web socket, as well as HTML from the built
* pipedalshutdownd: A service to execute operations that require root credentials on behalf of pipedald. (e.g. shutdown, reboot,
and pushing configuration changes.)
In production, the pipedald web server serves the PiPedal web socket, as well as HTML from the built
react components. While debugging, it is much more convenient to use the React debug server for
React sources, and configure pipedal to serve only the websocket.
React sources, and configure pipedald to serve only the websocket.
To start the React debug server, from a shell, cd to the react directory, and run "./start". The react debug
server will detect any changes to React sources, and rebuild them automatically (no build step required).
@@ -39,22 +42,21 @@ followed by 'sudo sysctl -p'. (VS Code and React both need this change).
By default, the React app will attempt to contact the pipedal server on ws:*:8080. This can be reconfigured
in the file react/src/public/var/config.json. (The pipedal server intercepts requests for this file and
points the react app at itself in production). The React app will display the message
"Error: Failed to connect to the server", until you start the pipedal websocket server in the debugger.
"Error: Failed to connect to the server", until you start the pipedal websocket server in the VSCode debugger.
It's quite reasonable to point the react debug app at a production instance of the pipedal server.
react/src/public/var/config.json:
{
"socket_server_port": 80,
"socket_server_address": "*",
...
}
> react/src/public/var/config.json:
> {
> "socket_server_port": 80,
> "socket_server_address": "*",
> ...>
> }
Setting socket_server_address to "*" configures the web app to reconnect using the host address the browser
request used to connect to the web app. (e.g. 127.0.0.1, or pipedal.local, &c). If you choose another address,
remember that it is that web browser which will use it to make the connection.
The original development for this app was done with visual studio code. Open the root project directory in
The original development for this app was done with Visual Studio Code. Open the root project directory in
Visual Studio Code, and it will detect the CMake build files, and configure itself appropriately. Wait for
the CMake plugin in Visual Studio Code to configure itself, after loading.
@@ -82,17 +84,16 @@ which allows it to share configuration with a production instance of pipedal. Be
for this folder is intricate. If you plan to use the data from a production server, get the production server
installed first so the permissions are set correctly. If you install a production instance later, remove the
entire directory before doing so, to ensure that none of the files in that directory are permissioned
incorrectly.
incorrectly.
You will need to add your userid to the pipedal_d group if you plan to share the /var/pipedal directory.
You can avoid all of this, by configuring the debug instance to use a data folder in your home directory. Edit
debugConfig/config.json:
{
...
"local_storage_path": "~/var/pipedal",
...
}
> {
> ...
> "local_storage_path": "~/var/pipedal",
> ...
> }