HybridChat Offline Deployment Guide
A system with internet access allowed is needed to complete this procedure.
On both source and target system, the deployment branch has to be exactly same for the solution to work properly. This can be achieved by providing '-p /path/of/offline/repo/clone ' switch to the 'install-hybrid-chat.sh' script. Git checkout must be completed to represent the required branch.
Purpose
For customer environments with no or a very limited internet access, this guide illustrates the process to unload the archives for the required components and then load them on the offline system.
Preparation
On a system with internet accessible, prepare the system with below given requirements before starting off.
- docker and docker-compose are already installed.
- access to the gitlab.expertflow.com on port 9242 is allowed.
Source System
All operations mentioned below should be performed on the Source System ( with unrestricted internet access )
Offline Registry
On the source system with internet available, download and archive the image of docker registry as its not part of the Hybrid Chat solution.
$ docker pull registry:2
$ docker save -o docker-registry.tar registry:2
Above steps will create an offline archive for registry image , needed for the solution deployment on an offline system and copy the resulting docker-regitry.tar along with other archives created in next steps.
Downloading the script
Download the load_unload.sh script and make it executable by executing ( or clone the repository using git clone)
$ chmod +x load_unload.sh
the script only accepts 1 of 2 switches to function properly,.
Create Archive
Based on the selections made, the script will download all the selected images and create an archive for every single image in a temporary folder under /tmp.
$ ./load_unload.sh -c
The unloading process confirms branch name to be archived and then extracts its images for offline deployment purposes. The branch that you input here must be specified when deploying from this archive.
Portainer is not not included as part of the unloading process. Create an offline archive of the portainer using same command used for offline registry and load it manually on the target system.
# Pull the Portainer Images
$ docker pull portainer/portainer-ce
# Create an archive of the portainer images
$ docker save -o portainer.tar portainer/portainer-ce
Copy the portainer.tar archive to the offline system along with other archives.
Hybrid-Chat Archive
On Source system, create an archive of the hybrid-chat repository using below given command
$ git clone https://gitlab.expertflow.com/expertflow/hybrid-chat.git
# Create archive of the newly cloned repo.
$ tar cvf hybrid-chat.tar hybrid-chat
Transfer the archives
Once all the archives are ready include the archive for Hybrid-Chat Repo, transfer the archives to the offline system using whatever mechanism is possible like FTP , USB flash disk etc.
Target System
Once all the unloaded files from the source system are transferred to the target system, please follow below given procedure.
Enable Local Registry
In order to make the images available for deployment, a local docker registry must be setup. The load_unload.sh script automatically tags the offline image to 'localhost:9099' host.
Run the local docker registry using
# Import the Docker Registry Image
$ docker load -i docker-registry.tar
# List the current images , this will show only the docker registry image for now.
$ docker images
# Start the Docker Registry locally on port 9099
$ docker run -d -p 9099:5000 --name registry registry:2
# Check the registry container is running by executing
$ docker ps -a
Load Archive
Loading the archive on an offline system after the archive is transferred successfully., simply run the script with -l( lowercase L) switch. The script will ask to enter the path containing images and starts loading them automatically.
$./load_unload.sh -l
Once requested, enter the path of the unloads for example '/tmp/efholder.xyz/unloads' and the script will automatically select all image archives.
Load the Portainer-ce image
$ docker load -i portainer.tar
Prepare the Deployment Directory
Copy the chat-solution repository to the destination directory
# extract the archive of Hybrid-Chat repo.
$ tar xvf hybrid-chat.tar
# and copy to the destination folder
$ cp -rp hybrid-chat /var/lib/expertflow
Verify the branch in deployment path.
# change the directory to the destination folder
$ cd /var/lib/expertflow
# checkout to the branch of archives -- enter the same branch that was selected to unload the images in step `Create Archive`
$ git checkout <branch-name>
Deployment Profile Configuration
When running in an offline deployment mode, the 'install-hybid-chat.sh' script needs to be modified to accommodate local registry.
First edit the script and change the repository variable EF_REPO_URL to 'localhost:9099' from 'gitlab.expertflow.com:9242' in the global variables section.
The install-hybrid-chat.sh script automatically updates the registry to correct value for all Expertflow based profiles. However below given profiles need to be updated manually for the deployment to work appropriately.
- kb-integration
- rasa
- loadbalancer
- rasa-x
Please add localhost:9099 for all images not starting with gitlab.expertflow.com:9242. The default location of all profiles is DEPLOYMENT_PATH/sds
Once all profiles are updated with local docker registry, you can verify the same by executing
$ egrep "image:" DEPLOYMENT_PATH/sds/docker-compose-*.yml
Only image names NOT starting with gitlab.expertflow.com:9242 should be changed. Please don not change the images names starting with 'gitlab.expertflow.com:9242', as the install script automatically replaces this URL with the value that you specified in the EF_REPO_URL
Once all above given profiles are updated with registry changes, run the offline deployment
$ ./install-hybrid-chat.sh -p /var/lib/expertflow