What's this?
StackStorm Docker image that runs one st2 service per container.
Why we need this?
Each container should have only one concern
Quote from Best practices for writing Dockerfiles
A sample docker-compose.yml
file is located under runtime/compose-1ppc
directory.
Follow the instruction below to setup a running StackStorm instance which consists of
containers that each are running individual st2 service.
- Generate .env files
(cd ../../ && make env)
cp -r ../../conf .
- Start containers
docker-compose up -d
Now you can access StackStorm Web UI.
- Register initial content
docker-compose exec st2actionrunner \
st2-register-content --config-file /etc/st2/st2.conf \
--register-all --register-setup-virtualenvs
Note: /opt/stackstorm/virtualenvs
directory needs to be mounted as a shared volume on
the container that you run the above command.
- Run simple action
docker-compose exec st2client st2 run core.local cmd=date
- Install examples
docker-compose exec st2client st2 pack install https://github.com/shusugmt/st2-pack-examples
- Run mistral example
docker-compose exec st2client st2 run examples.mistral_examples
FAQ
- Q: Fails to run mistral actions
- A: Restart
mistrap-api
ormistral-server
container once bydocker-compose up -d --force-recreate mistral-api
- This is caused by the conflict of
mistral-db-manage
command being invoked by bothmistral-api
andmistral-server
. When you first rundocker-compose up -d
the command runs in both containers almost at the same time and simply fails to load the required content into database. Restarting one of them will re-run the command again and populate postgres with a proper data.
- This is caused by the conflict of
- Q: I can login to the Web UI but when I click any link, I'm redirected back to login page
- A: Check you docker host clock
docker-compose up --scale st2actionrunner=3 -d
Parameter | Description |
---|---|
ST2WEB_DNS_RESOLVER |
(Optional) Hostname or address of the DNS resolver that nginx running in st2web container will use. Default is 127.0.0.1 which is suitable for sidecar pattern in Kubernetes. |
See official document for details.
/opt/stackstorm/packs
- st2api
- st2actionrunner
- st2sensorcontainer
/opt/stackstorm/virtualenvs
- st2actionrunner
- st2sensorcontainer
Add following service entry to docker-compose.yml
st2chatops:
<<: *base
environment:
- ST2_SERVICE=st2chatops
- HUBOT_ADAPTER=slack
- HUBOT_SLACK_TOKEN=xoxb-CHANGE-ME-PLEASE
- ST2_API_KEY=CHANGE-ME-PLEASE
See official docs and /opt/stackstorm/chatops/st2chatops.env
for chatops configuration details.
- Currently all inter-service connections are done via plain http, which might be a problem in production setup.