manuals, deploy, docs
This commit is contained in:
@@ -0,0 +1,229 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ElementBaseInitiationBlock>
|
||||
|
||||
<!-- Basic -->
|
||||
<Inline template="General/Element Basic No Icon"/>
|
||||
|
||||
<!-- Stereotypes -->
|
||||
<HasValueChecker property="stereotypes">
|
||||
<Reference template="General/Stereotypes"/>
|
||||
</HasValueChecker>
|
||||
|
||||
<!-- Tagged Values -->
|
||||
<HasValueChecker property="taggedValues">
|
||||
<Reference template="Tagged Values"/>
|
||||
</HasValueChecker>
|
||||
|
||||
<!-- Summary - Template Parameters -->
|
||||
<HasValueChecker property="templateParameters">
|
||||
<Text style="@heading+">Template Parameters</Text>
|
||||
<ParagraphBreak/>
|
||||
|
||||
<TableBlock colWidths="33, 33, 33" tableStyle="Summaries">
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
<Text>Name</Text>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Text>Type</Text>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Text>Default Value</Text>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
||||
<ForEach property="templateParameters">
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
<Property property="name"/>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Property property="type"/>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Property property="defaultValue"/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</ForEach>
|
||||
</TableBlock>
|
||||
</HasValueChecker>
|
||||
|
||||
<!-- Attributes (Summary) -->
|
||||
<HasChildElementChecker modelType="Attribute">
|
||||
<Text style="@heading+">Атрибути</Text>
|
||||
<ParagraphBreak/>
|
||||
|
||||
<TableBlock colWidths="30, 70" tableStyle="Summaries">
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
<Text>Име</Text>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Text>Описание</Text>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
||||
<IterationBlock modelType="Attribute">
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
<Property property="name"/>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Property property="description" style="Description"/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</IterationBlock>
|
||||
</TableBlock>
|
||||
</HasChildElementChecker>
|
||||
<!-- Enumeration Literals (Summary) -->
|
||||
<HasChildElementChecker modelType="EnumerationLiteral">
|
||||
<Text style="@heading+">Enumeration Literals Summary</Text>
|
||||
<ParagraphBreak/>
|
||||
|
||||
<TableBlock colWidths="20, 80" tableStyle="Summaries">
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
<Text>Name</Text>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Text>Description</Text>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
||||
<IterationBlock modelType="EnumerationLiteral">
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
<Icon/>
|
||||
<Property property="name"/>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Property property="description" style="Description"/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</IterationBlock>
|
||||
</TableBlock>
|
||||
</HasChildElementChecker>
|
||||
<!-- Operations (Summary) -->
|
||||
<HasChildElementChecker modelType="Operation">
|
||||
<Text style="@heading+">Методи</Text>
|
||||
<ParagraphBreak/>
|
||||
|
||||
<TableBlock colWidths="20, 80" tableStyle="Summaries">
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
<Text>Име</Text>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Text>Описание</Text>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
||||
<IterationBlock modelType="Operation">
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
<Property property="name"/>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Property property="description" style="Description"/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</IterationBlock>
|
||||
</TableBlock>
|
||||
</HasChildElementChecker>
|
||||
|
||||
<!-- Enumeration Literals (Detail) -->
|
||||
<HasChildElementChecker modelType="EnumerationLiteral">
|
||||
<Text style="@heading+">Enumeration Literals</Text>
|
||||
<ParagraphBreak/>
|
||||
|
||||
<IterationBlock modelType="EnumerationLiteral">
|
||||
|
||||
<Inline template="Basic"/>
|
||||
|
||||
<TableBlock colWidths="20, 80" repeatTableHeader="false" tableStyle="Properties">
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
<Text>Specification</Text>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<ModelElementProperty property="specification">
|
||||
<Property property="value"/>
|
||||
</ModelElementProperty>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
<Text>Slots</Text>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<ForEach property="slots">
|
||||
<Property property="feature"/>
|
||||
<Text> = </Text>
|
||||
|
||||
<ForEach ignoreLastSeparator="true" property="values">
|
||||
<Property property="value"/>
|
||||
<Text>, </Text>
|
||||
</ForEach>
|
||||
|
||||
<ParagraphBreak/>
|
||||
</ForEach>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBlock>
|
||||
|
||||
</IterationBlock>
|
||||
</HasChildElementChecker>
|
||||
|
||||
|
||||
<!-- Sub Diagrams & References -->
|
||||
<Reference template="General/Sub and Referenced Diagrams"/>
|
||||
|
||||
<!-- Traceability -->
|
||||
<HasValueChecker property="traceability">
|
||||
<Reference template="Traceability"/>
|
||||
</HasValueChecker>
|
||||
|
||||
<!-- Chart Relations -->
|
||||
<HasValueChecker property="chartRelations">
|
||||
<Text style="@heading+">Chart Relations</Text>
|
||||
<ParagraphBreak/>
|
||||
|
||||
<TableBlock colWidths="20, 80" tableStyle="Summaries">
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
<Text>Code</Text>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Text>Begin</Text>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Text>End</Text>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
||||
<ForEach property="chartRelations">
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
<ModelElementProperty property="code">
|
||||
<Property property="code"/>
|
||||
</ModelElementProperty>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<ModelElementProperty property="from">
|
||||
<Icon/>
|
||||
<Property property="name"/>
|
||||
</ModelElementProperty>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<ModelElementProperty property="to">
|
||||
<Icon/>
|
||||
<Property property="name"/>
|
||||
</ModelElementProperty>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</ForEach>
|
||||
|
||||
</TableBlock>
|
||||
</HasValueChecker>
|
||||
|
||||
</ElementBaseInitiationBlock>
|
||||
@@ -0,0 +1,9 @@
|
||||
module.exports = {
|
||||
apps : [{
|
||||
name : "pronature",
|
||||
script : "/var/node/pronature/backend/main.js",
|
||||
cwd : "/var/node/pronature/",
|
||||
instances : 2,
|
||||
exec_mode : "cluster"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
# Server and Application Installation
|
||||
## Services to install
|
||||
### [Mongo DB Community 8+ ](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/)
|
||||
> sudo apt-get install gnupg curl
|
||||
> curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
|
||||
sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \
|
||||
--dearmor
|
||||
> echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
|
||||
> sudo apt-get update
|
||||
> sudo apt-get install -y mongodb-org
|
||||
> sudo systemctl start mongod
|
||||
> sudo systemctl status mongod
|
||||
> sudo systemctl enable mongod
|
||||
|
||||
### NodeJS
|
||||
> curl -fsSL https://fnm.vercel.app/install | bash
|
||||
> source ~/.bashrc
|
||||
> fnm use --install-if-missing 22
|
||||
> node -v # should print `v22.11.0`
|
||||
> npm -v # should print `10.9.0`
|
||||
|
||||
### PM2
|
||||
> npm install pm2 -g
|
||||
> pm2 startup
|
||||
|
||||
2. NGINX. Important config - set redirect from http to https. Virtual host config example - [**nginx.`your_dl_name`.conf** ](./nginx.your_dl_name.conf)
|
||||
3. PM2. Install and enable the process manager for nodejs (after NodeJS and NPM are installed). Config and run using the nonroot user.
|
||||
4. SPHINX. Install in **/opt/sphinx**. Create a service using config in sphinx.service. Copy to sphinx bin/ folder and configure FTS indexes in [**sphinx.conf**](./sphinx.conf) template. Make sure all paths are available. **/opt/sphinx** should be owned by the nonroot user.
|
||||
|
||||
## Tools to install
|
||||
1. NodeJS and NPM (currently Node v16, NPM v8)
|
||||
1. [Mongo DB tools](https://www.mongodb.com/try/download/database-tools?tck=docs_databasetools)
|
||||
1. Let's Encrypt CertBot, for certificates issuing and renewal. The certificate is installed using the following command: `certbot certonly -d your.server.name`. Use `--nginx` or `--apache` in order to have automatic renewal
|
||||
1. ffmpeg - for converting video and audio content
|
||||
1. ghostscript - for creating thumbnails for PDF files
|
||||
1. OpenSSH Server - to be able to access the server remotely
|
||||
1. UFW - Firewall, configure to allow access only on 443, 80, and 22 (if possible, only for specific hosts)
|
||||
1. rsync - for backup
|
||||
1. fail2ban - to protect from SSH attacks
|
||||
1. postfix - in order to get CRON jobs notifications
|
||||
1. mailutils - CRON jobs mail notifications
|
||||
1. In order to enable web server monitoring you can install and run:
|
||||
- Linux Dash using this [instruction](https://github.com/afaqurk/linux-dash). You can run it using `pm2 start ecosystem.config.js` (on https://your.server.name/host-monitor/) OR
|
||||
<!-- - Netdata (`app install netdata`) and https://your.server.name/netdata/ -->
|
||||
- [Netdata](https://learn.netdata.cloud/docs/installing/one-line-installer-for-all-linux-systems) - `wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --stable-channel`
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
/.dist
|
||||
/out
|
||||
/frontend
|
||||
.docs/out/
|
||||
/repo
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import { fileURLToPath } from 'url';
|
||||
class App{
|
||||
constructor(){
|
||||
this.root = path.resolve(dirname(fileURLToPath(import.meta.url)) + '/../../');
|
||||
console.log('App root is set to', this.root);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import path from 'path'
|
||||
|
||||
const pe = process.env;
|
||||
/**
|
||||
* Configuration class
|
||||
*/
|
||||
@@ -54,13 +54,13 @@ class Config{
|
||||
* @type {boolean}
|
||||
* @memberof SiteOptions
|
||||
*/
|
||||
ssl: true,
|
||||
ssl: !!parseInt(pe.SRV_SSL),
|
||||
|
||||
/** Port to use
|
||||
* @type {Number}
|
||||
* @memberof SiteOptions
|
||||
*/
|
||||
port: 3000,
|
||||
port: pe.SRV_PORT,
|
||||
|
||||
/**
|
||||
* @class Certificate data
|
||||
|
||||
@@ -73,25 +73,13 @@ class WebServer {
|
||||
* @param {App} app The application instance
|
||||
*/
|
||||
async start(app) {
|
||||
let indexFile = app.root + '/index.html';
|
||||
|
||||
let indexFileContent = fs.readFileSync(indexFile, { encoding: 'utf-8' });
|
||||
|
||||
function index(req, res) {
|
||||
//res.sendFile(indexFile);
|
||||
res.send(indexFileContent.replace(/\#NONCE\#/g, res.locals.cspNonce));
|
||||
}
|
||||
|
||||
this.xapp.get('/', index);
|
||||
|
||||
// app.config.langs.forEach(l => {
|
||||
// this.xapp.use('/' + l.code, index);
|
||||
// })
|
||||
|
||||
this.xapp.use(express.static(`${this.app.root}/dist/`));
|
||||
|
||||
this.xapp.use(express.static(`${this.app.root}/frontend/`));
|
||||
|
||||
this.xapp.use((req, res, next) => {
|
||||
if (req.method == 'GET' || req.method == 'POST') {
|
||||
if (req.method == 'GET'){
|
||||
res.sendFile(`${this.app.root}/frontend/index.html`);
|
||||
}else if (req.method == 'POST') {
|
||||
return res.status(404).end();
|
||||
} else next();
|
||||
});
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
call npm run build
|
||||
bash -c ./deploy.sh
|
||||
@@ -0,0 +1,8 @@
|
||||
rm -r ./.dist
|
||||
mkdir .dist
|
||||
cp -r backend ./.dist/
|
||||
cp -r frontend ./.dist/
|
||||
cp package.json ./.dist/
|
||||
cp package-lock.json ./.dist/
|
||||
|
||||
rsync -rv -e 'ssh -p 9922' ./.dist/ pronature@localhost:/var/node/pronature/
|
||||
@@ -63,6 +63,9 @@ export default defineConfig({
|
||||
'.vue',
|
||||
],
|
||||
},
|
||||
build:{
|
||||
outDir:'./frontend',
|
||||
},
|
||||
server: {
|
||||
watch: {
|
||||
ignored: /repo|3rdparty/
|
||||
|
||||
Reference in New Issue
Block a user