In this section we explain how to start and how to stop the i-refactory Oauth2 server.
The server is a NodeJS application which can be started on the command prompt from the root directory of the application.
In the above scenario the application is started and the assumption is made that a config.json file exists in the root application directory. The configuration file is read and the server is started. The config file contains the server configuration and the users/applications which can make requests for a token. If new applications, users should be granted access you need to edit the config file and stop/start the server.
If the server is running in your terminal simply press Ctrl-C.
There are many ways to start the server as a background service and there are many process managers. Perhaps the most easiest one is to create a docker container and start the service with a service manager for docker containers.
The i-refactory server is shipped as a zip file with the relevant node_modules already downloaded.\ Creating a docker image is straightforward.
FROM node:14-alpine AS dependencies
RUN apk update && \
apk add --no-cache tzdata
ENV TZ Europe/Amsterdam
# Create app location
# Copy code
COPY . .
# set the node path so modules can properly be required
To build the image open a terminal:
cd <directory where you stored the i-refactory server code>
create a file Dockerfile with the example content as shown above.
docker build -t <image>:<tag> ./
The i-refactory server can be started with docker-compose.
Example docker-compose file:
image: <your image>
# Needed to respond to prompts in the console
To start the server with docker-compose:
Create a file docker-compose-irefactory-oauth2.yml and store your compose config in it.
docker-compose -f ./docker-compose-irefactory-oauth2.yml up -d
See the detailed description in Operating Irefactory Server