Skip to content

Commit

Permalink
Added Client DockerFiles for Linux minor refactoring and hierarchical…
Browse files Browse the repository at this point in the history
… changes.
  • Loading branch information
Umer-Javaid committed Aug 8, 2018
1 parent b4cdc76 commit 71d5dbe
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 3 deletions.
53 changes: 53 additions & 0 deletions enterprise/client/Linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Setting base image for NCache.
FROM microsoft/dotnet:2.1-runtime

# Setting the enviornment variable so the NCache install script knows that it's running inside a container.
ENV container ncachedocker

# Setting work directory to copy setups and resources for configuring NCache.
WORKDIR /app

# Make sure that the 2 folders ("resources" and "setup") exist in the same directory as the Dockerfile.
# Make sure that "ipbinding.sh" script resides in the "resources" folder.
# Make sure that "startup.sh" script resides in the "resources" folder.
# Make sure that "installncache.sh" script resides in the "setup" folder.
# Make sure that NCache Linux setup (.tar.gz) resides in the "setup" folder. It can be downloaded from http://www.alachisoft.com/download-ncache.html.
# Copying resources and setups into the work directory of the container.
COPY resources .
COPY setup .

# Exposing ports used by NCache for communication.
# Exposing the port at which Ncache service will listen for the incoming client connection requests.
EXPOSE 9800

# Exposing the port at which Ncache service will listen for the incoming management connection requests (NCache Manager, Monitor and Tools).
EXPOSE 8250

# Make sure your machine has access to internet for installation of packages.
# Installing package procps (Prerequisite of NCache services).
RUN apt-get update &&\
apt-get install procps -y

# Installing NCache Linux setup (.tar.gz).
# The parameter "--evalkey" is the install key and is sent to user through e-mail once they download NCache setup. In case if user does not get a key, contact us at http://www.alachisoft.com/company/contact-us.html.
# The parameter "--firstname" represents the first name of the user.
# The parameter "--lastname" represents the last name of the user.
# The parameter "--email" represents the e-mail address of the user.
# The parameter "--installpath" represents the path where ncache will be installed. If not provided then /opt/ncache will be used.
# The parameter "--force" Force create destination directory if provided directory does not exist.
# The parameter "--password" represents the password for user ncache.
# The parameter "--installmode" represents the NCache installation mode and has the following values:
# Enterprise Server Install mode = "0"
# Enterprise Remote Client Install mode = "3"
RUN chmod +x installncache.sh &&\
./installncache.sh --installmode "3" --firstname "John" --lastname "Smith" --email "john@alachisoft.com" --installpath "/opt" --force --password "xxxxxxxx"

# Currently, the IP during NCache installation is stored in the configuration files and it can not be made static at that point.
# However, the IP can be made static once the container is started.
# The startup script calls ipbinding.sh which replaces the IP with the actual IP assigned to the container on the first time the container is started.
# Furthermore the startup.sh script starts ncached daemon service.
# Making startup.sh executable.
RUN chmod +x /app/startup.sh

# Entry point for the container, once all the required configurations have been made.
ENTRYPOINT /app/startup.sh && bash
15 changes: 15 additions & 0 deletions enterprise/client/Linux/resources/ipbinding.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

ip="$(hostname -i)"
DESTINATION=<DESTINATION>

cd $DESTINATION/ncache/bin/service

sed -i "s/<IP>/$ip/g" "Alachisoft.NCache.Daemon.dll.config"

cd $DESTINATION/ncache/config

sed -i "s/<IP>/$ip/g" "client.ncconf"
sed -i "s/<IP>/$ip/g" "config.ncconf"

rm -f /app/ipbinding.sh
9 changes: 9 additions & 0 deletions enterprise/client/Linux/resources/startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

if [ -e /app/ipbinding.sh ]
then
chmod +x /app/ipbinding.sh
/app/ipbinding.sh
fi

service ncached start
83 changes: 83 additions & 0 deletions enterprise/client/Linux/setup/installncache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/sh
while [ "$1" != "" ]; do
case $1 in
-d | --dotnethome ) shift
DOTNETHOME=$1
;;

-i | --ipaddress ) shift
IP=$1
;;

-p | --installpath ) shift
DESTINATION=$1
;;

-f | --firstname ) shift
FIRST_NAME=$1
;;

-l | --lastname ) shift
LAST_NAME=$1
;;

-e | --email ) shift
EMAIL=$1
;;

-k | --evalkey ) shift
KEY=$1
;;

-m | --installmode ) shift
INSTALLMODE=$1
;;

-P | --password ) shift
PASSWORD=$1
NEWPASS="true"
;;

-F | --force )
FORCE="true"
;;

-v | --verbose )
VERBOSE="true"
;;

-h | --help )
usage
exit
;;
* )
usage
exit 1
esac
shift
done


if [ -z $DESTINATION ]
then
DESTINATION="/opt"
fi

if [ -z $PASSWORD ]
then
PASSWORD="ncache"
fi

# Setting ncache install directory
sed -i "s|<DESTINATION>|$DESTINATION|g" "/app/ipbinding.sh"

# Extracting and installing NCache
tar -zxf ncache.ent.netcore.tar.gz
cd ncache-enterprise-4.9-dotnet

./install --installmode $INSTALLMODE --firstname $FIRST_NAME --lastname $LAST_NAME --email $EMAIL --installpath $DESTINATION --force --password $PASSWORD

# Removing installation resources
rm /app/ncache.ent.netcore.tar.gz
rm -r /app/ncache-enterprise-4.9-dotnet
rm -f /app/installncache.sh
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions enterprise/server/Linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Setting base image for NCache.
FROM microsoft/dotnet:2.1-runtime

# Setting the enviornment variable so the NCache install script knows that it's running inside a container
# Setting the enviornment variable so the NCache install script knows that it's running inside a container.
ENV container ncachedocker

# Setting work directory to copy setups and resources for configuring NCache.
Expand Down Expand Up @@ -29,7 +29,7 @@ EXPOSE 9900
# Exposing the port at which Bridge service will listen for the incoming Management connection requests (NCache Manager and Tools).
EXPOSE 8260

# Make sure your machine has access to internet for installation of packages
# Make sure your machine has access to internet for installation of packages.
# Installing package procps (Prerequisite of NCache services).
RUN apt-get update &&\
apt-get install procps -y
Expand All @@ -52,7 +52,7 @@ RUN chmod +x installncache.sh &&\
# However, the IP can be made static once the container is started.
# The startup script calls ipbinding.sh which replaces the IP with the actual IP assigned to the container on the first time the container is started.
# Furthermore the startup.sh script starts ncached, ncacheloaderd and ncachebridged daemon services.
# Making startup.sh executable
# Making startup.sh executable.
RUN chmod +x /app/startup.sh

# Entry point for the container, once all the required configurations have been made.
Expand Down

0 comments on commit 71d5dbe

Please sign in to comment.