Containers¶
Using BotCity's available images you can quickly have access to BotCity CLI and BotCity Runner for your project.
Using BotCity's available images you can setup your development environment in no time.
Available Images¶
We currently provide the following images:
Image Name | Description |
---|---|
botcity-base | BotCity Image with BotCity Runner and CLI from BotCity Studio SDK |
botcity-java-web-firefox | Extension of botcity-base with Java and Firefox browser |
botcity-java-web-chrome | Extension of botcity-base with Java and Chrome browser |
botcity-python-web-firefox | Extension of botcity-base image with Python 3.9 and Firefox browser |
botcity-python-web-chrome | Extension of botcity-base image with Python 3.9 and Chrome browser |
botcity-python-desktop | Extension of botcity-base image with Python 3.9 and Desktop support |
botcity-base
image is a base image and contains Java as well as the BotCity Runner and CLI.
All other images are derived from this image and add additional features.
Mirrors¶
BotCity container images are available in the following mirrors:
Mirror | Image Prefix |
---|---|
Docker Hub | botcity/ |
Amazon AWS ECR | public.ecr.aws/ |
When to use which image¶
If you intend to simply use the BotCity CLI, you can use the botcity-base
image.
For headless Python development you can pick the appropriate image for your project depending on your runtime browser.
Configuration¶
In order to use it you will need to provide the following environment variables:
- SERVER: The server prefix. E.g.:
developers
fordevelopers.botcity.dev
. - LOGIN: The BotCity Maestro login information available at the
Dev. Environment
page. - KEY: The BotCity Maestro key information available at the
Dev. Environment
page. - WORKSPACE: The BotCity Maestro workspace information available at the
Dev. Environment
page. - MACHINE_ID: The machine ID to be used by the BotCity Runner.
- IGNORE_SSL: (Optional) If set to
true
, it will ignore SSL certificate validation. Use with caution! - DEBUG_ENABLED: (Optional) If set to
true
, it will enable debug mode and produce more verbose logs. Use with caution!
For more information about the configuration, please visit the Dev. Environment page.
Usage¶
As mentioned above, this image contains the BotCity Runner and BotCity CLI tools from the BotCity Studio SDK.
They can be launched via the BotCLI
and BotRunner
commands and all parameters are forwarded to the respective tools.
Important
For the usage examples below we will assume that you already have the beginning of the command as:
docker run --rm -ti -e WORKSPACE=YOUR_WORKSPACE -e SERVER=YOUR_SERVER -e LOGIN=YOUR_LOGIN -e KEY=YOUR_KEY -e MACHINE_ID=YOUR_MACHINE_ID
And we will replace it with <docker config>
so please make sure to adapt the command accordingly.
The image name will also be displayed as <image name>
so please make sure to adapt the command accordingly for the image and mirror you want to use.
Warning
The Chrome images require the --shm-size
parameter to be set to at least 1g
. Example: --shm-size="1g"
.
The --shm-size
parameter allows you to specify the shared memory size available for containers in bytes units. This is useful in scenarios where you run applications inside containers that extensively use shared memory.
If you are using docker compose, you can set this parameter via the shm-size
parameter. See the example below:
BotCity CLI¶
To launch the BotCLI tool, simply run the following command:
Important
In order to deploy or update a Bot or perform any other action which relies on files on the disk, you will need to share this folder with the container and adjust the path accordingly.
For more information about shared folders and Docker please visit the Docker documentation.
For more information about the BotCLI tool, please refer to the BotCity CLI documentation.
BotCity Runner¶
To launch the Runner tool, simply run the following command:
Important
For the BotCity Runner, the MACHINE_ID
environment variable is mandatory.
For more information about the BotCity Runner tool, please refer to the BotCity Runner documentation.
Examples¶
Here are some practical examples using the container images above.
Info
For the purposes of this example we will assume the following:
- Our BotCity server is running on
company.botcity.dev
- Our BotCity workspace is
company
- Our BotCity login is
company
- Our BotCity key is
COM_123ABCBA321
- Our Machine ID is
DOCKER_01
The Docker command will be for all cases:
Creating a Machine with the BotCity CLI¶
In this example we will use the BotCity CLI to create a new machine with the machineId
as DOCKER_01
using the AWS ECR mirror.
The command explained:
<docker config>
is the command prefix we described on the beginning of this sectionpublic.ecr.aws/botcity/botcity-base:latest
is the image name wherebotcity-base
is the name andlatest
is the tagBotCLI
is the command namemachine new
is the command action-machineId DOCKER_01
is the parameter sent to the BotCLI machine new command
Tip
To use Docker Hub as the mirror, simply change the image name from public.ecr.aws/botcity/botcity-base:latest
to botcity/botcity-base:latest
.
Deploying a Bot with the BotCity CLI¶
In this example we will deploy a Python automation available on the file BotPython-1.0.tar.gz
using the Docker Hub mirror.
Since we need the BotCity CLI to have access to the BotPython-1.0.tar.gz
file, we will need to share the folder with the container.
<docker config> -v my_code_folder:/code botcity/botcity-base:latest BotCLI bot deploy -version 1.0 -botId BotPython -file /code/BotPython-1.0.tar.gz -python
The command explained:
<docker config>
is the command prefix we described on the beginning of this section-v my_code_folder:/code
is the folder with theBotPython-1.0.tar.gz
file to share with the container and/code
is the path inside the containerbotcity/botcity-base:latest
is the image name wherebotcity-base
is the name andlatest
is the tagBotCLI
is the command namebot deploy
is the command action-version 1.0 -botId BotPython -file /code/BotPython-1.0.tar.gz -python
are the parameter sent to the BotCLI bot deploy command
BotCity Runner for Headless Python Firefox Automations¶
In this example we will use the BotCity Runner to run Python automations that use Firefox browser in headless mode using the AWS ECR mirror.
The command explained:
<docker config>
is the command prefix we described on the beginning of this sectionpublic.ecr.aws/botcity/botcity-python-web-firefox:latest
is the image name wherebotcity-python-web-firefox
is the name andlatest
is the tagBotRunner
is the command name
No additional parameters are required for a standard BotCity Runner execution.
Tip
You can also use the -single
parameter to run a single automation and terminate the container execution.
Tip
To use Docker Hub as the mirror, simply change the image name from public.ecr.aws/botcity/botcity-python-web-firefox:latest
to botcity/botcity-python-web-firefox:latest
.
Customizing the Images¶
If you need to customize the images, you can create your own Dockerfile and use one of the images above as the base.
As an example, if you need to add additional packages to the botcity-python-desktop
image, you can create a Dockerfile like the following:
FROM botcity-python-desktop:latest
# Install System Dependencies
RUN apt-get update && \
\
apt-get -y install freerdp2-x11 \
--no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
Then you can build the image using the following command:
And then you can use the my-botcity-python-desktop:latest
image in your project.
Important
Please keep in mind that the images are provided as is and we do not provide support for custom images.
Don't overwrite the ENTRYPOINT
or CMD
instructions in the Dockerfile as it will break the BotCity Runner and BotCity CLI tools.
For more information about Dockerfiles and how to use them, please visit the Docker documentation.
Troubleshooting¶
When using the AWS ECR mirror, I get an error message saying pull access denied for public.ecr.aws/botcity/botcity-base, repository does not exist or may require 'docker login': denied: Your authorization token has expired. Reauthenticate and try again.
. What do I do?
The images are available publicly in the AWS ECR mirror so you don't need to have credentials to pull them.
If you are receiving this message, please try to follow the instructions on the AWS ECR documentation.
When I try to run the BotCity CLI tool, I get an error message saying Login failed. Check your internet connection, server availability or SERVER parameter in config.properties
. What do I do?
Make sure you have provided the correct SERVER environment variable.
If your server URL is developers.botcity.dev
, then the correct SERVER environment variable is developers
.
If the SERVER
environment variable is correct, then make sure you have provided the correct LOGIN and KEY environment variables as well.