urx-next
v1.0.0
Published
URX next - Front End application
Downloads
3
Readme
URX Front End App
Set Up Local Environment
In order to avoid CORS for IdaaS service, we will be using a host entry
127.0.0.1 idm02.somerslab.ibm.com
What this will is, it will serve localhost as idm02.somerslab.ibm.com
Nginx Reverse Proxy
error_log /usr/local/var/log/nginx/error.log;
events {
worker_connections 1024;
}
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream websocket {
server localhost:3001;
}
# This should be in the same directory as this conf
# e.g. /usr/local/etc/nginx
include mime.types;
default_type application/octet-stream;
# Note this log_format is named 'main', and is used with the access log below
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
keepalive_timeout 65;
# Without this I got this error: 'upstream sent too big header
# while reading response header from upstream'
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
server {
listen 443 ssl;
#server_name tools.caseonit.net;
access_log /usr/local/var/log/nginx/tools.caseonit main;
ssl_certificate /usr/local/etc/nginx/cert.crt;
ssl_certificate_key /usr/local/etc/nginx/cert.key;
#ssl on;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
location / {
#proxy_pass http://localhost:3001/;
proxy_pass http://websocket/;
}
location /account/register {
#proxy_pass http://localhost:3001/account/register;
proxy_pass http://websocket/account/register;
}
location /ibmid/myibm/profile {
#proxy_pass http://localhost:3001/;
proxy_pass http://websocket/;
}
}
}
https://idm02.somerslab.ibm.com/account/reg/signup?formid=urx-14321
Install it and run:
npm install
npm run dev
# or
yarn
yarn dev
Docker
create image
docker build -t sanjitbauli/urx-next .
run container in local system
docker run -d -p 3001:80 sanjitbauli/urx-next:latest
Environment variables
Environment variables are taking from .env file by default. Though while deployment in K8s it gets override by deployment.yaml by UCD. Environment variables in UCD can be found here (Dev env): https://ucdeploy2.swg-devops.com/#resource/16ef492a-9f27-2a3f-041b-2c677db8cc0f/configuration
Important :warning: if you use a different BASE_PATH in .env and run time environment, then Pre-render will stop working.
Dev Notes
Router Push & Link examples
import {Link, Router} from '../../routes';
<Link routes={getPath(ROUTES_PATH.LOGIN, locale, query)} >
<a>
{t('login')}
</a>
</Link>
<a href={`#`} onClick={(e)=>{
e.preventDefault();
Router.pushRoute(getPath(ROUTES_PATH.LOGIN, locale, query));
}}>Login</a>
Style Guidelines:
Break Points
@include breakpoint.breakpoint-up('md') {
// starts from width 672px
}
@include breakpoint.breakpoint-up('lg') {
// starts from width 1056px
@include carbon--make-col(2, 16);
}
$TEMP--breakpoint-down--md: map-get(
map-get($carbon--grid-breakpoints, 'md'),
'width'
) - rem(1px);
Manage images in registry
https://cloud.ibm.com/docs/services/Registry?topic=registry-registry_quota#registry_quota
Deployment
All future deployment will be done via Tekton https://web-platform-dev-d4b80535626182c66d855ee969650fc9-0004.us-south.containers.appdomain.cloud/