Skip to content

Deploy Center Docker Container

Nathan Bu edited this page Jul 30, 2023 · 17 revisions

Here is the deploy approach for Hydra Lab Center docker image.

1. Center env file setup

If you would like to overlap some env variables to enable/disable some submodules of Hydra Lab, you may include the key-value pairs in an env file. Format of the content should be as followed:

KEY1=VALUE1
KEY2=VALUE2

See the application.yml for available env variables (in form of ${XXX_YYY}).

Notice:

  • If the connected agent is started within docker, the env variable LOCAL_STORAGE_ENDPOINT (by default http://localhost:9886) for Center should be changed to "host.docker.internal" or the IP (public/private based on usage) of Center instance.
  • If the connected agent is started using jar package, no env variable is required to be set.

2. Center image startup

docker run -p "$(YOUR_PORT)":9886 [--env-file "${PATH_TO_YOUR_ENV_FILE}"] ghcr.io/microsoft/hydra-lab-center:latest

Notice:

  • When Center docker image is using local storage (i.e. env variable STORAGE_TYPE=LOCAL), the env variable LOCAL_STORAGE_ENDPOINT in application.yml needs to be changed according to the value of "$(YOUR_PORT)".

Use Azure Blob Storage Service

Hydra Lab currently supports Azure Blob Storage as cloud file storage solution to persist various file types such as log files, video, app package, etc. Any contribution to integrating other third-party storage services is welcome. (Here's the UML class diagram for this module as a reference: storage service structure.)

Some extra environment variables need to be specified in the command according to the storage service type.

If you want to use Azure Blob storage, please go to your Azure portal, open an Azure Blob storage account, and get the connection string. Brief steps: Login Azure -> Portal -> Storage Accounts -> Create new storage account (you may disable the public access for the container) -> In the created storage account, find Access Keys tab -> copy Connection string. image

You may write the following content in an env file (e.g. env.properties):

STORAGE_TYPE=AZURE
BLOB_CONNECTION_STR=${YOUR_BLOB_CONNECTION_STR}

Then pass the path of the file to docker container

docker run --env-file env.properties -p 9886:9886 --name=hydra-lab ghcr.io/microsoft/hydra-lab-uber:latest

Or simply run with the env parameter -e:

docker run -e STORAGE_TYPE=AZURE -e BLOB_CONNECTION_STR=${YOUR_BLOB_CONNECTION_STR} -p 9886:9886 --name=hydra-lab ghcr.io/microsoft/hydra-lab-uber:latest

To run a test with Uber image and any third-party storage service, additional steps are required:

  • Download record_release.apk and record_androidTest.apk from GitHub.
  • On the front-end page, go to Runner tab and click Upload.
  • Select the downloaded app record_release.apk for APK/IPA FILE and test app record_androidTest.apk for TEST APK/JAR/JSON FILE.
  • Click Upload and wait for it to finish.
  • Follow the steps of 1. to run the test.

Notice:

  • The package record shown on the page is preloaded for LOCAL storage only. If you try to run it with a different storage type, you will get an error.
  • You need to upload the package again if you want to use your own storage service instead of LOCAL storage.
  • You can never use more than one storage type in the official service. The above specific situation only occurs in Uber image where the context and database are set up with LOCAL storage as the default option for new users.

Package upload steps

See also

For connection from Agent to Center:

Clone this wiki locally