Deploying the Ballerina integration example in a Docker container

做~自己de王妃 提交于 2019-12-01 07:07:56

问题


On the Ballerina Quick Tour page, there is an example on deploying a previously created integration microservice (which is supposed to send a Tweet) within in a docker container.

However, that part of the documentation doesn't describe how to package the "twitter.toml" (authentication details) within the container. Therefore, it doesn't work as it does when it wasn't deployed within a container.

How can this be resolved?


回答1:


The piece on copying the config file is missing there. Try adding the @docker:CopyFiles annotation as well. The following worked for me:

@docker:Config {
    registry:"registry.hub.docker.com",
    name:"helloballerina",
    tag:"v1.0"
}
@docker:CopyFiles {
    files: [{source: "./twitter.toml", target: "/opt/twitter.toml", isBallerinaConf: true}]
}
endpoint http:Listener tweetEP {
    port: 9090
};

Here, I have opted to use /opt as the directory to place the config file. You can specify a path you want in the container. The isBallerinaConf field is to specify whether the file to be copied is a configuration file or not.

For more info, refer to the API docs of the ballerinax/docker package.




回答2:


Ballerina Quick-tour page is updated with relevant information now.



来源:https://stackoverflow.com/questions/50134123/deploying-the-ballerina-integration-example-in-a-docker-container

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!