Troubleshooting: How To Trigger the Migrator Tool in a containerized Environment [ECS] This article explains common issues encountered when executing the JFrog migrator tool from outside its containerized environment and provides steps for accessing and running the tool within a Fargate container, which is crucial for successful migrations. Why Do We Face “couldn’t find the export dir <path to tmp dir>/<file>.tmp. Please make sure to run this command inside the source Artifactory machine ” error when triggering the Migrator Tool Outside the Container? We encounter this error when running the migrator tool from outside the Artifactory container, even if you have set the JFROG_CLI_TEMP_DIR environment variable. The core reason for these errors is a fundamental mismatch in file system expectations: When Artifactory successfully exports its configuration, it creates the tmp files inside the container. However, as JFrog CLI (which acts as the migrator tool) is running outside the container on your host VM, it expects to find those exported files on the VM's file system. Therefore, since the files were generated inside the container, the CLI running on the VM cannot locate them, resulting in this error:Therefore, to ensure that the migration process completes successfully, the JFrog CLI needs to be installed and the tool needs to be triggered inside the Artifactory container as mentioned in the CLI documentation. Special Use-case: How to Log Into AWS Fargate Container to Trigger the JFrog CLI Migrator Tool Given the necessity to run the migrator tool from within the container, a special approach is required when Artifactory is installed in Fargate to log into the container and execute the tool. Steps to Access and Trigger the Migrator Tool in Fargate: Enable ECS Exec: To log into a Fargate container, you must explicitly enable ECS Exec for your specific Amazon Elastic Container Service (ECS) service. Attaching the related AWS documentation
- Explicitly enable execute-command on your service:
aws ecs update-service \ --cluster <cluster_name> \ --service <service_name> \ --enable-execute-command \ --region <region>
Redeploy Task Definition: After enabling ECS Exec on your service, it is crucial to redeploy your task definition. Please Note that already running tasks will not automatically gain ECS Exec capabilities. Therefore, a fresh deployment ensures that your tasks are launched with the necessary configurations for ECS Exec to function correctly. Verify IAM roles and Permissions: Kindly verify your IAM Permissions and Task Roles, as incorrect configurations can lead to errors. Refer to AWS documentation for details for permissions. To troubleshoot any misconfiguration, utilize ECS Exec Checker: AWS provides an ECS Exec checker tool that helps validate if your Amazon ECS cluster and task meet all the prerequisites for using ECS Exec. It is recommended to use this checker to ensure everything is set up correctly. Trigger the Migrator Tool: Once ECS Exec is enabled and you can successfully log into the Fargate container, then you will need to run the migrator tool from within that container as a root user. This ensures the tool has direct access to Artifactory's exported files, resolving the "couldn't find the export directory" error. Please Note that when using Fargate containers, they can be terminated and restarted at any time.This means that when a new container spins up, any state file from the previous container is lost. This includes information about the progress of a file transfer. Therefore, while you must trigger the transfer configuration from the source container, the file transfer itself can be initiated from an EC2 instance. This approach allows you to maintain the state file and ensure that transfer progress is not lost, as EC2 instances are not as volatile as Fargate containers