Server Installation and Service » Historie » Verze 19
Eliška Mourycová, 2021-06-04 19:01
1 | 16 | 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 | 14 | Eliška Mourycová | * -Mono, version 5.18.0.240- |
23 | 4 | Eliška Mourycová | |
24 | 17 | Eliška Mourycová | h2. Deploying the Server Application |
25 | 1 | Eliška Mourycová | |
26 | |||
27 | 7 | Roman Kalivoda | h3. Building the project |
28 | 1 | Eliška Mourycová | |
29 | At the moment, the easiest way to build the project is to build it locally in Windows with the following commands: |
||
30 | 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: |
||
31 | 11 | Eliška Mourycová | <pre> |
32 | dotnet --list-sdks |
||
33 | </pre> |
||
34 | |||
35 | 7 | Roman Kalivoda | Version 5.0 is needed to build the project. If you have this version, you can build the project: |
36 | 1 | Eliška Mourycová | |
37 | <pre> |
||
38 | dotnet publish --runtime=linux-x64 ServerApp.sln |
||
39 | </pre> |
||
40 | |||
41 | The built project files are in folder: |
||
42 | .\ServerApp\bin\Debug\net5.0\linux-x64\publish |
||
43 | |||
44 | |||
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 | |||
65 | h3. Server Configuration File |
||
66 | 19 | Eliška Mourycová | (or delete this and put link to [[]]) |
67 | |||
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 | The data root directory specifies where the downloaded data will be stored. In this root directory subdirectories are created for individual data types. |
||
95 | It is by default set to *.\data\auto* (relative to the config file's path) |
||
96 | |||
97 | h5. port |
||
98 | |||
99 | The port specifies the port number at which the part of the server listens for clients' connections. |
||
100 | It is by default set to *10000* |
||
101 | |||
102 | h5. site for weather prediction |
||
103 | |||
104 | 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]] |
||
105 | It is by default set to *http://wttr.in/Plzen,czechia?format=j1* |
||
106 | 18 | Eliška Mourycová | |
107 | |||
108 | 12 | Eliška Mourycová | h3. Running the server |
109 | |||
110 | 18 | Eliška Mourycová | * -A folder named *data* must exist in the directory where the app is launched- |
111 | 1 | Eliška Mourycová | * A .p12 file named *cert.p12* must exist in the directory where the app is launched |
112 | ** We used this one: attachment:cert.p12 |
||
113 | |||
114 | Firstly you most grant permission to run the executable: |
||
115 | |||
116 | <pre> |
||
117 | 12 | Eliška Mourycová | chmod +x <path>/ServerApp |
118 | </pre> |
||
119 | |||
120 | Then you can run the server: |
||
121 | |||
122 | <pre> |
||
123 | <path>/ServerApp <args> |
||
124 | </pre> |
||
125 | 18 | Eliška Mourycová | |
126 | The path to the *server configuration file* must be passed as (the only) argument to the application. |
||
127 | |||
128 | h3. Note |
||
129 | |||
130 | 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. |
||
131 | 12 | Eliška Mourycová | |
132 | |||
133 | |||
134 | 1 | Eliška Mourycová | --- |
135 | 11 | Eliška Mourycová | |
136 | 1 | Eliška Mourycová | h3. Certificate generation and usage (DEPRECATED) |
137 | 11 | Eliška Mourycová | |
138 | 1 | Eliška Mourycová | This section provides instructions for generating and using a certificate with a secific port. |
139 | 12 | Eliška Mourycová | *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. |
140 | * Follow these steps if the above stated instructions didn't work as expected. |
||
141 | 1 | Eliška Mourycová | |
142 | 12 | Eliška Mourycová | h4. Mono installation |
143 | |||
144 | <pre> |
||
145 | sudo apt install mono-complete |
||
146 | </pre> |
||
147 | |||
148 | |||
149 | 11 | Eliška Mourycová | h4. Generating the certificate |
150 | |||
151 | http://www.mono-project.com/archived/using-clientcertificates-with-xsp/ |
||
152 | 7 | Roman Kalivoda | |
153 | 2 | Eliška Mourycová | <pre> |
154 | 1 | Eliška Mourycová | makecert -r -n "CN=My Own Test CA" -sv root.key root.cer |
155 | certmgr --add -c Trust root.cer |
||
156 | 9 | Eliška Mourycová | hostname (displays the machine's host name) |
157 | makecert -iv root.key -ic root.cer -eku 1.3.6.1.5.5.7.3.1 -n "CN={hostname}" -p12 {hostname}.p12 s3kr3t |
||
158 | 1 | Eliška Mourycová | </pre> |
159 | 10 | Eliška Mourycová | |
160 | 1 | Eliška Mourycová | h4. Linking the certificate to a port? |
161 | 9 | Eliška Mourycová | |
162 | 7 | Roman Kalivoda | <pre> |
163 | 2 | Eliška Mourycová | httpcfg -add -port {port} -pvk root.key -cert root.crt |
164 | 8 | Eliška Mourycová | </pre> |
165 | 11 | Eliška Mourycová | |
166 | 16 | Eliška Mourycová | h4. Adding trusted root certificates to the server |
167 | 2 | Eliška Mourycová | |
168 | 8 | Eliška Mourycová | Copy your CA to dir /usr/local/share/ca-certificates/ |
169 | 7 | Roman Kalivoda | Use command: sudo cp foo.crt /usr/local/share/ca-certificates/foo.crt |
170 | 8 | Eliška Mourycová | Update the CA store: sudo update-ca-certificates |
171 | 11 | Eliška Mourycová | |
172 | 8 | Eliška Mourycová | --- |