# SETUP - Development --- 1. Clone the repository from BigMac: - Add your public key to BigMac account. - Clone the repository: `git clone "ssh://git@bigmac.northgrum.com:8010/saipt/portal-webapp.git"` 2. Create/Edit `settings.xml` in your `.m2` folder (see next section for example) 3. This project requires ngas-commons to be built prior to building this application - Checkout `ngas-commons` (`"ssh://git@bigmac.northgrum.com:8010/saipt/ngas-commons.git"`) - Change directories into `ngas-commons` and run `mvn clean install` 4. Change directories into the project and run `mvn clean install` (This might take awhile) 5. Once the server launches, you should be able to access the webapp by browsing to `http://localhost:8080/portal/` ## Yarn --- Yarn is the the new package manager used with node.js in replacement of `npm` it uses the same package.json file. To download a new client side library use the command `yarn add --save`. This will add the files to the `node_modules` library. Next include the appropriate file into the `assets.js` file inside `portal_client` to make sure it will be injected into the `index.html` file during run time. The `assets.js` file specifies all the vendor libraries that have to be included into the client code during build. ## Settings.xml --- If developing on the NGGN the proxy settings are needed to download the libraries Sample: ```xml ngas-proxy true http eastproxy.northgrum.com 80 (your MyID) (your login password) ngas-proxy2 true https eastproxy.northgrum.com 80 (your MyID) (your login password) flyway-localhost root (mysql root password) tomcat-localhost (manager-script username) (manager-script password) local-deploy C:\development\apache-tomcat-8.5.24-portal 8.5.24 http://localhost:8080 ``` ## Configuring Tomcat --- Tomcat cannot run on port 80 or 443 unless it is is running as root (big security concern with that). It is suggested to use proxy services like `NGINX` or `Apache` to proxy 80 or 443 traffic to redirect to tomcat #### NGINX 1. In the default /etc/nginx/conf.d add a file called portal.conf 2. Populated it with the values below ``` conf proxy_cache_path /tmp/NGINX_cache/ keys_zone=backcache:10m; map $http_upgrade $connection_upgrade { default upgrade; '' close; } upstream tomcat { # Use IP Hash for session persistence ip_hash; # List of Tomcat application servers server 127.0.0.1:8080; } server { listen 80; server_name portal.viprcenter.com; client_max_body_size 0; # Redirect all HTTP requests to HTTPS location / { return 301 https://$server_name$request_uri; } } server { listen 443 ssl http2; server_name portal.viprcenter.com; client_max_body_size 0; ssl_certificate /etc/nginx/ssl/portal.viprcenter.com.crt; ssl_certificate_key /etc/nginx/ssl/portal.viprcenter.com.key; ssl_session_cache shared:SSL:1m; ssl_prefer_server_ciphers on; # WebSocket configuration location / { proxy_pass http://tomcat; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Host $remote_addr; } } ``` 3. Save the file 4. Modify `/etc/nginx/nginx.conf` 5. In the http section of the conf file add `include /etc/nginx/conf.d/portal.conf` 6. Restart NGINX 7. Navigate to the url. It should redirect to 443 #### Apache 1. In apaches `httpd.conf` file add the following ``` conf Listen 80 Listen 443 RewriteEngine On RewriteCond %{HTTP_HOST} ^(.*)$ RewriteRule ^(.*)$ https://%1$1 [R=Permanent,L,QSA] SSLEngine On SSLCertificateFile /etc/apache/ssl/portal.viprcenter.com.crt SSLCertificateKeyFile /etc/apache/ssl/portal.viprcenter.com.key ProxyPreserveHost On ProxyPass / http://127.0.0.1:8080/ ProxyPassReverse / http://127.0.0.1:8080/ ``` 2. Restart and try navigating