Skip to content

Commit

Permalink
Merge pull request #21 from WebSpellChecker/license_dir_quick_fix
Browse files Browse the repository at this point in the history
Fix passing license directory via ENV var to the container
  • Loading branch information
maxim-voronko authored Nov 25, 2022
2 parents 0b86dbd + 361aca6 commit 4e33e56
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ARG APP_ROOT_DIR=$DEPLOYMENT_DIR/$APP_ROOT_NAME
ARG APP_SERVER_DIR=/opt/$APP_ROOT_NAME/AppServer
ARG APP_NAME_MASK=wsc_app*
ARG USER_NAME=wsc
ARG LICENSE_DIR=/var/lib/wsc/license
ARG SERVICE_FILES_DIR=/var/lib
ARG USER_ID=2000
ARG GROUP_ID=2000

Expand Down Expand Up @@ -67,6 +67,7 @@ ENV VIRTUAL_DIR=${VIRTUAL_DIR}
ENV WEB_SERVER_TYPE=2
ENV ACTIVATE_LICENSE=${ACTIVATE_LICENSE}
ENV LICENSE_TICKET_ID=${LICENSE_TICKET_ID}
ENV SERVICE_FILES_DIR=${SERVICE_FILES_DIR}
ENV RESTART_WEB_SERVER=1
ENV CERT_DIR=${CERT_DIR}
ENV CERT_KEY_NAME=${CERT_KEY_NAME}
Expand All @@ -90,7 +91,7 @@ RUN groupadd --gid ${GROUP_ID} $USER_NAME && useradd --no-log-init --uid ${USER_

RUN mkdir -p $CUSTOM_DICTIONARIES_DIR \
$USER_DICTIONARIES_DIR \
$LICENSE_DIR \
$SERVICE_FILES_DIR/wsc \
/var/run/nginx

COPY $FILES_DIR/$APP_NAME_MASK $DEPLOYMENT_DIR/
Expand All @@ -103,7 +104,7 @@ RUN tar -xvf $DEPLOYMENT_DIR/$APP_NAME_MASK -C $DEPLOYMENT_DIR/ && \
ln -s /dev/stdout $APP_SERVER_DIR/Logs/Child-0.log && \
ln -s /dev/stdout $APP_SERVER_DIR/Logs/Child-1.log && \
ln -s /dev/stdout $APP_SERVER_DIR/Logs/Action.log && \
chown -R ${USER_ID}:${GROUP_ID} $LICENSE_DIR $DICTIONARIES_DIR $APP_SERVER_DIR
chown -R ${USER_ID}:${GROUP_ID} $SERVICE_FILES_DIR/wsc $DICTIONARIES_DIR $APP_SERVER_DIR

COPY $FILES_DIR/certificate/$CERT_KEY_NAME $CERT_DIR/$CERT_KEY_NAME
COPY $FILES_DIR/certificate/$CERT_FILE_NAME $CERT_DIR/$CERT_FILE_NAME
Expand Down
7 changes: 4 additions & 3 deletions DockerfileCentOS
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ARG APP_ROOT_DIR=$DEPLOYMENT_DIR/$APP_ROOT_NAME
ARG APP_SERVER_DIR=/opt/$APP_ROOT_NAME/AppServer
ARG APP_NAME_MASK=wsc_app*
ARG USER_NAME=wsc
ARG LICENSE_DIR=/var/lib/wsc/license
ARG SERVICE_FILES_DIR=/var/lib
ARG USER_ID=2000
ARG GROUP_ID=2000

Expand Down Expand Up @@ -65,6 +65,7 @@ ENV VIRTUAL_DIR=${VIRTUAL_DIR}
ENV WEB_SERVER_TYPE=2
ENV ACTIVATE_LICENSE=${ACTIVATE_LICENSE}
ENV LICENSE_TICKET_ID=${LICENSE_TICKET_ID}
ENV SERVICE_FILES_DIR=${SERVICE_FILES_DIR}
ENV RESTART_WEB_SERVER=1
ENV CERT_DIR=${CERT_DIR}
ENV CERT_KEY_NAME=${CERT_KEY_NAME}
Expand Down Expand Up @@ -96,7 +97,7 @@ RUN groupadd --gid ${GROUP_ID} $USER_NAME && useradd --no-log-init --uid ${USER_

RUN mkdir -p $CUSTOM_DICTIONARIES_DIR \
$USER_DICTIONARIES_DIR \
$LICENSE_DIR \
$SERVICE_FILES_DIR/wsc \
$APP_SERVER_DIR \
/var/run/nginx

Expand All @@ -110,7 +111,7 @@ RUN tar -xvf $DEPLOYMENT_DIR/$APP_NAME_MASK -C $DEPLOYMENT_DIR/ && \
ln -s /dev/stdout $APP_SERVER_DIR/Logs/Child-0.log && \
ln -s /dev/stdout $APP_SERVER_DIR/Logs/Child-1.log && \
ln -s /dev/stdout $APP_SERVER_DIR/Logs/Action.log && \
chown -R ${USER_ID}:${GROUP_ID} $LICENSE_DIR $DICTIONARIES_DIR $APP_SERVER_DIR
chown -R ${USER_ID}:${GROUP_ID} $SERVICE_FILES_DIR/wsc $DICTIONARIES_DIR $APP_SERVER_DIR

COPY $FILES_DIR/certificate/$CERT_KEY_NAME $CERT_DIR/$CERT_KEY_NAME
COPY $FILES_DIR/certificate/$CERT_FILE_NAME $CERT_DIR/$CERT_FILE_NAME
Expand Down
7 changes: 4 additions & 3 deletions DockerfileRedHat
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ARG APP_ROOT_DIR=$DEPLOYMENT_DIR/$APP_ROOT_NAME
ARG APP_SERVER_DIR=/opt/$APP_ROOT_NAME/AppServer
ARG APP_NAME_MASK=wsc_app*
ARG USER_NAME=wsc
ARG LICENSE_DIR=/var/lib/wsc/license
ARG SERVICE_FILES_DIR=/var/lib
ARG USER_ID=2000
ARG GROUP_ID=2000

Expand Down Expand Up @@ -65,6 +65,7 @@ ENV VIRTUAL_DIR=${VIRTUAL_DIR}
ENV WEB_SERVER_TYPE=2
ENV ACTIVATE_LICENSE=${ACTIVATE_LICENSE}
ENV LICENSE_TICKET_ID=${LICENSE_TICKET_ID}
ENV SERVICE_FILES_DIR=${SERVICE_FILES_DIR}
ENV RESTART_WEB_SERVER=1
ENV CERT_DIR=${CERT_DIR}
ENV CERT_KEY_NAME=${CERT_KEY_NAME}
Expand Down Expand Up @@ -95,7 +96,7 @@ RUN groupadd --gid ${GROUP_ID} $USER_NAME && useradd --no-log-init --uid ${USER_

RUN mkdir -p $CUSTOM_DICTIONARIES_DIR \
$USER_DICTIONARIES_DIR \
$LICENSE_DIR \
$SERVICE_FILES_DIR/wsc \
$APP_SERVER_DIR \
/var/run/nginx

Expand All @@ -109,7 +110,7 @@ RUN tar -xvf $DEPLOYMENT_DIR/$APP_NAME_MASK -C $DEPLOYMENT_DIR/ && \
ln -s /dev/stdout $APP_SERVER_DIR/Logs/Child-0.log && \
ln -s /dev/stdout $APP_SERVER_DIR/Logs/Child-1.log && \
ln -s /dev/stdout $APP_SERVER_DIR/Logs/Action.log && \
chown -R ${USER_ID}:${GROUP_ID} $LICENSE_DIR $DICTIONARIES_DIR $APP_SERVER_DIR
chown -R ${USER_ID}:${GROUP_ID} $SERVICE_FILES_DIR/wsc $DICTIONARIES_DIR $APP_SERVER_DIR

COPY $FILES_DIR/certificate/$CERT_KEY_NAME $CERT_DIR/$CERT_KEY_NAME
COPY $FILES_DIR/certificate/$CERT_FILE_NAME $CERT_DIR/$CERT_FILE_NAME
Expand Down
3 changes: 2 additions & 1 deletion files/configureFiles.pl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ sub configureSsl

sub configureAppServerParams
{
replaceFileContent('<Size>\d*</Size>', '<Size>0</Size>', "AppServerX.xml");
replaceFileContent('<Size>\d*</Size>', '<Size>0</Size>', $server_config_path);
replaceFileContent('</ServiceName>', "</ServiceName>\n <PathToServiceFilesDirectory>$ENV{'SERVICE_FILES_DIR'}</PathToServiceFilesDirectory>", $server_config_path);
}

sub replaceFileContent
Expand Down
2 changes: 1 addition & 1 deletion files/startService.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ perl configureWebServer.pl
perl configureFiles.pl

# activate a license automatically
LicenseFile="${LICENSE_DIR}/license.xml"
LicenseFile="${SERVICE_FILES_DIR}/wsc/license/license.xml"
if ! [ -f "${LicenseFile}" ]; then
./AppServerX -activateLicense ${LICENSE_TICKET_ID} -y
fi
Expand Down

0 comments on commit 4e33e56

Please sign in to comment.