mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
readme update, updated some queries to use numbers instead of strings
This commit is contained in:
parent
088a3785cc
commit
f8a7c6a4e5
14 changed files with 53 additions and 62 deletions
56
README.md
56
README.md
|
@ -33,31 +33,41 @@ threads, and serve more requests at once. The used cores can be limited with env
|
|||
| Peer to peer functionality | The ability to share question databases and users with other instances of this server |
|
||||
| Peer | Another instance of this server, with peer to peer functionality set up |
|
||||
| User \#1 | The first user created, admin of the server |
|
||||
| Submodule | A server submodule, dynamically loaded, and stored in `./src/modules/` |
|
||||
| Git module | Git modules stored in `./submodules` |
|
||||
|
||||
## Setup
|
||||
|
||||
Run `./scripts/setup.sh`, then `npm run dev` for development, or `npm run start` for prod.
|
||||
|
||||
On the first run there will be a number of errors, that some files weren't found. Please create them
|
||||
according to the messages, these are necessary for the server to function.
|
||||
On the first run there will be a number of errors, that some files weren't found, or some
|
||||
environment variables needed to be specified. Please create them according to the messages, these
|
||||
are necessary for the server to function.
|
||||
|
||||
There will be also a lot of information about files and other necessary things being created. **Please
|
||||
read them very carefully, you should know about what was created!**
|
||||
|
||||
### Setup notes
|
||||
### Setup notes and tips
|
||||
|
||||
* **Gitlab specific notes**: You need a gitlab account with SSH keys set up in order to be able to use
|
||||
SSH for cloning this (and any) project. This includes git modules of this project. See
|
||||
`CLONE_WITH_HTTPS` in environment variables below.
|
||||
* The `DOMAIN` env var can be replaced by making the file `./data/domain`. This is necesarry, to make
|
||||
xmlhttp requests and some redirects work in statically built HTML files (by next.js), in the
|
||||
userscript, and in the server itself.
|
||||
* The setup script can be also used to update and rebuild all git modules.
|
||||
* **Gitlab specific notes**: You need a gitlab account with SSH keys set up in order to be able to
|
||||
use SSH for cloning this (and any) project. This includes git modules of this project. To use HTTPS
|
||||
set the `CLONE_WITH_HTTPS` environment variable before running `setup.sh`. To set up SSH keys:
|
||||
https://docs.gitlab.com/ee/user/ssh.html
|
||||
* You either need to specify a `DOMAIN` env var, or write the domain to `./data/domain`. This is
|
||||
necesarry to make xmlhttp requests and some redirects work in: statically built HTML files (by
|
||||
next.js), userscript, and the server itself. Domain is for example: 'qmining.com', without
|
||||
'http://' and '/'-s
|
||||
* By default the server redirects all HTTP traffic to HTTPS. To disable this use
|
||||
`NS_NO_HTTPS_FORCE`
|
||||
* The server launches a thread for each CPU core. This could be an overkill on 4+ cored CPU-s. Use
|
||||
`NS_THREAD_COUNT` to restrict the number of threads
|
||||
* The setup script can be also used to update and rebuild all git modules if ran after the initial
|
||||
setup
|
||||
|
||||
## Web server paths
|
||||
|
||||
There are different routes assigned to different modules. You can see these in detail in the files
|
||||
`./src/modules.json`.
|
||||
There are different routes assigned to different submodules. You can see these in detail in the
|
||||
files `./src/modules.json`.
|
||||
|
||||
## Peer to peer
|
||||
|
||||
|
@ -71,7 +81,7 @@ To setup P2P functionality you have to create a few files in `./data/p2p`:
|
|||
{
|
||||
"name": "any name you choose",
|
||||
"contact": "contact to server administrator (irc server, e-mail, anything)",
|
||||
"host": "server host (like somesite.com, without 'http(s):// and /-s')",
|
||||
"host": "server host (like 'qmining.com', without 'http(s):// and /-s')",
|
||||
"pw": "password to the host, so the server can log in there. Please use a dedicated password, that only the server uses!",
|
||||
"port": "server port, number"
|
||||
}
|
||||
|
@ -148,23 +158,27 @@ result can be found in the directory it was ran.
|
|||
|
||||
### For the server
|
||||
|
||||
Set these before launching the server (`VAR="" npm run start`)
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| PORT | number | The port the http server should run on |
|
||||
| NS_THREAD_COUNT | number | Nubmer of CPU cores to use |
|
||||
| NS_NOUSER | boolean | If the authorization should be skipped (for testing) |
|
||||
| NS_NO_HTTPS_FORCE | boolean | Disables automatic redirects from http to https |
|
||||
| NS_LOGLEVEL | number | Debug log level, 0 is the least verbose |
|
||||
| NS_NOLOG | boolean | If logging should be skipped |
|
||||
| NS_SQL_DEBUG_LOG | boolean | If the SQL queries should be logged |
|
||||
| DOMAIN | string | The domain that the server should use for redirects, cookies, etc. ex.: `qmining.com`, without 'https://', and '/'-s. If not specified `./data/domain` will be used |
|
||||
| NS_NO_HTTPS_FORCE | boolean | Disables automatic redirects from http to https |
|
||||
| NS_THREAD_COUNT | number | Nubmer of CPU cores to use |
|
||||
| NS_LOGLEVEL | number | Debug log level, 0 is the least verbose |
|
||||
| NS_SQL_DEBUG_LOG | boolean | If the SQL queries should be logged |
|
||||
| NS_NOUSER | boolean | If the authorization should be skipped (for testing) |
|
||||
| NS_NOLOG | boolean | If logging should be skipped |
|
||||
|
||||
### For the setup script (`./scripts/setup.sh`)
|
||||
|
||||
Set these before starting the setup (`VAR="" ./scripts/setup.sh`)
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| CLONE_WITH_HTTPS | boolean | By default git clones with ssh, which can cause troubles. Set this
|
||||
| DOMAIN | string | The domain that the server should use for redirects, cookies, etc. ex.: `qmining.com`, without 'https://', and '/'-s. If not specified `./data/domain` will be used |
|
||||
| CLONE_WITH_HTTPS | boolean | By default git clones with ssh, which can cause troubles. Set this to use https |
|
||||
|
||||
## npm scripts
|
||||
|
||||
|
@ -179,7 +193,7 @@ result can be found in the directory it was ran.
|
|||
|
||||
## Git modules
|
||||
|
||||
Details about the specific git module should be found in its directory.
|
||||
More details about the specific git module should be found in its directory: `./submodules/`
|
||||
|
||||
# qmining-page
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue