我可以在同一ECS容器上运行aws-xray吗? [英] Can I run aws-xray on the same ECS container?
问题描述
我不想仅为了启用X射线就部署其他ECS服务.我希望我可以在与我的应用程序相同的docker容器上运行X-Ray,我本以为那是运行它的首选方式.我知道如果我的容器死了,可能会丢失一些数据.但是我对此不太在意,我试图阻止这种仅提供额外分析/日志记录功能的额外服务的泛滥,我已经有一个不满意的logstash容器,我的感觉是应用程序本身应该能够做这种事情.
I don't want to have to deploy a whole other ECS service just to enable X-Ray. I'm hoping I can run X-Ray on the same docker container as my app, I would have thought that was the preferred way of running it. I know there might be some data loss if my container dies. But I don't much care about that, I'm trying to stop this proliferation of extra services which serve only extra analytical/logging functions, I already have a logstash container I'm not happy about, my feeling is that apps themselves should be able to do this sort of stuff.
推荐答案
So I think the proper way to do this is using supervisord, see link for an example of that, but I ended up just making a very simple script:
# start.sh
/usr/bin/xray &
$CATALINA_HOME/bin/catalina.sh run
然后有一个Dockerfile:
And then having a Dockerfile:
FROM tomcat:9-jdk11-openjdk
RUN apt-get install -y unzip
RUN curl -o daemon.zip https://s3.dualstack.us-east-2.amazonaws.com/aws-xray-assets.us-east-2/xray-daemon/aws-xray-daemon-linux-3.x.zip
RUN unzip daemon.zip && cp xray /usr/bin/xray
# COPY APPLICATION
# TODO
COPY start.sh /usr/bin/start.sh
RUN chmod +x /usr/bin/start.sh
CMD ["/bin/bash", "/usr/bin/start.sh"]
我想下一次我会考虑使用 supervisord
.
I think I will look at using supervisord
next time.
这篇关于我可以在同一ECS容器上运行aws-xray吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!