Giter Club home page Giter Club logo

restaf-server's Introduction

Application servers for use with SAS Viya

This package has two servers:

  1. viya-appserverjs - Use this for developing an app server for web applications(see packages/appjs)

  2. viya-apiserverjs - Use this to develop rest api servers(see packages/apijs)

Usage

Specify it as a dependency in your package.json just as you do with other dependencies

Use npx command to start the server

npx @sassoftware/viyaappserverjs

Basic configuration

  1. Set the default settings in Dockerfile. This will ensure these are set when you build containers.
  2. The defaults can be overriden using environment variables.

Sample env file

When running on a non-docker environment, you can use a .env

VIYA_SERVER=<your viya server>
APPHOST=localhost < can also be dns name of your server. ex: viyaiscool.unx.sas.com>
APPPORT=5000   <any port of your choice>
APPNAME=viyaapp

CLIENTID=viyaapp
CLIENTSECRET=secret

Sample Dockerfile

FROM node:12.16.1-alpine
LABEL maintainer="your email"
WORKDIR /usr/src/app
COPY . .
RUN npm install
# RUN npm run build (if you have to build something)
EXPOSE 8080
ENV APPHOST=0.0.0.0

AUTHFLOW=code

# The following are defaults. Override them as needed
# APPLOC - where the file specified in APPENTRY is
# APPENTRY - the main entry of the application
ENV APPLOC=./public
ENV APPENTRY=index.html
# if your app takes advantage of appenv.js to pass configuration to the web application 
# ENV APPENV=appenv.js 

# See notes below on running with SSL enabled
ENV TLS_CREATE="C:US,ST:NC,L:Cary,O:yourcompany,OU:STO,CN:localhost"
ENV SAMESITE=None,secure

# It is better to set this before invoking the server
ENV NODE_TLS_REJECT_UNAUTHORIZED=0

# set this to YES if you want access to the authentication token in the app
ENV USETOKEN=NO

CMD ["npx", "@sassoftware/viya-appserverjs"]

Running with SSL enabled -- Recommended

This is the recommended setting. This will also make browsers like Chrome run with the SAMESITE settings set to Default - your users will thank you.

Make sure you specify the VIYA_SERVER with a protocol of https.

TLS certificates

  • Option 1: Let server create a temporary unsigned certificate

    ENV TLS_CREATE=C:US,ST:NC,L:Cary,O:YourCompany,OU:yourgroup,CN:localhost
  • Option 2: Provide your own key and certificate key

ENV TLS_KEY=../certs/self/key.pem
ENV TLS_CERT=../certs/self/certificate.pem
  • Option 3: Provide key and certificate as a pfx file
ENV TLS_PFX=../certs/sascert/sascert2.pfx

restaf-server's People

Contributors

dependabot[bot] avatar devakumaraswamy avatar vladislaff avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

restaf-server's Issues

Deployment with Docker and Kubernetes

Hello,

does anyone already have experience with deploying restaf-server with docker and kubernetes? We are able to run the server on localhost but when we try to deploy it to kubernetes we got either a "Bad Gateway 502 nginx" error (case 1) or the Kubernetes-Pod (and Docker Container) cannot be started (case 2). We tried two different things:

  1. We left the APPHOST as localhost and did some adjustments to the .env-file, the Docker-file and created a deplyoment.yaml file to deploy the app to kubernetes (files attached)
    case1.zip

  2. We tried to set the APPHOST as "our-viya-server.com" and created a corresponding clientid and a clientsecret with redirect URI "https://our-viya-server.com/viyaapp". When we try this, the app gives us following error:
    Error: listen EADDRNOTAVAIL: address not available {ip-adress-of-our-viya-server}:8080 (files attached)
    case2.zip

The app should be accessible via "https://our-viya-server.com/viyaapp". As I've mentioned we get the app running on localhost but stuck with the deployment to kubernetes. We would be grateful for any advice.

Kind regards
Max

In next, yarn dev seems to be broken

The symptoms are:

  • yarn dev mode seems to not inherit ssl - causing it to not find the propr redirect in proxy handler. Suspect that HTTPS is not being set.
  • dev server is starting on http and not https.

Issue-1: Allow a route to be APPENTRY

To support create-react-restaf-viya-app allow specification of APPENTRY as follows:

APPENTRY=/{APPNAME}/{route}

ex:

APPENTRY=/viyademo/develop

This is a relatively simple change

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.