Unable to install pack from local directory
SUMMARY
Upon trying to install a known working pack from a local directory within the StackStorm Docker client container, the installation fails with ValueError: Local pack directory "/opt/stackstorm/test_pack" doesn't exist.
STACKSTORM VERSION
st2 3.6.0, on Python 3.6.9
OS, environment, install method
Docker container, using the official Docker Compose config. Host environment is Arch Linux running 5.17.5. All commands are executed from within the st2client container.
Steps to reproduce the problem
- Obtain copy of working pack on local computer. The linked pack installs fine when installing directly from GitHub.
- Copy local pack to
st2clientcontainer:docker compose cp ~/repos/test_pack st2client:/opt/stackstorm/(on host machine, fromst2-dockerdirectory) - Attempt to install pack:
st2 pack install file:///opt/stackstorm/test_pack(from withinst2clientcontainer)
Expected Results
The pack installs successfully, as it does when installing from GitHub.
Actual Results
Install fails with ValueError: Local pack directory "/opt/stackstorm/test_pack" doesn't exist. As a sanity check, the directory does exist:
root@667335d8ca8c:/opt/stackstorm# ls /opt/stackstorm
configs exports packs packs.dev rbac st2 test_pack virtualenvs
Thank you for any assistance!
You need to copy the pack content to the st2actionrunner container - that's where the actions run on. In addition to that, you also need to run st2-register-content in that container to register resources from that pack.
Or even better, copy it into the stackstorm-packs volume which is mounted and available in all the containers where that is necessary - https://github.com/StackStorm/st2-docker/blob/master/docker-compose.yml#L265.
@aaronkyriesenbach Just to confirm, per your message, does the pack install from github work?
It's just the st2 pack install file:// that has issues.
@armab That’s correct.
Thanks @Kami - makes sense. When installing a pack from the packs volume, how are paths handled? I’ve copied the pack to /opt/stackstorm/packs, which is where the volume is mounted on st2client, but have the same issue when installing from file:///opt/stackstorm/packs/test_pack. Looked through the Docker Compose config but didn’t see anything that seemed relevant here other than that the packs volume is mounted at the same place within st2actionrunner.
Do you have a .git dir in the pack? If no, run git init inside the pack and try to re-install the pack again with file:///.
There is a .git directory within the pack.