Deploy Sign-In Application to OKE
Download the code from GitHub, customize the code, and deploy it.
The sample code is available on GitHub.
- Go to GitHub.
- Clone or download the repository.
- Follow the instructions in the README document.
Follow these steps to deploy the application to OKE:
- Fork and clone the GitHub repository.
- Create the Dockerfile and build an image.
- Push the Docker image to the OCI Registry.
- Set up environment variables.
- Register the application in your Identity Domain.
- Deploy the Docker image to an OKE cluster.
- Test the custom sign-in experience with your working sample application.
Fork and Clone GitHub Repository
Fork the GitHub repository to create a copy of a repository on your development machine.
Then clone the forked repository on your development machine using the following command.
git clone https://github.com:USERNAME/YOUR-FORKED-REPO
Create a Dockerfile
Create a new file names Dockerfile in the cloned repository.
Node JS
application. The Dockerfile looks similar to any Node JS
application.
FROM node:alpine
# Create app directory WORKDIR /usr/src/app # Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied where available (npm@5+)
COPY package*.json ./
RUN npm install
# If you are building your code for production
# RUN npm install --only=production
# Bundle app source
COPY . .
EXPOSE 3000# "npm start" is how this would normally be startedCMD [ "npm", "start" ]
You
can use the Linux distribution allowed in your organization instead of
alpine
.
Build a Docker Image
Use the following command to build a Docker image from the Dockerfile and provide your image name.
docker build -t $IMAGE_NAME $PATH_TO_DOCKERFILE
Use the following command to list the images to verify your Docker image.
docker images
Push the Docker Image to OCI Registry
To push your Docker image to the OCI Registry, follow these steps:
Set Up Environment Variables
- Mandatory: IDCS_CLIENT_ID, IDCS_CLIENT_ID, and IDCS_SECRET
- Optional: IDCS_SELFREGPROFILES to pass a self-registration profile to the sign-in application and DEBUG_LOGIN=true to enable debug logging in
NodeJS
- Production: NODE_ENV=production variable
Use Kubernetes Secrets to store these values and pass them along in the manifest file.
Register the Application
Register a client credentials application in IDCS or Identity Domain so that the custom sign-in application can make calls to the Oracle Identity Cloud Service Authentication REST API and allow users to sign in.
Create an OKE Cluster
- Follow the instructions to create an OKE cluster if you don't already have one.
- Ensure you have access to the new cluster using
kubectl
. Follow steps from the Quick Start section to access your cluster.
Deploy Application to OKE Cluster
To create a Kubernetes deployment manifest file and deploy the application to OKE, follow these steps:
Test Custom Sign-In Experience
Follow these steps to test the sign-in experience using the working sample application you prepared for testing:
- Update the sample application to use the newly deployed custom application's load balancer URL.
- In your sample application, enter the load balancer URL in the Custom Login URL field. This URL can either be the load balancer public IP address or the FQDN based on your DNS entry.
- Access the sample application URL in the browser.
You should be taken to the custom sign-in application page.