Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
KharchenkoMaks committed Nov 29, 2022
2 parents 6ac89e0 + 4e33e56 commit f07cc62
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 20 deletions.
19 changes: 14 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ 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

ENV APP_SERVER_DIR=${APP_SERVER_DIR}

ENV WSC_AUTO_INSTALL=TRUE

# Application installation parameters
Expand Down Expand Up @@ -65,7 +67,11 @@ 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}
ENV CERT_FILE_NAME=${CERT_FILE_NAME}

ENV ENABLE_PROXY=${ENABLE_PROXY}
ENV PROXY_HOST=${PROXY_HOST}
Expand All @@ -85,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 @@ -98,9 +104,10 @@ 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_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
COPY $FILES_DIR/configure* $APP_SERVER_DIR/
COPY $FILES_DIR/startService.sh $APP_SERVER_DIR
RUN chown ${USER_ID}:${GROUP_ID} $APP_SERVER_DIR/startService.sh && \
Expand All @@ -115,5 +122,7 @@ RUN chown -R ${USER_ID}:${GROUP_ID} /var/log/nginx \
/etc/nginx

USER $USER_NAME

WORKDIR $APP_SERVER_DIR
ENTRYPOINT ["./startService.sh"]

ENTRYPOINT sh ${APP_SERVER_DIR}/startService.sh
19 changes: 14 additions & 5 deletions DockerfileCentOS
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ 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

ENV APP_SERVER_DIR=${APP_SERVER_DIR}

ENV WSC_AUTO_INSTALL=TRUE

# Application installation parameters
Expand Down Expand Up @@ -63,7 +65,11 @@ 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}
ENV CERT_FILE_NAME=${CERT_FILE_NAME}

ENV ENABLE_PROXY=${ENABLE_PROXY}
ENV PROXY_HOST=${PROXY_HOST}
Expand Down Expand Up @@ -91,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 @@ -105,9 +111,10 @@ 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_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
COPY $FILES_DIR/configure* $APP_SERVER_DIR/
COPY $FILES_DIR/startService.sh $APP_SERVER_DIR
RUN chown ${USER_ID}:${GROUP_ID} $APP_SERVER_DIR/startService.sh && \
Expand All @@ -122,5 +129,7 @@ RUN chown -R ${USER_ID}:${GROUP_ID} /var/log/nginx \
/etc/nginx

USER $USER_NAME

WORKDIR $APP_SERVER_DIR
ENTRYPOINT ["./startService.sh"]

ENTRYPOINT sh ${APP_SERVER_DIR}/startService.sh
19 changes: 14 additions & 5 deletions DockerfileRedHat
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ 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

ENV APP_SERVER_DIR=${APP_SERVER_DIR}

ENV WSC_AUTO_INSTALL=TRUE

# Application installation parameters
Expand Down Expand Up @@ -63,7 +65,11 @@ 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}
ENV CERT_FILE_NAME=${CERT_FILE_NAME}

ENV ENABLE_PROXY=${ENABLE_PROXY}
ENV PROXY_HOST=${PROXY_HOST}
Expand All @@ -90,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 @@ -104,9 +110,10 @@ 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_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
COPY $FILES_DIR/configure* $APP_SERVER_DIR/
COPY $FILES_DIR/startService.sh $APP_SERVER_DIR
RUN chown ${USER_ID}:${GROUP_ID} $APP_SERVER_DIR/startService.sh && \
Expand All @@ -121,5 +128,7 @@ RUN chown -R ${USER_ID}:${GROUP_ID} /var/log/nginx \
/etc/nginx

USER $USER_NAME

WORKDIR $APP_SERVER_DIR
ENTRYPOINT ["./startService.sh"]

ENTRYPOINT sh ${APP_SERVER_DIR}/startService.sh
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
7 changes: 4 additions & 3 deletions files/configureWebServer.pl
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ sub enableSSL
{
my $nginxConf = '/etc/nginx/conf.d/wscservice.conf';

my $pathToCert = '/certificate/cert.pem';
my $pathToKey = '/certificate/key.pem';
my $certDir = $ENV{'CERT_DIR'};
my $certName = $ENV{'CERT_FILE_NAME'};
my $keyName = $ENV{'CERT_KEY_NAME'};

if (-e $nginxConf)
{
# Add ssl certificates to NGINX config
replaceFileContent('# bindings of static files', "ssl_certificate $pathToCert;\n ssl_certificate_key $pathToKey;\n", $nginxConf);
replaceFileContent('# bindings of static files', "ssl_certificate $certDir/$certName;\n ssl_certificate_key $certDir/$keyName;\n", $nginxConf);
}
}

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 f07cc62

Please sign in to comment.