Task Name | - Docker Containers
|
Description | - .
|
Prerequisites | - Tested on 6.5 and
CentOS Linux release 7.4.1708 (Core) |
Category | Workflow |
Components | vSphere 6.5 |
User Inputs |
|
Instructions for Regular Workflow Use:
- Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
- Unzip the file on your computer. Should end up with a .WFD file.
- Log in to UCS Director as a user that has "system-admin" privileges.
- Navigate to "Policies-->Orchestration" and click on "Import".
- Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
- Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
- Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
- Click "Submit".
- A new folder should appear in "Policies-->Orchestration" that contains the imported workflow. You will now need to update the included tasks with information about the specific environment.
Creating Cent OS VM and Install Docker:
1) Create Catalog (CentOS Linux release 7.4.1708 (Core))
Select template (ISO install and turned off the libvirt, and added this to /etc/sudoers orf ALL=(ALL) ALL)
In the post provisioning section select the Docker Install workflow (bottom of this page as zip file, unzip and import into UCSD)
Workflow to install Docker and start Docker (workflow runs in VM Context!):
Commands for SSH taks #1:
echo ${OrfPassword} | sudo -S yum check-update
nohup curl -fsSL https://get.docker.com/ | sh > /tmp/dockerinstall.log &
nohup sleep 60; sudo usermod -aG docker ${User} &
Commands for SSH taks #2:
echo ${OrfPassword} | sudo -S systemctl start docker
sudo systemctl status docker
2) Create end user buttons (End-user-vm-actiopn-policy -> assign to VDC):
The result of the following actions should be this:
2 actions for the end user to select:
- create a container on the newly created VM
- generate depending on a search criteria a new LOV (list of values) to select a new Docker container from
(Docker has about 5 Billion containers to choose from and the LOV in UCSD can not be that long)
The workflows are attached below unzip and import into UCSD and attach to the action:
How to create 2 end user actions:
Create and action policy called Docker:
The policy has two actions associated:
Create 2 labels (Names of the Buttons for end user) and attach the workflows:
The Action Policy needs to be assigned to a VDC:
Workflow to create a Docker container:
Commands for SSH taks #1:
nohup echo ${OrfPassword} | sudo -S docker container run -ti -d --name ${ContainerName} ${SelectContainer} > /tmp/dockercreatecontainer.log &
nohup sleep 50; echo ${OrfPassword} | sudo -S docker ps -a &
Workflow to create new LOV data to select new and different docker containers to be created:
3 steps in the workflow
1) Contact Docker to generate a new list of docker images depending on the user entered search
2) Move the generated file to the UCSD VM
3) Execute the workflow that takes the docker date and generates a new LOV / new contents for the LOV
Once this is run then when the create container end user button is selected a new list will be presented.
Commands for SSH taks #1:
nohup echo ${OrfPassword} | sudo -S docker search ${DockerSearchCriteria} --limit 20 | awk '{ print \$1","\$1 }' > /tmp/PossibleDockerImages&
Commands for SSH taks #2:
nohup curl --insecure --user ${UCSDUser}:${UCSDUserPassword} -T /tmp/PossibleDockerImages sftp://${UCSDIP}/tmp/PossibleDockerImages &
Commands for SSH taks #3:
nohup curl --insecure -v -X POST -g -H 'X-Cloupia-Request-Key:${UCSDKEY}' -H 'Content-Type:application/x-www-form-urlencoded' -d 'formatType=json&opName=userAPISubmitWorkflowServiceRequest&opData={"param0":"CreateLOVPossibleDockerImagesV10","param1":{"list":[{"name":"Filenamewithpath","value":"/tmp/PossibleDockerImages"},{"name":"LovName","value":"PossibleDockerImages"}]},"param2":-1}' https://${UCSDIP}/app/api/rest &
Workflow to generate the LOV:
This is the same workflow as posted here (UCSD LOV Creation from CSV File) except the spaces have been removed out of the workflow variables (I did not wanted to deal wit %20 in my curl command).
End user Docker container creation (LOV has mail containers):
Generating a new LOV list of python containers:
End user LOV data generation:
Remote workflow execution and LOV creation:
LOV Results:
Results on the VM:
The following workflows are in the zip file: