mirror of
https://github.com/sasjs/server.git
synced 2025-12-11 19:44:35 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09d36bc754 | ||
|
|
3722bbaec3 | ||
|
|
480ee4da83 | ||
|
|
dd853fe13b | ||
|
|
e1142a33a0 | ||
|
|
d4e8d91cae | ||
|
|
9a74ec545d |
@@ -1,4 +1,5 @@
|
|||||||
SAS_EXEC=<path to folder containing SAS executable 'sas'>
|
SAS_EXEC_PATH=<path to folder containing SAS executable>
|
||||||
|
SAS_EXEC_NAME=<name of SAS executable file>
|
||||||
PORT_API=<port for sasjs server (api)>
|
PORT_API=<port for sasjs server (api)>
|
||||||
PORT_WEB=<port for sasjs web component(react)>
|
PORT_WEB=<port for sasjs web component(react)>
|
||||||
ACCESS_TOKEN_SECRET=<secret>
|
ACCESS_TOKEN_SECRET=<secret>
|
||||||
|
|||||||
115
.github/CONTRIBUTING.md
vendored
Normal file
115
.github/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
# CONTRIBUTING
|
||||||
|
|
||||||
|
Contributions are very welcome! Feel free to raise an issue or start a discussion, for help in getting started.
|
||||||
|
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Configuration is made in the `configuration` section of `package.json`:
|
||||||
|
|
||||||
|
- Provide path to SAS9 executable.
|
||||||
|
|
||||||
|
|
||||||
|
### Using dockers:
|
||||||
|
|
||||||
|
There is `.env.example` file present at root of the project. [for Production]
|
||||||
|
|
||||||
|
There is `.env.example` file present at `./api` of the project. [for Development]
|
||||||
|
|
||||||
|
There is `.env.example` file present at `./web` of the project. [for Development]
|
||||||
|
|
||||||
|
Remember to provide enviornment variables.
|
||||||
|
|
||||||
|
#### Development
|
||||||
|
|
||||||
|
Command to run docker for development:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
It uses default docker compose file i.e. `docker-compose.yml` present at root.
|
||||||
|
It will build following images if running first time:
|
||||||
|
|
||||||
|
- `sasjs_server_api` - image for sasjs api server app based on _ExpressJS_
|
||||||
|
- `sasjs_server_web` - image for sasjs web component app based on _ReactJS_
|
||||||
|
- `mongodb` - image for mongo database
|
||||||
|
- `mongo-seed-users` - will be populating user data specified in _./mongo-seed/users/user.json_
|
||||||
|
- `mongo-seed-clients` - will be populating client data specified in _./mongo-seed/clients/client.json_
|
||||||
|
|
||||||
|
|
||||||
|
#### Production
|
||||||
|
|
||||||
|
Command to run docker for production:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker-compose -f docker-compose.prod.yml up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
It uses specified docker compose file i.e. `docker-compose.prod.yml` present at root.
|
||||||
|
It will build following images if running first time:
|
||||||
|
|
||||||
|
- `sasjs_server_prod` - image for sasjs server app containing api and web component's build served at route `/`
|
||||||
|
- `mongodb` - image for mongo database
|
||||||
|
- `mongo-seed-users` - will be populating user data specified in _./mongo-seed/users/user.json_
|
||||||
|
- `mongo-seed-clients` - will be populating client data specified in _./mongo-seed/clients/client.json_
|
||||||
|
|
||||||
|
### Using node:
|
||||||
|
|
||||||
|
#### Development (running api and web seperately):
|
||||||
|
|
||||||
|
##### API
|
||||||
|
|
||||||
|
Navigate to `./api`
|
||||||
|
There is `.env.example` file present at `./api` directory. Remember to provide enviornment variables else default values will be used mentioned in `.env.example` files
|
||||||
|
Command to install and run api server.
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install
|
||||||
|
npm start
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Web
|
||||||
|
|
||||||
|
Navigate to `./web`
|
||||||
|
There is `.env.example` file present at `./web` directory. Remember to provide enviornment variables else default values will be used mentioned in `.env.example` files
|
||||||
|
Command to install and run api server.
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install
|
||||||
|
npm start
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Development (running only api server and have web build served):
|
||||||
|
|
||||||
|
##### API server also serving Web build files
|
||||||
|
|
||||||
|
There is `.env.example` file present at `./api` directory. Remember to provide enviornment variables else default values will be used mentioned in `.env.example` files
|
||||||
|
Command to install and run api server.
|
||||||
|
|
||||||
|
```
|
||||||
|
cd ./web && npm i && npm build && cd ../
|
||||||
|
cd ./api && npm i && npm start
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Production
|
||||||
|
|
||||||
|
##### API & WEB
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run server
|
||||||
|
```
|
||||||
|
|
||||||
|
This will install/build `web` and install `api`, then start prod server.
|
||||||
|
|
||||||
|
|
||||||
|
## Executables
|
||||||
|
|
||||||
|
Command to generate executables
|
||||||
|
|
||||||
|
```
|
||||||
|
cd ./web && npm i && npm build && cd ../
|
||||||
|
cd ./api && npm i && npm run exe
|
||||||
|
```
|
||||||
|
|
||||||
|
This will install/build web app and install/create executables of sasjs server at root `./executables`
|
||||||
@@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
### [0.0.24](https://github.com/sasjs/server/compare/v0.0.23...v0.0.24) (2022-02-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* removing sysmacdelete ([480ee4d](https://github.com/sasjs/server/commit/480ee4da831d2a89888c58ebec26bd89802ee2f5))
|
||||||
|
|
||||||
### [0.0.23](https://github.com/sasjs/server/compare/v0.0.22...v0.0.23) (2022-02-08)
|
### [0.0.23](https://github.com/sasjs/server/compare/v0.0.22...v0.0.23) (2022-02-08)
|
||||||
|
|
||||||
### [0.0.22](https://github.com/sasjs/server/compare/v0.0.17...v0.0.22) (2022-02-08)
|
### [0.0.22](https://github.com/sasjs/server/compare/v0.0.17...v0.0.22) (2022-02-08)
|
||||||
|
|||||||
127
README.md
127
README.md
@@ -8,127 +8,68 @@ SASjs Server provides a NodeJS wrapper for calling the SAS binary executable. It
|
|||||||
|
|
||||||
One major benefit of using SASjs Server (alongside other components of the SASjs framework such as the [CLI](https://cli.sasjs.io), [Adapter](https://adapter.sasjs.io) and [Core](https://core.sasjs.io) library) is that the projects you create can be very easily ported to SAS 9 (Stored Process server) or Viya (Job Execution server).
|
One major benefit of using SASjs Server (alongside other components of the SASjs framework such as the [CLI](https://cli.sasjs.io), [Adapter](https://adapter.sasjs.io) and [Core](https://core.sasjs.io) library) is that the projects you create can be very easily ported to SAS 9 (Stored Process server) or Viya (Job Execution server).
|
||||||
|
|
||||||
## Installation
|
SASjs Server is available in two modes - Desktop (without authentication) and Server (with authentiation, and a database)
|
||||||
|
## Desktop Version
|
||||||
|
|
||||||
First, download the relevant package from the [releases](https://github.com/sasjs/server/releases) page - either manually, or with commandline, eg as follow:
|
### Manual Installation
|
||||||
|
Download the relevant package from the [releases](https://github.com/sasjs/server/releases) page
|
||||||
|
|
||||||
```bash
|
Next, trigger by double clicking (windows) or executing from commandline.
|
||||||
curl -L https://github.com/sasjs/server/releases/latest/download/linux.zip > linux.zip
|
|
||||||
unzip linux.zip
|
|
||||||
./api-linux
|
|
||||||
```
|
|
||||||
|
|
||||||
Second, trigger by double clicking (windows) or executing from commandline.
|
|
||||||
|
|
||||||
You are presented with two prompts:
|
You are presented with two prompts:
|
||||||
|
|
||||||
* Location of your `sas.exe` / `sas.sh` executable
|
* Location of your `sas.exe` / `sas.sh` executable
|
||||||
* Path to a filesystem location for Stored Programs and temporary files
|
* Path to a filesystem location for Stored Programs and temporary files
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
Configuration is made in the `configuration` section of `package.json`:
|
## Programmatic Installation
|
||||||
|
|
||||||
- Provide path to SAS9 executable.
|
Fetch the relevant package from github using `curl`, eg as follows (for linux):
|
||||||
|
|
||||||
### Using dockers:
|
```bash
|
||||||
|
curl -L https://github.com/sasjs/server/releases/latest/download/linux.zip > linux.zip
|
||||||
There is `.env.example` file present at root of the project. [for Production]
|
unzip linux.zip
|
||||||
|
|
||||||
There is `.env.example` file present at `./api` of the project. [for Development]
|
|
||||||
|
|
||||||
There is `.env.example` file present at `./web` of the project. [for Development]
|
|
||||||
|
|
||||||
Remember to provide enviornment variables.
|
|
||||||
|
|
||||||
#### Development
|
|
||||||
|
|
||||||
Command to run docker for development:
|
|
||||||
|
|
||||||
```
|
|
||||||
docker-compose up -d
|
|
||||||
```
|
```
|
||||||
|
|
||||||
It uses default docker compose file i.e. `docker-compose.yml` present at root.
|
The app can then be launched with `./api-linux` and prompts followed.
|
||||||
It will build following images if running first time:
|
|
||||||
|
|
||||||
- `sasjs_server_api` - image for sasjs api server app based on _ExpressJS_
|
When launching the app, it will make use of specific environment variables. These can be set in the following places:
|
||||||
- `sasjs_server_web` - image for sasjs web component app based on _ReactJS_
|
|
||||||
- `mongodb` - image for mongo database
|
|
||||||
- `mongo-seed-users` - will be populating user data specified in _./mongo-seed/users/user.json_
|
|
||||||
- `mongo-seed-clients` - will be populating client data specified in _./mongo-seed/clients/client.json_
|
|
||||||
|
|
||||||
#### Production
|
- Configured globally in /etc/environment file
|
||||||
|
- Export in terminal or shell script (`export VAR=VALUE`)
|
||||||
|
- Prepend in command
|
||||||
|
- Enter in the `.env` file alongside the executable
|
||||||
|
|
||||||
Command to run docker for production:
|
Example variables:
|
||||||
|
|
||||||
```
|
```
|
||||||
docker-compose -f docker-compose.prod.yml up -d
|
PORT=5004
|
||||||
|
SAS_PATH=/path/to/sas/executable.exe
|
||||||
|
DRIVE_PATH=./tmp
|
||||||
```
|
```
|
||||||
|
|
||||||
It uses specified docker compose file i.e. `docker-compose.prod.yml` present at root.
|
Setting these prompts variables will avoid the need for prompts.
|
||||||
It will build following images if running first time:
|
|
||||||
|
|
||||||
- `sasjs_server_prod` - image for sasjs server app containing api and web component's build served at route `/`
|
Normally the server process will stop when your terminal dies. To keep it going you can use the npm package [forever](https://www.npmjs.com/package/forever) (`npm i -g forever`) as follows:
|
||||||
- `mongodb` - image for mongo database
|
|
||||||
- `mongo-seed-users` - will be populating user data specified in _./mongo-seed/users/user.json_
|
|
||||||
- `mongo-seed-clients` - will be populating client data specified in _./mongo-seed/clients/client.json_
|
|
||||||
|
|
||||||
### Using node:
|
```bash
|
||||||
|
export SAS_PATH=/opt/sas9/SASHome/SASFoundation/9.4/sasexe/sas
|
||||||
|
export PORT=5001
|
||||||
|
export DRIVE_PATH=./tmp
|
||||||
|
|
||||||
#### Development (running api and web seperately):
|
forever start -c "./api-linux" ./
|
||||||
|
|
||||||
##### API
|
|
||||||
|
|
||||||
Navigate to `./api`
|
|
||||||
There is `.env.example` file present at `./api` directory. Remember to provide enviornment variables else default values will be used mentioned in `.env.example` files
|
|
||||||
Command to install and run api server.
|
|
||||||
|
|
||||||
```
|
|
||||||
npm install
|
|
||||||
npm start
|
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Web
|
To get the log files:
|
||||||
|
```bash
|
||||||
Navigate to `./web`
|
forever list
|
||||||
There is `.env.example` file present at `./web` directory. Remember to provide enviornment variables else default values will be used mentioned in `.env.example` files
|
# grap log file link
|
||||||
Command to install and run api server.
|
tail -f LOGFILE
|
||||||
|
|
||||||
```
|
|
||||||
npm install
|
|
||||||
npm start
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Development (running only api server and have web build served):
|
To stop:
|
||||||
|
|
||||||
##### API server also serving Web build files
|
|
||||||
|
|
||||||
There is `.env.example` file present at `./api` directory. Remember to provide enviornment variables else default values will be used mentioned in `.env.example` files
|
|
||||||
Command to install and run api server.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
cd ./web && npm i && npm build && cd ../
|
forever stop <pid>
|
||||||
cd ./api && npm i && npm start
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Production
|
|
||||||
|
|
||||||
##### API & WEB
|
|
||||||
|
|
||||||
```
|
|
||||||
npm run server
|
|
||||||
```
|
|
||||||
|
|
||||||
This will install/build `web` and install `api`, then start prod server.
|
|
||||||
|
|
||||||
## Executables
|
|
||||||
|
|
||||||
Command to generate executables
|
|
||||||
|
|
||||||
```
|
|
||||||
cd ./web && npm i && npm build && cd ../
|
|
||||||
cd ./api && npm i && npm run exe
|
|
||||||
```
|
|
||||||
|
|
||||||
This will install/build web app and install/create executables of sasjs server at root `./executables`
|
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ export class ExecutionController {
|
|||||||
%if "&SYSTCPIPHOSTNAME"="" %then %let SYSTCPIPHOSTNAME=&_sasjs_apiserverurl;
|
%if "&SYSTCPIPHOSTNAME"="" %then %let SYSTCPIPHOSTNAME=&_sasjs_apiserverurl;
|
||||||
%mend;
|
%mend;
|
||||||
%_sasjs_server_init()
|
%_sasjs_server_init()
|
||||||
%sysmacdelete _sasjs_server_init;
|
|
||||||
`
|
`
|
||||||
|
|
||||||
program = `
|
program = `
|
||||||
|
|||||||
@@ -14,14 +14,14 @@ services:
|
|||||||
REFRESH_TOKEN_SECRET: ${REFRESH_TOKEN_SECRET}
|
REFRESH_TOKEN_SECRET: ${REFRESH_TOKEN_SECRET}
|
||||||
AUTH_CODE_SECRET: ${AUTH_CODE_SECRET}
|
AUTH_CODE_SECRET: ${AUTH_CODE_SECRET}
|
||||||
DB_CONNECT: mongodb://mongodb:27017/sasjs
|
DB_CONNECT: mongodb://mongodb:27017/sasjs
|
||||||
SAS_PATH: /usr/server/sasexe
|
SAS_PATH: /usr/server/sasexe/${SAS_EXEC_NAME}
|
||||||
expose:
|
expose:
|
||||||
- ${PORT_API}
|
- ${PORT_API}
|
||||||
ports:
|
ports:
|
||||||
- ${PORT_API}:${PORT_API}
|
- ${PORT_API}:${PORT_API}
|
||||||
volumes:
|
volumes:
|
||||||
- type: bind
|
- type: bind
|
||||||
source: ${SAS_EXEC}
|
source: ${SAS_EXEC_PATH}
|
||||||
target: /usr/server/sasexe
|
target: /usr/server/sasexe
|
||||||
read_only: true
|
read_only: true
|
||||||
links:
|
links:
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "server",
|
"name": "server",
|
||||||
"version": "0.0.23",
|
"version": "0.0.24",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "server",
|
"name": "server",
|
||||||
"version": "0.0.23",
|
"version": "0.0.24",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sasjs/core": "3.11.0"
|
"@sasjs/core": "3.11.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "server",
|
"name": "server",
|
||||||
"version": "0.0.23",
|
"version": "0.0.24",
|
||||||
"description": "NodeJS wrapper for calling the SAS binary executable",
|
"description": "NodeJS wrapper for calling the SAS binary executable",
|
||||||
"repository": "https://github.com/sasjs/server",
|
"repository": "https://github.com/sasjs/server",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user