172 lines
5.6 KiB
Markdown
172 lines
5.6 KiB
Markdown
# 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 <package_name> --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
|
|
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
|
|
<proxies>
|
|
<proxy>
|
|
<id>ngas-proxy</id>
|
|
<active>true</active>
|
|
<protocol>http</protocol>
|
|
<host>eastproxy.northgrum.com</host>
|
|
<port>80</port>
|
|
<username>(your MyID)</username>
|
|
<password>(your login password)</password>
|
|
</proxy>
|
|
<proxy>
|
|
<id>ngas-proxy2</id>
|
|
<active>true</active>
|
|
<protocol>https</protocol>
|
|
<host>eastproxy.northgrum.com</host>
|
|
<port>80</port>
|
|
<username>(your MyID)</username>
|
|
<password>(your login password)</password>
|
|
</proxy>
|
|
</proxies>
|
|
<servers>
|
|
<server>
|
|
<id>flyway-localhost</id>
|
|
<username>root</username>
|
|
<password>(mysql root password)</password>
|
|
</server>
|
|
<server>
|
|
<!-- in tomcat conf/tomcat-users.xml specify a user that has role manager-script -->
|
|
<id>tomcat-localhost</id>
|
|
<username>(manager-script username)</username>
|
|
<password>(manager-script password)</password>
|
|
</server>
|
|
</servers>
|
|
<profiles>
|
|
<profile>
|
|
<id> local-deploy </id>
|
|
<properties>
|
|
<tomcat-home>C:\development\apache-tomcat-8.5.24-portal</tomcat-home>
|
|
<tomcat-version>8.5.24</tomcat-version>
|
|
<tomcat-base-url>http://localhost:8080</tomcat-base-url>
|
|
</properties>
|
|
</profile>
|
|
</profiles>
|
|
</settings>
|
|
```
|
|
|
|
## 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
|
|
|
|
<VirtualHost *:80>
|
|
RewriteEngine On
|
|
RewriteCond %{HTTP_HOST} ^(.*)$
|
|
RewriteRule ^(.*)$ https://%1$1 [R=Permanent,L,QSA]
|
|
</VirtualHost>
|
|
|
|
<VirtualHost *:443>
|
|
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/
|
|
</VirtualHost>
|
|
```
|
|
2. Restart and try navigating
|