Skip to content

Commit

Permalink
Add changes to the rocky linux image
Browse files Browse the repository at this point in the history
  • Loading branch information
sandushi committed Sep 18, 2024
1 parent 2bedf63 commit aa7d638
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 15 deletions.
32 changes: 28 additions & 4 deletions dockerfiles/rocky/is-as-km/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,17 @@
# set base Docker image to CentOS Docker image
FROM rockylinux:8

ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
# Update the system to the specific 8.10 version
RUN dnf -y update && \
dnf -y distro-sync && \
dnf clean all

# Install necessary locale packages
RUN yum install -y glibc-langpack-en && \
yum install -y langpacks-en glibc-locale-source && \
localedef -c -f UTF-8 -i en_US en_US.UTF-8

ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
# install JDK Dependencies
RUN yum install -y tzdata openssl curl ca-certificates fontconfig gzip tar \
&& yum clean all
Expand Down Expand Up @@ -75,7 +84,7 @@ ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION}
ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER}
ARG WSO2_SERVER_DIST_URL=https://github.com/wso2/${WSO2_SERVER_REPOSITORY}/releases/download/v${WSO2_APIM_RELEASE_VERSION}/${WSO2_SERVER}.zip
# build arguments for external artifacts
ARG DNS_JAVA_VERSION=2.1.8
ARG DNS_JAVA_VERSION=3.6.1
ARG K8S_MEMBERSHIP_SCHEME_VERSION=1.0.7
ARG MYSQL_CONNECTOR_VERSION=8.0.17
# build argument for MOTD
Expand All @@ -92,6 +101,14 @@ RUN \
&& useradd --system --create-home --home-dir ${USER_HOME} --no-log-init -g ${USER_GROUP_ID} -u ${USER_ID} ${USER} \
&& echo ${MOTD} > /etc/profile.d/motd.sh

# create Java prefs dir
# this is to avoid warning logs printed by FileSystemPreferences class
RUN \
mkdir -p ${USER_HOME}/.java/.systemPrefs \
&& mkdir -p ${USER_HOME}/.java/.userPrefs \
&& chmod -R 755 ${USER_HOME}/.java \
&& chown -R ${USER}:${USER_GROUP} ${USER_HOME}/.java

# copy init script to user home
COPY --chown=wso2carbon:wso2 docker-entrypoint.sh ${USER_HOME}/
# install required packages
Expand All @@ -102,12 +119,14 @@ RUN \
unzip \
wget \
&& rm -rf /var/cache/yum/*

# add the WSO2 product distribution to user's home directory
COPY --chown=wso2carbon:wso2 wso2is-km-5.10.0.zip ${USER_HOME}/
RUN \
unzip -d ${USER_HOME} ${USER_HOME}/wso2is-km-5.10.0.zip \
wget -O ${WSO2_SERVER}.zip "${WSO2_SERVER_DIST_URL}" \
&& unzip -d ${USER_HOME} ${WSO2_SERVER}.zip \
&& chown wso2carbon:wso2 -R ${WSO2_SERVER_HOME} \
&& rm -f ${WSO2_SERVER}.zip

# add libraries for Kubernetes membership scheme based clustering
ADD --chown=wso2carbon:wso2 https://repo1.maven.org/maven2/dnsjava/dnsjava/${DNS_JAVA_VERSION}/dnsjava-${DNS_JAVA_VERSION}.jar ${WSO2_SERVER_HOME}/repository/components/lib
ADD --chown=wso2carbon:wso2 http://maven.wso2.org/nexus/content/repositories/releases/org/wso2/carbon/kubernetes/artifacts/kubernetes-membership-scheme/${K8S_MEMBERSHIP_SCHEME_VERSION}/kubernetes-membership-scheme-${K8S_MEMBERSHIP_SCHEME_VERSION}.jar ${WSO2_SERVER_HOME}/repository/components/dropins/
Expand All @@ -118,6 +137,11 @@ ADD --chown=wso2carbon:wso2 https://repo1.maven.org/maven2/mysql/mysql-connector
USER ${USER_ID}
WORKDIR ${USER_HOME}

# set environment variables
ENV JAVA_OPTS="-Djava.util.prefs.systemRoot=${USER_HOME}/.java -Djava.util.prefs.userRoot=${USER_HOME}/.java/.userPrefs" \
WORKING_DIRECTORY=${USER_HOME} \
WSO2_SERVER_HOME=${WSO2_SERVER_HOME}

# set environment variables
ENV WORKING_DIRECTORY=${USER_HOME} \
WSO2_SERVER_HOME=${WSO2_SERVER_HOME}
Expand Down
21 changes: 11 additions & 10 deletions dockerfiles/rocky/is-as-km/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Dockerfile for WSO2 Identity Server deployed as the API Key Manager #
This section defines the step-by-step instructions to build an [Ubuntu](https://hub.docker.com/_/ubuntu/) Linux based Docker image for WSO2 IS deployed as API Key Manager.

This section defines the step-by-step instructions to build an [CentOS](https://hub.docker.com/_/centos/) Linux based Docker image for WSO2 IS deployed as API Key Manager.

## Prerequisites

Expand All @@ -14,25 +15,25 @@ This section defines the step-by-step instructions to build an [Ubuntu](https://
git clone https://github.com/wso2/docker-apim.git
```

> The local copy of the `dockerfiles/ubuntu/is-as-km` directory will be referred to as `IS_KM_DOCKERFILE_HOME` from this point onwards.
> The local copy of the `dockerfiles/centos/is-as-km` directory will be referred to as `IS_KM_DOCKERFILE_HOME` from this point onwards.
##### 2. Build the Docker image.

- Navigate to `<IS_KM_DOCKERFILE_HOME>` directory. <br>
Execute `docker build` command as shown below.
+ `docker build -t wso2is-km:5.10.0 .`
+ `docker build -t wso2is-km:5.10.0-rocky .`

> By default, the Docker image will prepackage the General Availability (GA) release version of the relevant WSO2 product.
##### 3. Running the Docker image.

- `docker run -it -p 9443:9443 wso2is-km:5.10.0`
- `docker run -it -p 9443:9443 wso2is-km:5.10.0-rocky`

##### 4. Accessing management console.

- To access the management console, use the docker host IP and port 9443.
+ `https:<DOCKER_HOST>:9443/carbon`
+ `https:<DOCKER_HOST>:9443/carbon`

> In here, <DOCKER_HOST> refers to hostname or IP of the host machine on top of which containers are spawned.
## How to update configurations
Expand All @@ -42,7 +43,7 @@ As an example, steps required to change the port offset using `deployment.toml`

##### 1. Stop the Identity Server as Key Manager container if it's already running.

In WSO2 Identity Server as Key Manager version 5.10.0 product distribution, `deployment.toml` configuration file <br>
In WSO2 Identity Server as Key Manager 5.10.0 product distribution, `deployment.toml` configuration file <br>
can be found at `<DISTRIBUTION_HOME>/repository/conf`. Copy the file to some suitable location of the host machine, <br>
referred to as `<SOURCE_CONFIGS>/deployment.toml` and change the offset value (`[server]->offset`) to 1.

Expand All @@ -58,7 +59,7 @@ chmod o+r <SOURCE_CONFIGS>/deployment.toml
docker run \
-p 9444:9444 \
--volume <SOURCE_CONFIGS>/deployment.toml:<TARGET_CONFIGS>/deployment.toml \
wso2is-km:5.10.0
wso2is-km:5.10.0-rocky
```

> In here, <TARGET_CONFIGS> refers to /home/wso2carbon/wso2is-km-5.10.0/repository/conf folder of the container.
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/rocky/is-as-km/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
# ------------------------------------------------------------------------
# Copyright 2018 WSO2, Inc. (http://wso2.com)
# Copyright 2024 WSO2, Inc. (http://wso2.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down

0 comments on commit aa7d638

Please sign in to comment.