mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
added primitive protocol switcher for submodules
This commit is contained in:
parent
8647088faf
commit
7d1bddd7e2
6 changed files with 75 additions and 10 deletions
12
.gitmodules.https
Executable file
12
.gitmodules.https
Executable file
|
@ -0,0 +1,12 @@
|
|||
[submodule "modules/qmining/qmining-page"]
|
||||
path = submodules/qmining-page
|
||||
url = https://gitlab.com/MrFry/qmining-page
|
||||
update = merge
|
||||
[submodule "modules/dataEditor/qmining-data-editor"]
|
||||
path = submodules/qmining-data-editor
|
||||
url = https://gitlab.com/MrFry/qmining-data-editor
|
||||
update = merge
|
||||
[submodule "qminingPublic/moodle-test-userscript"]
|
||||
path = submodules/moodle-test-userscript
|
||||
url = https://gitlab.com/MrFry/moodle-test-userscript
|
||||
update = merge
|
12
.gitmodules.ssh
Executable file
12
.gitmodules.ssh
Executable file
|
@ -0,0 +1,12 @@
|
|||
[submodule "modules/qmining/qmining-page"]
|
||||
path = submodules/qmining-page
|
||||
url = git@gitlab.com:MrFry/qmining-page.git
|
||||
update = merge
|
||||
[submodule "modules/dataEditor/qmining-data-editor"]
|
||||
path = submodules/qmining-data-editor
|
||||
url = git@gitlab.com:MrFry/qmining-data-editor.git
|
||||
update = merge
|
||||
[submodule "qminingPublic/moodle-test-userscript"]
|
||||
path = submodules/moodle-test-userscript
|
||||
url = git@gitlab.com:MrFry/moodle-test-userscript.git
|
||||
update = merge
|
23
README.md
23
README.md
|
@ -38,13 +38,17 @@ threads, and serve more requests at once. The used cores can be limited with env
|
|||
|
||||
Run `./scripts/setup.sh`, then `npm run dev` for development, or `npm run start` for prod.
|
||||
|
||||
**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.
|
||||
|
||||
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.
|
||||
|
||||
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!**
|
||||
|
||||
The setup script can be also used to update and rebuild all git submodules.
|
||||
The setup script can be also used to update and rebuild all git modules.
|
||||
|
||||
## Web server paths
|
||||
|
||||
|
@ -91,7 +95,7 @@ The server doesn't require that much maintenance, but you are advised to:
|
|||
* Check and moderate the forum(s) of the page
|
||||
* Sync the server with other peers (this can be automated)
|
||||
* Check `./data/p2p/thirdPartyPeers.json` file for new peers, and decide if you should use them
|
||||
* Regularly check if there is an update to this server and git submodules, and update them
|
||||
* Regularly check if there is an update to this server and git modules, and update them
|
||||
* Watch out for directories that can get big:
|
||||
* `./stats`: server statistics and logs
|
||||
* `./data/dbs/backup`: backup of databases
|
||||
|
@ -138,6 +142,8 @@ result can be found in the directory it was ran.
|
|||
|
||||
## Environment variables
|
||||
|
||||
### For the server
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| PORT | number | The port the http server should run on |
|
||||
|
@ -148,6 +154,13 @@ result can be found in the directory it was ran.
|
|||
| NS_NOLOG | boolean | If logging should be skipped |
|
||||
| NS_SQL_DEBUG_LOG | boolean | If the SQL queries should be logged |
|
||||
|
||||
### For the setup script
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| CLONE_WITH_HTTPS | boolean | By default git clones with ssh, which can cause troubles. Set this
|
||||
to use https for git modules |
|
||||
|
||||
## npm scripts
|
||||
|
||||
| Name | Description |
|
||||
|
@ -159,9 +172,9 @@ result can be found in the directory it was ran.
|
|||
| npm run test | Runs jest tests |
|
||||
| npm run test-debug | Runs jest tests in watch mode with debugger attached |
|
||||
|
||||
## Git submodules
|
||||
## Git modules
|
||||
|
||||
Details about the specific git submodule should be found in its directory.
|
||||
Details about the specific git module should be found in its directory.
|
||||
|
||||
# qmining-page
|
||||
|
||||
|
@ -234,7 +247,7 @@ https://gitlab.com/MrFry/moodle-test-userscript
|
|||
│ ├── ustats website accesses count per user
|
||||
│ ├── uvstats website accesses count per day per user
|
||||
│ └── vstats website accessed paths per day
|
||||
├── submodules git submodules
|
||||
├── submodules git modules
|
||||
│ ├── moodle-test-userscript userscript
|
||||
│ ├── qmining-data-editor data editor frontend
|
||||
│ └── qmining-page qmining frontend
|
||||
|
|
|
@ -7,9 +7,11 @@ hr() { [ -t 0 ] && printf '\033[0;32m%*s\033[0m\n' "$(tput cols)" '' | tr ' ' '=
|
|||
|
||||
log() { hr; echo -e "\033[0;34m${1}\033[0m"; hr; }
|
||||
|
||||
error() { echo -e "\033[0;41m${1}\033[0m"; }
|
||||
|
||||
checkFile() {
|
||||
if [ ! -f "${1}" ]; then
|
||||
echo -e "\033[0;41m${1} does not exist!\033[0m"
|
||||
error "${1} does not exist!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
@ -37,7 +39,7 @@ checkFile "$PWD/src/server.ts"
|
|||
checkFile "$PWD/package.json"
|
||||
checkFile "$PWD/package-lock.json"
|
||||
if [ ! -f "${domainPath}" ]; then
|
||||
echo -e "\033[0;41m${domainPath} does not exist!\033[0m"
|
||||
error "${domainPath} does not exist!"
|
||||
echo "Please create it, and re-run this script."
|
||||
echo "Expected content: domain, ex.:'frylabs.net' (without http:// and /)"
|
||||
exit 1
|
||||
|
@ -62,6 +64,10 @@ cp -vrn ./defaultPublicFiles/* ./publicDirs/qminingPublic/
|
|||
# ------------------------------------------------------------------------------------
|
||||
# Git submodules
|
||||
# ------------------------------------------------------------------------------------
|
||||
if [ ! -z "$CLONE_WITH_HTTPS" ]; then
|
||||
./scripts/switchGitProtocol.sh "https"
|
||||
fi
|
||||
|
||||
log 'Updating / Cloning project'
|
||||
git pull || exit 1
|
||||
git submodule update --init --recursive --remote || exit 1
|
||||
|
|
22
scripts/switchGitProtocol.sh
Executable file
22
scripts/switchGitProtocol.sh
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
gitDir=".git"
|
||||
gitmoduleFile=".gitmodules"
|
||||
sshGitmodulesFile=".gitmodules.ssh"
|
||||
httpsGitmodulesFile=".gitmodules.https"
|
||||
|
||||
function error() { echo -e "\033[0;41m${1}\033[0m"; exit 1; }
|
||||
|
||||
if [ ! -d "${gitDir}" ]; then
|
||||
error "${gitDir} does not exist! Maybe you ran this script in the wrong directory"
|
||||
fi
|
||||
|
||||
if [ "$1" != "ssh" ] && [ "$1" != "https" ]; then
|
||||
error "Invalid param! Valid params are: 'ssh', 'https'"
|
||||
fi
|
||||
|
||||
if [ "$1" == "ssh" ]; then
|
||||
cp -v "$sshGitmodulesFile" "$gitmoduleFile"
|
||||
elif [ "$1" == "https" ]; then
|
||||
cp -v "$httpsGitmodulesFile" "$gitmoduleFile"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue