User Tools
development:applications:fiber
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| development:applications:fiber [2019/04/16 17:08] – mzubal | development:applications:fiber [2021/06/25 10:09] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Fiber Project ====== | ||
| + | TODO: Introduction, | ||
| + | |||
| + | ===== In a nutshell ===== | ||
| + | There are following google drive documents, which describe the whole project in a detail: [[https:// | ||
| + | [[https:// | ||
| + | |||
| + | Fiber is a Google Map Client which draws custom elements over the Map. | ||
| + | These custom elements along with their attributes and latitude-longitudes are loaded from a XML file provided by ExteNet GIS team. | ||
| + | |||
| + | ===== Operations ===== | ||
| + | ==== Deployment ==== | ||
| + | Fiber is deployed from [[http:// | ||
| + | |||
| + | ==== Application Service ==== | ||
| + | Fiber is installed as an init.d service in linux: | ||
| + | < | ||
| + | [scotty@blade12(sfqaapps1) ~]$ls -la / | ||
| + | lrwxrwxrwx. | ||
| + | </ | ||
| + | |||
| + | This means there is no startup/ | ||
| + | < | ||
| + | [scotty@blade12(sfqaapps1) ~]$service fiber stop | ||
| + | Stopped [22697] | ||
| + | [scotty@blade12(sfqaapps1) ~]$service fiber start | ||
| + | Started [20705] | ||
| + | [scotty@blade12(sfqaapps1) ~]$service fiber restart | ||
| + | Stopped [20705] | ||
| + | Started [7755] | ||
| + | </ | ||
| + | |||
| + | Please check the fiber.conf below to see how to set the JAVA_OPTS like heap etc. | ||
| + | |||
| + | ==== Server folder structure ==== | ||
| + | All the applications artefacts reside in the /// | ||
| + | < | ||
| + | [scotty@blade12(sfqaapps1) ~]$ls -la / | ||
| + | total 149700 | ||
| + | drwxr-xr-x. 2 scotty root 4096 Dec 15 08:33 . | ||
| + | drwxr-xr-x. 4 scotty root 4096 Sep 28 01:45 .. | ||
| + | -rw-r--r--. 1 scotty root 3455 Dec 5 05:05 application.properties | ||
| + | -rw-r--r--. 1 scotty root 342 Oct 11 04:45 fiber.conf | ||
| + | -rw-r--r--. 1 scotty scotty | ||
| + | -rw-r--r--. 1 scotty scotty | ||
| + | -rw-r--r--. 1 scotty scotty | ||
| + | -rw-r--r--. 1 scotty scotty | ||
| + | -rw-r--r--. 1 scotty scotty | ||
| + | -rw-r--r--. 1 scotty scotty | ||
| + | -rw-r--r--. 1 scotty scotty | ||
| + | -rw-r--r--. 1 scotty scotty | ||
| + | -rw-r--r--. 1 scotty scotty | ||
| + | -rw-r--r--. 1 scotty scotty 10651370 Dec 5 05:05 fiber.log.1 | ||
| + | -rw-r--r--. 1 scotty scotty 11009850 Dec 5 05:05 fiber.log.2 | ||
| + | -rw-r--r--. 1 scotty root | ||
| + | -rw-r--r--. 1 scotty root 6 Dec 5 07:46 fiber.pid | ||
| + | -rwxr--r--. 1 scotty root | ||
| + | -rw-r--r--. 1 scotty root 777 Dec 5 07:46 logback-spring.xml | ||
| + | </ | ||
| + | === fiber.conf === | ||
| + | The fiber.conf contains the basic java options for the application (location of the java, JAVA_OPTS, heap, etc.). Please check [[https:// | ||
| + | |||
| + | === application.properties === | ||
| + | This is equivalent to our Groovy.configs - all the DB connection string, URLs and other settings are there. | ||
| + | |||
| + | The application needs to be restarted in order to any changes to this config take effect. | ||
| + | |||
| + | === Adding new user to Fiber === | ||
| + | Fiber is not integrated with Global Admin tool and there is no UI for creating the users (e.g. in case there is a new NOC team member). Following SQL script can be used in order to create the user manually (please modify the username to the desired one). It assumes that the same username is already in the snmp_manager (so that the SSO will check password against it and we don't have to specify the user's password in the fiber db, but the password value cannot be null, otherwise it can cause issues with CAS authentication for that user in ALL applications). | ||
| + | < | ||
| + | use fiber; | ||
| + | insert into fiber.user(id, | ||
| + | update fiber.user_seq set next_val = next_val + 1 LIMIT 1; | ||
| + | commit; | ||
| + | </ | ||
| + | |||
| + | === Adding new state to fiber === | ||
| + | Since version 3.6 Fiber states are stored in the fiber.state table along with all the geometries (center, bounds and polygon). Inserting the geometries manually is tricky so there is a utility to support that. | ||
| + | First you have to create the state record (please change the abbreviation and name for something real): | ||
| + | < | ||
| + | use fiber; | ||
| + | insert into fiber.state(id, | ||
| + | update fiber.state_seq set next_val = next_val + 1 LIMIT 1; | ||
| + | commit; | ||
| + | </ | ||
| + | Then you have to populate the geometries, there is a Fiber REST Endpoint to support this (which utilises OpenStreetMap API to get the actual polygon). | ||
| + | You have to login to a fiber in browser (e.g. sfqa) and then use following URL in the browser (please change the params per your state): | ||
| + | |||
| + | http:// | ||
| + | |||
| + | The query is a fulltext query to OpenStreetMaps and the results are update statements for whatever is returned. It is possible that results will contain multiple records, just like this: | ||
| + | |||
| + | Česko: **UPDATE state SET bounds = GeomFromText(' | ||
| + | |||
| + | You have to manually pick the update sql part just as shown above and the run the query in the db as well (which will update the geometries). | ||
| + | After executing this, go to fiber and verify the state is in the dropdown and that selecting it will bring you to the correct place on the map. | ||
| + | |||
| + | === Loading new GIS data snapshot === | ||
| + | The GIS data is provided by ExteNet (usually in [[https:// | ||
| + | |||
| + | The GIS file can be uploaded to Fiber (Fiber -> Menu -> Import Data). The UI should show no errors and the numbers should keep moving. The whole process might take up to few hours (we are importing millions of records). | ||
| + | |||
| + | Once the file is uploaded try checking the Fiber app (choosing one of the States, like IL, and verifying the data loads). | ||
| + | |||
| + | In case there is an error during the loading (or the loading gets stuck), check the fiber logs for more details. | ||
| + | |||
| + | == Analyse missing Network ID mappings == | ||
| + | You will need to download the logs for the particular upload - this is in Fiber -> Menu -> Import Data -> Logs (locate the latest record and hit ' | ||
| + | Then run the following script to extract the missing Network ID mappings (put in the right log filename): | ||
| + | < | ||
| + | cat < | ||
| + | </ | ||
| + | |||
| + | The resulting data can be put into excel spreadsheet and shared with ExteNet. | ||
| + | The used script is also stored in fiber_component repo (fiber_component/ | ||
| + | |||
| + | === Changing the mail list for e-mail notifications === | ||
| + | Fiber 3.6 has introduced automated imports of GIS data. This process ends with sending an e-mail notification to share outcomes of the import. | ||
| + | The list of recipients of this notification can be changed in // | ||
| + | |||
| + | |||
| + | ===== Methodology ===== | ||
| + | ==== Tools ==== | ||
| + | Following table describes specific tools used on Fiber project. It doesn' | ||
| + | |||
| + | | ^ Purpose ^ Additional Information ^ | ||
| + | ^ SonarLint | Static code analysis tool | IDEA Plugin capable of performing code quality checks. It can be integrated to existing SonarQube server to delegate the analysis to it. | | ||
| + | ^ SonarQube | Static code analysis server | More info at [[https:// | ||
| + | ^ Jenkins 2 | Build Server | More info at [[https:// | ||
| + | ^ Postman | REST Client | More info at [[https:// | ||
| + | |||
| + | ==== Before every Push ==== | ||
| + | - Make sure the commits are cohesive and with good commit message | ||
| + | - Run SonarLint to reveal any code quality issues in your commits and try to fix them | ||
| + | - Run/Fix Unit Tests | ||
| + | - Run/Fix Integration Tests | ||
| + | |||
| + | ==== After Push ==== | ||
| + | - Try to check the Jenkins pipeline if it ran well (Jenkins will be configured to send e-mail notifications soon) | ||
| + | |||
| + | ==== Project Structure ==== | ||
| + | Following figure depicts the main concepts of the application structure (rules are mentioned below). | ||
| + | {{: | ||
| + | |||
| + | Every developer should follow these rules when creating new classes in the project: | ||
| + | * The base package for the whole project is // | ||
| + | * Each application modules (// | ||
| + | * //api// - definition of interfaces | ||
| + | * // | ||
| + | * //rest// - REST Controllers (TODO: add link to section with description how to implement them) | ||
| + | * // | ||
| + | * // | ||
| + | * //< | ||
| + | |||
| + | ==== Use of Spring ==== | ||
| + | The classes in //src// folder of the project make use of Spring. This replaces the use of Grails Holders, but practically does the same thing. The main reason to do that is to let all the Spring Controllers, | ||
| + | |||
| + | === IoC - Instantiation and wiring of beans === | ||
| + | It is encourage to use Spring annotations to allow Spring to handle class instantiation of any service defined by us and it's injection to other classes. The Spring annotation for bean injection can be used in following way: | ||
| + | {{: | ||
| + | |||
| + | There is the // | ||
| + | |||
| + | === Injecting values from configuration === | ||
| + | |||
| + | Example: There is configuration property // | ||
| + | |||
| + | {{: | ||
| + | |||
| + | ==== Implementing Controllers ==== | ||
| + | Use Spring Controllers and take inspiration from existing Controllers. | ||
| + | |||
| + | ==== Implementing Unit Tests ==== | ||
| + | |||
| + | |||
| + | ==== Implementing Integration Tests ==== | ||
| + | |||
| + | ==== Logging ==== | ||
| + | * Avoid using println and use //@Slf4j// where possible | ||
| + | * Use the log levels appropriately | ||
| + | * It is good to make the values in logs easy to parse (e.g. RequestIds, request params, etc.) | ||
| + | |||
| + | ==== Running Integration Tests ==== | ||
| + | |||
| + | ==== Security related problems ==== | ||
| + | If you face any security related exceptions while running the project, then you are most likely missing the required certificate. | ||
| + | |||
| + | < | ||
| + | / | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | ===== Improvement Candidates ===== | ||
| + | A place to note all the possible improvements that we decide not to implement, but could be done in future. | ||
| + | We might also put them as a Backlog to JIRA. | ||
| + | |||
| + | |||