Projekt

Obecné

Profil

Server Installation and Service » Historie » Verze 35

Eliška Mourycová, 2021-06-13 12:46

1 22 Eliška Mourycová
h1. Server Installation
2 1 Eliška Mourycová
3
The server runs on Debian 10 VM at https://nuada.zcu.cz/
4 3 Eliška Mourycová
The ip of the machine is 147.228.173.54
5 1 Eliška Mourycová
6 13 Eliška Mourycová
The application was tested on a machine with the following specs:
7
8 3 Eliška Mourycová
h2. Hardware requirements
9 1 Eliška Mourycová
10 15 Eliška Mourycová
* *RAM size*
11
** 768 MB
12
* *Disk size*
13
** 4 GB
14
* *CPU architecture*
15
** x86_64
16 1 Eliška Mourycová
17
18 13 Eliška Mourycová
h2. Software requirements
19 3 Eliška Mourycová
20 15 Eliška Mourycová
* *OS, OS version*
21
** OS: Debian GNU/Linux 10, version 10.9
22 4 Eliška Mourycová
23 17 Eliška Mourycová
h2. Deploying the Server Application
24 1 Eliška Mourycová
25
26 7 Roman Kalivoda
h3. Building the project
27 1 Eliška Mourycová
28
At the moment, the easiest way to build the project is to build it locally in Windows with the following commands:
29
open windows command line (cmd.exe) in the directory where the solution file is located. Please make sure you can run `dotnet` command from the cmd. Make sure you have the right SDK on your system:
30 11 Eliška Mourycová
<pre>
31
dotnet --list-sdks
32
</pre>
33
34 7 Roman Kalivoda
Version 5.0 is needed to build the project. If you have this version, you can build the project:
35 1 Eliška Mourycová
36
<pre>
37
dotnet publish --runtime=linux-x64 ServerApp.sln
38
</pre>
39
40
The built project files are in folder:
41 27 Eliška Mourycová
<pre>
42 1 Eliška Mourycová
.\ServerApp\bin\Debug\net5.0\linux-x64\publish
43 27 Eliška Mourycová
</pre>
44 1 Eliška Mourycová
45
h3. Note
46
47
The project could probably be built on-site as well, but that would require .NET SDK to be installed and require larger disc space.
48
49 18 Eliška Mourycová
50
h3. Uploading the project to the remote machine
51
52
Upload the whole folder built with the commands below:
53
54
<pre>
55
scp -r /pathToFolder/publish root@{machine_ip}:/<path>/
56
</pre>
57
58
You can also upload the default configuration file:
59
60
<pre>
61
scp /path/server_config root@{machine_ip}:/<path>/
62
</pre>
63
64 1 Eliška Mourycová
65 18 Eliška Mourycová
h3. Server Configuration File
66 27 Eliška Mourycová
(See also [[Project architecture]])
67 19 Eliška Mourycová
68
The configuration file must contain the following lines:
69
70
* Site for OpenData (*site*)
71
* Data files naming convention (*naming_convention*)
72
* Root directory where data files are saved (*data_root_dir*)
73
* Port (*port*)
74
* Site for weather prediction (*weather_site*)
75
76
These lines must be followed by lines containing the desired values. 
77
Default setting of the config file is as follows:
78
79
h5. Site for opendata
80
81
The site configuration specifies the website where the UWB open data can be downloaded.
82
It is by default set to *http://openstore.zcu.cz/*
83
84
h5. naming_convention
85
86
The naming convention specifies how the archives available for download are named.
87
It is by default set to *OD_ZCU_{type}_{month}_{year}_{format}.zip*
88
Variables in this string must keep their name, cannot be excluded and others cannot be added. They must be enclosed in {} brackets.
89
{} characters are treated as special characters and cannot be used as a part of the name.
90
91
92
h5. data_root_dir
93
94 35 Eliška Mourycová
The data root directory specifies where the downloaded data will be stored. In this root directory subdirectories are automatically created for individual data types.
95
It is by default set to *./data/auto*. The path is relative to the config file's path.
96 1 Eliška Mourycová
97 35 Eliška Mourycová
Note: It is preferable for you to use linux style directory separator characters when configuring this path, i.e. '/'. Windows style might not create the (sub)directories as you would expect, however it would not hinder the server's functionality in any way.
98 34 Eliška Mourycová
99 19 Eliška Mourycová
h5. port
100
101
The port specifies the port number at which the part of the server listens for clients' connections.
102
It is by default set to *10000*
103
104
h5. site for weather prediction
105
106
Furthermore the configuration file can contain link to the site from which the weather prediction is downloaded. Used link must lead to a page with a json file in format that satisfies the format specified on page [[Data file structure]]
107
It is by default set to *http://wttr.in/Plzen,czechia?format=j1*
108 18 Eliška Mourycová
109 12 Eliška Mourycová
110
h3. Running the server
111 18 Eliška Mourycová
112 27 Eliška Mourycová
* A .p12 certificate file named *cert.p12* must exist in the directory where the app is launched
113 32 Eliška Mourycová
** We used this one, see the attached file: attachment:cert.p12
114 1 Eliška Mourycová
115
Firstly you most grant permission to run the executable:
116
117
<pre>
118 12 Eliška Mourycová
chmod +x <path>/ServerApp
119
</pre>
120
121
Then you can run the server:
122
123
<pre>
124
<path>/ServerApp <args>
125
</pre>
126 1 Eliška Mourycová
127 8 Eliška Mourycová
The path to the *server configuration file* must be passed as (the only) argument to the application.
128 7 Roman Kalivoda
129 30 Eliška Mourycová
h3. Important Notes
130 26 Eliška Mourycová
131 27 Eliška Mourycová
* *The shell from which the server application was started must remain open for as long as the server runs.* The server does not get forked into background in any way.
132
* The server app must be launched from a directory where all the needed binaries (located in the publish directory when built) are located.
133 8 Eliška Mourycová
134 23 Eliška Mourycová
135
h1. Admin Commands
136 24 Eliška Mourycová
137 33 Eliška Mourycová
h2. List of Available Commands
138
139 24 Eliška Mourycová
While the server is running, you can type commands into the console. The available commands are as follow:
140
* *data [OPTION] [DATE]...*
141
** Description: Capable of showing saved data files and downloading new ones.
142
** *-list*: Lists currently saved data files. This list does not have to match the files which any of the predictors is trained on!
143
*** Example: data -list
144
** *-dl [startDate] [endDate]*: <notextile>Downloads jis, login and weather files from a specified time span. Both [startDate] and [endDate] are inclusive. Date format must be entered as [month]-[year].</notextile>
145
*** Example: data -dl 1-2019 12-2020
146
147
148
* *model [OPTION]*
149
** Description: Capable of retraining the prediction model, going back to the previous version and listing files on which the predictor was trained.
150
** *-files*: Lists the data files on which the currently used model was trained.
151
*** Example: model -files
152
** *-retrain*: Retrains the model using the files currently saved in the data directory.
153
*** Example: model -retrain
154
** *-rollback*: Switches the model back to the previous version.
155
*** Example: model -rollback
156
157
158
* *help*
159
** Description: Lists available commands and their description.
160 25 Eliška Mourycová
161 33 Eliška Mourycová
162
h2. Input of Admin Commands
163
164
The commands can be input by simply typing into the shell where the server is running.
165 25 Eliška Mourycová
166
h1. Logging
167
168 28 Eliška Mourycová
The server logs information about its activity to a file named *server.log* located in the director where the server was launched.
169
It also creates 2 backup log files.
170
The logging configuration can be modified in
171
<pre>
172
<path>\Server\ServerApp\App.config
173
</pre>
174 29 Eliška Mourycová
175
By default, the application does not print logs to the console, this can be changed by modifying the following attribute in the *App.config* file:
176
177
Change
178
<pre>
179
180
<root>
181
<level value="ALL" />
182
   <appender-ref ref="LogFileAppender" />
183
</root>
184
185
</pre>
186
187
To
188
189
<pre>
190
191
<root>
192
<level value="ALL" />
193
   <appender-ref ref="LogFileAppender" />
194
   <appender-ref ref="ConsoleAppender" />
195
</root>
196
197 1 Eliška Mourycová
</pre>
198 34 Eliška Mourycová
199
200
Other parameters can also be configured, see https://logging.apache.org/log4net/release/manual/configuration.html for more details.