This session will go through the basics of XL-Deploy and XL-Release. We'll use a Tomcat server to deploy the application. XL-Deploy, XL-Release and Tomcat are installed on a Alpine Linux VM using VirtualBox.
- Oracle VM VirtualBox
- Internet Browser, like Chrome, Firefox or Edge
That's it! :) You can use a SSH Terminal like Putty to login to the VM, if you prefer it over using VirtualBox itself.
Alpine hosts all applications used in this session. Tomcat is installed on the VM, while XL-Deploy and XL-Release are available as docker containers(with data persistence on the VM). The VM is available as an appliance you can import in your VirtualBox. The appliance also takes care of the port mapping, so you can access the applications using "localhost:<portNumber>"
Follow these instructions to import the VM as an appliance(*.ova).
- VM
- User:
root
- Password:
devoteam2019
- User:
- XL-Deploy/XL-Release:
- User:
admin
- Password:
devoteam2019
- User:
- Tomcat: http://localhost:8080
- XL-Deploy: http://localhost:4516
- XL-Release: http://localhost:5516
- SSH VM:
localhost:22
- Docker Ip*:
172.17.0.1
*The "Docker Ip" is used to connect the containers and Tomcat over the network.
- Start the VM with VirtualBox
- Login to the VM using VirtualBox or a SSH Terminal (Check the Credentials chapter above for username and password)
- Execute the following command to get the
CONTAINER ID
s to startXL-Deploy
andXL-Release
in the next step:
docker ps -a
- Start both containers using the following command:
docker start <containerId>
- The applications should become available in a minute or two.
Before we start, it's important to know that each entry in XL-Deploy is known as a Configuration Item
or CI
. So each defined application, application version, environment, host, etc is a CI
.
We going to the following:
- Import the
PetClinic
application to deploy - Define the
Tomcat
infrastructure - Define an environment we can deploy to
- First Deployment of
PetClinic
- Rollback a version of
PetClinic
Import the PetClinic
application, so you can deploy it later.
- Login to XL-Deploy
- Click on the
...
next toApplications
, then go toImport
>From XL Deploy Server
- Select
PetClinic-war/1.0
and clickImport
- Repeat steps 2 and 3 for package
PetClinic-war/2.0
- You should be able to see this:
We need to define the Tomcat
infrastructure, so XL-Deploy knows where to deploy the PetClinic
application.
We'll start by defining the target host first:
- Click on the
...
next toInfrastructure
, then go toNew
>overthere
>SshHost
- Fill in the following:
- Name:
TomcatHost
- Operating system:
Unix
- Connection Type:
SCP
- Address:
172.17.0.1
- Port:
22
- Username:
root
- Password:
devoteam2019
- Name:
- Click on
Save and close
- Click on the
...
next toTomcatHost
, then go toCheck connection
- Click on
Execute
to verify the connection to theTomcat
host. If verification is successful, click onFinish
Now we're going to define the Tomcat instance, so XL-Deploy knows where the Tomcat
is installed on the target host.
- Click on the
...
next toTomcatHost
, then go toNew
>tomcat
>Server
- Fill in the following:
- Name:
TomcatInstance
- Home:
/usr/local/tomcat/apache-tomcat-9.0.17
- Start Command:
/usr/local/tomcat/apache-tomcat-9.0.17/bin/startup.sh
- Stop Command:
/usr/local/tomcat/apache-tomcat-9.0.17/bin/shutdown.sh
- Name:
- Click on
Save and close
Last step in the infrastructure is to define where PetClinic
needs to be deployed.
- Click on the
...
next toTomcatInstance
, then go toNew
>tomcat
>VirtualHost
- Fill in the following:
- Name:
TomcatPetClinic
- Name:
- Click on
Save and close
The end result should look like this:
An environment is nothing more than a grouping of one or more Infrastructure CI
s you can deploy to. Your environment will only contain the TomcatInstance
CI
.
- Click on the
...
next toEnvironments
, then go toNew
>Environment
- Fill in the following:
- Name:
Production
(because that's how we roll) - Containers:
Infrastructure/TomcatHost/TomcatInstance/TomcatPetClinic
- Name:
- Click on
Save and close
Finally we can deploy.
- First check if you get a
HTTP 404
error when opening PetClinic in your browser - In
XL-Deploy
click on the bigStart a deployment
button in the center:
- Drag and drop the following:
Applications/PetClinic-war/1.0
toDrag and drop package here
Environments/Production
toDrag and drop environment here
- Click on
Preview
to see what tasks XL-Deploy will execute to deployPetClinic
- Click on
Close preview
to return to the previous view - Click on
Deploy
andPetClinic
should be deployed in seconds - Go to PetClinic and browse the application:
- Go back to
XL-Deploy
and click onFinish
. This will tell XL-Deploy you accept this deployment.
What if you just deployed a version of PetClinic
in production, but you don't want to accept that version and instead revert to the previous version? Here we going to do just that.
- In
XL-Deploy
click on the bigStart a deployment
button in the center:
- Drag and drop the following:
Applications/PetClinic-war/2.0
toDrag and drop package here
Environments/Production
toDrag and drop environment here
- Click on
Preview
and you can see that a task calledDestroy petclinic on TomcatPetClinic
has been added - Click on
Close preview
to return to the previous view - Click on
Deploy
andPetClinic
should be deployed in seconds. - Go to PetClinic. You see that the image on the homepage has been changed (if not: refresh the page):
- Let's say we won't accept this change in
PetClinic
and we want a rollback. Go back toXL-Deploy
and click onRollback
, thenYes
. - Go back to PetClinic and refresh the page. The image should revert to this:
- Go back to
XL-Deploy
and click onFinish
to accept the deployment. Should you want to rollback after accepting a deployment, you can always start a new one.