mechevarria / cp-rtwp

SAP Cloud Platform deployable system with Vue.js, Express, SAP HANA and Keycloak components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Table of Contents generated with DocToc

Cloud Platform - Return to Work Package

Documentation is WORK IN PROGRESS
SAP Cloud Platform deployable Keycloak secured system that deploys multiple microservices that takes advantage of the built in search index, geospatial and text analysis libraries in SAP HANA as well as manage SAP Cloud Platform Workflows for visitor management

Requirements

  • For deployment on SAP Cloud Platform, a configured CloudFoundry cli with access to a user or trial account
  • For deployment on SAP Cloud Plaform, Keycloak requires a hosted Postgresql backend. Project built with free tier instance from Amazon RDS
  • Registration email feature in Keycloak requires a sendmail server. Project built with Amazon SES

Development

  • nodejs environment
  • To take advantage of the simplified project deployment scripts you need the following environment variables set. Below are are example values only
export CP_USER=i999111
export CP_PASSWORD=MyAccountPassword55
export PG_ADDR=cp-rtwp.random-string-text.us-east-1.rds.amazonaws.com
export PG_PASSWORD=WholeBunchOfCharacters
export KEYCLOAK_URL=https://keycloak-server.com/auth

architecture

Keycloak container

keycloak login

  • Deployed with cf-keycloak.sh

    • Default vendor, user and database are all postgres
    • PG_ADDR variable is just the hostname or ip address: sample-app.abcdefg.us-east-1.rds.amazonaws.com
  • Keycloak security is disabled by default. Changing the environment variable to true enables integration

Build

  • Requires a PostgreSQL backend.

    This project was developed with a free tier Amazon RDS instance.

  • Run the build script to copy over the custom CoreUI based theme
cd keycloak
./docker-build.sh

Run

  • Update keycloak/docker-run.sh to have the values for your PostgreSQL instance.

    PG_ADDR and PG_PASSWORD are externalized to environment variables to avoid being checked into source control

cd keycloak
./docker-run.sh

Development

  • Make sure the keycloak container is running. Get the id of the running container from this command
docker ps -f ancestor=quay.io/mechevarria/keycloak-coreui | awk '{print $1}'
  • Copy the over the theme directory from the container by replacing $container with the value from the previous command. The system themes are automatically ignored by git
docker cp $container:/opt/jboss/keycloak/themes keycloak/
  • Build a development image (turns off caching of pages)
cd keycloak
./docker-build-dev.sh
  • Run the development image (mount the local themes directory)
cd keycloak
./docker-run-dev.sh
  • Changes made locally to keycloak/themes will be seen when you refresh server pages in your browser.

SAP HANA Container

  • Deployed with cf-db.sh
  • A container named hdi-hana-deployer will be created in SAP Cloud Platform to deploy the hana database, populate data and create tables, indexes, etc. The container will then be stopped once complete

Express Container

Requires the SAP HANA database container to be deployed. Local development requires the SAP HANA host to whitelist external addresses

Development

  • Inside the rtwp-api run the following to install all dependencies
npm install
  • Start a development server with changes hot deployed
cd rtw-api
npm install
./local-run.sh

The one parameter to the deployment script is the prefix. Example: prod or mechevarria

  • Deployed with
./cf-express-api.sh mechevarria
  • Change the KEYCLOAK environment variable to true to enable sso integration

Vue.js Container

Requires the Express container to be deployed

Development server with hotswap

cd rtwp-admin
npm install

./local-setup.sh 

npm run serve

Compiles and minifies for production

npm run build

Deploy to SAP Cloud Platform

You can create an account for free at SAP Cloud Platform

  • Make sure you have the Cloud Foundry Command Line Interface (cf CLI) installed

  • Update the cf-login.sh script with the values found in the SAP Cloud Foundry Cockpit. Then run the script to login. The one parameter to the script is the space your want to login to. Example rtwp-dev

./cf-login.sh rtwp-dev
  • Push your code directly without the need of a container registry with the following commands (make sure you have done a build ahead of time). The one parameter to the script is a prefix for the app name. Example prod or mechevarria for development
./cf-rtwp-admin.sh mechevarria
  • You will find a url to your deployed application in the SAP Cloud Foundry Cockpit.

Customize configuration

See Configuration Reference.

Integration and Links

About

SAP Cloud Platform deployable system with Vue.js, Express, SAP HANA and Keycloak components


Languages

Language:Vue 49.4%Language:FreeMarker 21.9%Language:JavaScript 21.4%Language:Shell 6.7%Language:HTML 0.6%Language:Dockerfile 0.1%