Projekt

Obecné

Profil

Server Installation and Service » Historie » Revize 20

Revize 19 (Eliška Mourycová, 2021-06-04 19:01) → Revize 20/36 (Eliška Mourycová, 2021-06-04 19:02)

h1. Server Installation 

 The server runs on Debian 10 VM at https://nuada.zcu.cz/ 
 The ip of the machine is 147.228.173.54 

 The application was tested on a machine with the following specs: 

 h2. Hardware requirements 

 * *RAM size* 
 ** 768 MB 
 * *Disk size* 
 ** 4 GB 
 * *CPU architecture* 
 ** x86_64 


 h2. Software requirements 

 * *OS, OS version* 
 ** OS: Debian GNU/Linux 10, version 10.9 
 * -Mono, version 5.18.0.240- 

 h2. Deploying the Server Application 


 h3. Building the project 

 At the moment, the easiest way to build the project is to build it locally in Windows with the following commands: 
 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: 
 <pre> 
 dotnet --list-sdks 
 </pre> 

 Version 5.0 is needed to build the project. If you have this version, you can build the project: 

 <pre> 
 dotnet publish --runtime=linux-x64 ServerApp.sln 
 </pre> 

 The built project files are in folder: 
 .\ServerApp\bin\Debug\net5.0\linux-x64\publish 


 h3. Note 

 The project could probably be built on-site as well, but that would require .NET SDK to be installed and require larger disc space. 


 h3. Uploading the project to the remote machine 

 Upload the whole folder built with the commands below: 

 <pre> 
 scp -r /pathToFolder/publish root@{machine_ip}:/<path>/ 
 </pre> 

 You can also upload the default configuration file: 

 <pre> 
 scp /path/server_config root@{machine_ip}:/<path>/ 
 </pre> 


 h3. Server Configuration File 
 (or delete this and put link to [[Project architecture]]) [[]]) 

 The configuration file must contain the following lines: 

 * Site for OpenData (*site*) 
 * Data files naming convention (*naming_convention*) 
 * Root directory where data files are saved (*data_root_dir*) 
 * Port (*port*) 
 * Site for weather prediction (*weather_site*) 

 These lines must be followed by lines containing the desired values.  
 Default setting of the config file is as follows: 

 h5. Site for opendata 

 The site configuration specifies the website where the UWB open data can be downloaded. 
 It is by default set to *http://openstore.zcu.cz/* 

 h5. naming_convention 

 The naming convention specifies how the archives available for download are named. 
 It is by default set to *OD_ZCU_{type}_{month}_{year}_{format}.zip* 
 Variables in this string must keep their name, cannot be excluded and others cannot be added. They must be enclosed in {} brackets. 
 {} characters are treated as special characters and cannot be used as a part of the name. 


 h5. data_root_dir 

 The data root directory specifies where the downloaded data will be stored. In this root directory subdirectories are created for individual data types. 
 It is by default set to *.\data\auto* (relative to the config file's path) 

 h5. port 

 The port specifies the port number at which the part of the server listens for clients' connections. 
 It is by default set to *10000* 

 h5. site for weather prediction 

 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]] 
 It is by default set to *http://wttr.in/Plzen,czechia?format=j1* 


 h3. Running the server 

 * -A folder named *data* must exist in the directory where the app is launched- 
 * A .p12 file named *cert.p12* must exist in the directory where the app is launched 
 ** We used this one: attachment:cert.p12 

 Firstly you most grant permission to run the executable: 

 <pre> 
 chmod +x <path>/ServerApp 
 </pre> 

 Then you can run the server: 

 <pre> 
 <path>/ServerApp <args> 
 </pre> 

 The path to the *server configuration file* must be passed as (the only) argument to the application. 

 h3. Note 

 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. 



 --- 

 h3. Certificate generation and usage (DEPRECATED) 

 This section provides instructions for generating and using a certificate with a secific port. 
 *Important note*: this approach was used when the server application ran under the Mono framework. Mono is no longer used for running the application as it was unable to use some needed libraries. 
 * Follow these steps if the above stated instructions didn't work as expected. 

 h4. Mono installation 

 <pre> 
 sudo apt install mono-complete 
 </pre> 


 h4. Generating the certificate 

 http://www.mono-project.com/archived/using-clientcertificates-with-xsp/ 

 <pre> 
 makecert -r -n "CN=My Own Test CA" -sv root.key root.cer 
 certmgr --add -c Trust root.cer 
 hostname (displays the machine's host name) 
 makecert -iv root.key -ic root.cer -eku 1.3.6.1.5.5.7.3.1 -n "CN={hostname}" -p12 {hostname}.p12 s3kr3t 
 </pre> 

 h4. Linking the certificate to a port? 

 <pre> 
 httpcfg -add -port {port} -pvk root.key -cert root.crt 
 </pre> 

 h4. Adding trusted root certificates to the server 

 Copy your CA to dir /usr/local/share/ca-certificates/ 
 Use command: sudo cp foo.crt /usr/local/share/ca-certificates/foo.crt 
 Update the CA store: sudo update-ca-certificates 

 ---