{"id":13691827,"url":"https://github.com/Cumulocity-IoT/apama-streaming-analytics-docker-samples","last_synced_at":"2025-05-02T15:33:03.546Z","repository":{"id":27356293,"uuid":"111082575","full_name":"Cumulocity-IoT/apama-streaming-analytics-docker-samples","owner":"Cumulocity-IoT","description":"The samples in this repository demonstrate how you can use Docker to deploy and manage entire Apama applications.","archived":false,"fork":false,"pushed_at":"2025-01-06T17:18:22.000Z","size":250,"stargazers_count":9,"open_issues_count":0,"forks_count":7,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-09T10:52:12.984Z","etag":null,"topics":["apama","iot-analytics"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cumulocity-IoT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-17T09:09:01.000Z","updated_at":"2025-01-06T17:18:21.000Z","dependencies_parsed_at":"2024-04-08T02:00:53.548Z","dependency_job_id":"e665b84f-f9f2-437d-8a5a-2faabcd55b99","html_url":"https://github.com/Cumulocity-IoT/apama-streaming-analytics-docker-samples","commit_stats":null,"previous_names":["cumulocity-iot/apama-streaming-analytics-docker-samples","softwareag/apama-streaming-analytics-docker-samples"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cumulocity-IoT%2Fapama-streaming-analytics-docker-samples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cumulocity-IoT%2Fapama-streaming-analytics-docker-samples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cumulocity-IoT%2Fapama-streaming-analytics-docker-samples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cumulocity-IoT%2Fapama-streaming-analytics-docker-samples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cumulocity-IoT","download_url":"https://codeload.github.com/Cumulocity-IoT/apama-streaming-analytics-docker-samples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252063140,"owners_count":21688655,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apama","iot-analytics"],"created_at":"2024-08-02T17:00:50.800Z","updated_at":"2025-05-02T15:33:03.539Z","avatar_url":"https://github.com/Cumulocity-IoT.png","language":"Dockerfile","funding_links":[],"categories":["IoT \u0026 Analytics"],"sub_categories":["![icon-Apama-64x64](https://user-images.githubusercontent.com/23717841/230378172-ec6dfd5c-6785-4785-b0f8-4a1ac670b4fa.png) Apama"],"readme":"# Apama samples for Docker and Kubernetes\n\n## License\nCopyright (c) 2017-2023 Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors.  \nCopyright (c) 2024 Cumulocity GmbH. The name Cumulocity GmbH and all Cumulocity GmbH product names are either trademarks or registered trademarks of Cumulocity GmbH and/or its subsidiaries and/or its affiliates and/or their licensors. Other company and product names mentioned herein may be trademarks of their respective owners. \n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\nfile except in compliance with the License. You may obtain a copy of the License at\nhttp://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software distributed under the\nLicense is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\neither express or implied. \nSee the License for the specific language governing permissions and limitations under the License.\n\n\n## Apama packaging kit for Docker\nThis package contains configuration and samples to help you containerize and\nrun Apama components and applications on the Docker platform.\n\nSee the Supported Platforms page for information about recommended Docker\nversions and support. This is available from the following web page:\nhttps://cumulocity.com/apama/docs\n\nDocker and the Docker logo are trademarks or registered trademarks of Docker,\nInc. in the United States and/or other countries. Docker, Inc. and other\nparties may also have trademark rights in other terms used herein.\n\n## Image list\n\nCumulocity GmbH produces several different variations of the Apama product as Docker images, depending on your use case. Please consult this table for the various images and their uses:\n\n| Image                                                                                               | Use                                                                                                                         |\n|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|\n| [public.ecr.aws/apama/apama-correlator](https://gallery.ecr.aws/apama/apama-correlator)                 | Image for the correlator including support for Java and Python. Doesn't contain connectivity to other Cumulocity GmbH products.\t|\n| [public.ecr.aws/apama/apama-correlator-minimal](https://gallery.ecr.aws/apama/apama-correlator-minimal) | Smallest image for the correlator, aimed at pure-Apama use cases. Doesn't contain Java or Python support, or connectivity to other Cumulocity GmbH products. |\n| [public.ecr.aws/apama/apama-correlator-suite](https://gallery.ecr.aws/apama/apama-correlator-suite)     | Image for the correlator containing support for Java, Python, and connectivity to the rest of the Cumulocity GmbH product suite and JMS. |\n| [public.ecr.aws/apama/apama-cumulocity-jre](https://gallery.ecr.aws/apama/apama-cumulocity-jre)         | Base image for custom Cumulocity IoT microservices, containing the correlator and connectivity to Cumulocity IoT. |\n| [public.ecr.aws/apama/apama-builder](https://gallery.ecr.aws/apama/apama-builder)                       | Project build and test tools for deploying and testing projects to be used with the \"apama-correlator\" and \"apama-minimal\" images in a multi-stage Docker build. |\n| [public.ecr.aws/apama/apama-builder-suite](https://gallery.ecr.aws/apama/apama-builder-suite)           | Project build and test tools (including Apache Ant) for deploying and testing projects, to be used with the \"apama-correlator-suite\" image in a multi-stage Docker build. |\n| [public.ecr.aws/apama/apama-cumulocity-builder](https://gallery.ecr.aws/apama/apama-cumulocity-builder) | Project build and test tools for deploying and testing projects to be used with the \"apama-cumulocity-jre\" image in a multi-stage Docker build. |\n\n## Running a Docker image\nYou can turn an image into a running container with the 'docker run'\ncommand. But before you do, there are a number of configuration options you\nwill need to consider.\n\n### Exposed ports:\nAs a virtualization platform, Docker runs each container in its own\nisolated network stack. Any exposure to the host operating system's\nnetwork stack, or to that of other containers, must be explicit.\nVia the EXPOSE element of the Dockerfile, the image designates the ports\nthat it may be listening on. In this case, these are the default ports of\nthe correlator.\n\nThe simplest way to make use of this is via the '-p' option which maps a\nlistening port in the container to a listening port on the host networking\nstack. For an Apama image, you will probably want to map port 15903, the\ndefault listening port of the correlator.\n\nThe more usual/idiomatic way is to link containers directly together,\nentirely ignoring the host operating system, but this is covered in later\nsamples.\n\nUltimately, turning an image into a running container will look\nsomething like this:\n\n\u003e docker run -d -p 15903:15903 --name apama_in_docker public.ecr.aws/apama/apama-correlator:10.15\n\nYou can then look for your running container:\n\n\u003e docker ps\n\n|CONTAINER ID      |IMAGE           |COMMAND             |CREATED             |STATUS       |PORTS      |NAMES|\n|---               |---             |---                 |---                 |---          |---        |---          |\n|41d25137fbd0      |public.ecr.aws/apama/apama-correlator:10.15    |\"correlator -j\"     |2 seconds ago       |Up Less than a second |0.0.0.0:15903-\u003e15903/tcp   |apama_in_docker  |\n\n\n## Interacting with the container\nNow you will be able to interact with the correlator running inside the\ncontainer. Because ports from the container have been mapped to the host\noperating system's networking stack, you can run Apama commands outside of\nDocker to do this. A Docker-based application should not normally rely on\nprocesses in the host operating system, but this approach is sufficient for\nthe current example.\n\nFrom a shell in this directory, source Apama/bin/apama_env then run:\n\n\u003e engine_inject -p 15903 -n localhost applications/Simple/HelloWorld.mon\n\nSome simple EPL will then be executed inside your containerized correlator.\nNote the use of 'localhost' and '15903' to connect to the mapped port. You can\nsee the evidence with another Apama command, similarly invoked:\n\n\u003e engine_inspect -p 15903 -n localhost \n\nThis will show you the existing 'HelloWorld' monitor.\n\n### Interacting with the container from another container\n\nApama commands can also be run from an Apama container. To begin you need to create a common network in docker that the containers will share:\n\n```\ndocker network create my-network\n```\n\nNow, start up the correlator, either using the option above or the following simple option without a port exposed.\n\n```\ndocker run -d --net my-network --name correlator_container public.ecr.aws/apama/apama-correlator:10.15\n```\n\nAn optional stage which will prove that the network is working as expected is to fire up a busybox container and ping the apama container by name:\n\n```\ndocker run -it --name mybusybox --net my-network --rm busybox\n# ping correlator_container\nPING correlator_container (192.168.48.2): 56 data bytes\n64 bytes from 192.168.48.2: seq=0 ttl=64 time=0.145 ms\n64 bytes from 192.168.48.2: seq=1 ttl=64 time=0.105 ms\n...\n```\n\nThen the sample file can be passed to the Apama instance by using a local volume. Update \u003cYourPath\u003e to the local path where this repo resides. For example:\n\n```\ndocker run --rm -t -i -v /\u003cYourPath\u003e/apama-streaming-analytics-docker-samples/applications/Simple/HelloWorld.mon:/apama_work/HelloWorld.mon --net my-network public.ecr.aws/apama/apama-correlator:10.15 engine_inject /apama_work/HelloWorld.mon -n correlator_container\n```\nFinally, the status of the Correlator can be checked as well:\n\n```\ndocker run --rm -t -i --net my-network public.ecr.aws/apama/apama-correlator:10.15 engine_inspect -n correlator_container\n```\n\nOr if you wish to watch it:\n\n```\ndocker run --rm -t -i --net my-network public.ecr.aws/apama/apama-correlator:10.15 engine_watch -n correlator_container\n```\n\n## Log files\nDocker treats anything emitted on the console by a contained process as\nlogging, and stores it appropriately. All of the examples and samples in this\npackage ensure that Apama components log to the console. Try:\n\n\u003e docker logs apama_in_docker\n\nto see the log message that announced the injection of the .mon file from the\nabove example.\n\n## Licensing\nFor adding a license to your image refer to section on licensing in ['image/README'](image/README.md).\n\n## Generating Deployment Files\nSome of these Docker samples use an 'initialization.yaml' configuration\nfile when starting the correlator process to allow the correlator to initialize\nitself. To generate the 'initialization.yaml' file, the\n'engine_deploy' tool is execute on a Designer project or directory. See the \ndocumentation for details, but an example using the 'Weather' sample can be run\nfrom the Apama Command prompt of your Apama installation:\n\n\u003e engine_deploy ./apama-samples/studio/demos/Weather --outputDeployDir ./apama-samples/docker/applications/Weather\n\n## Next steps\nThere are multiple samples provided that teach you how to use Docker Compose\nand other Docker features to run and manage entire multi-process applications\nfrom inside Docker.\n\nPlease see the supplied samples which can be found under 'applications/'. You\nshould start with the top level [README](applications/README.md) found directly under this folder. \n\nEach sample application also then has an individual README:\n\n|Readme|\n|---|\n|[Adapter](applications/Adapter/README.md)|\n|[MemoryStore](applications/MemoryStore/README.md)|\n|[Simple](applications/Simple/README.md)|\n|[UniversalMessaging](applications/UniversalMessaging/README.md)|\n|[Weather](applications/Weather/README.md)|\n\n______________________\nThese tools are provided as-is and without warranty or support. They do not constitute part of the Cumulocity GmbH product suite. Users are free to use, fork and modify them, subject to the license agreement. While Cumulocity GmbH welcomes contributions, we cannot guarantee to include every contribution in the main project.\n\nContact us at [Apama community](https://apamacommunity.com) if you have any questions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCumulocity-IoT%2Fapama-streaming-analytics-docker-samples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCumulocity-IoT%2Fapama-streaming-analytics-docker-samples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCumulocity-IoT%2Fapama-streaming-analytics-docker-samples/lists"}