简体   繁体   English

如何对Foxx服务进行dockerize?

[英]How to dockerize Foxx services?

I use ArangoDB as a backend server for my web application. 我使用ArangoDB作为我的Web应用程序的后端服务器。 So far I have used the Foxx CLI to deploy my code to the ArangoDB server. 到目前为止,我已经使用Foxx CLI将我的代码部署到ArangoDB服务器。 I wanted to deploy my entire application using Docker, but I can't figure out how to add my Foxx service source codes to an ArangoDB using containers. 我想使用Docker部署我的整个应用程序,但我无法弄清楚如何使用容器将我的Foxx服务源代码添加到ArangoDB。 Is it possible? 可能吗? If it is so what would be the correct way to do this? 如果是这样,那么这样做的正确方法是什么?

So far I have tried a docker-compose approach: running the official ArangoDB image and building another image equipped with Foxx CLI to install the source files, but I got "connection refused" error from the database server when I ran the "foxx install" method from the container. 到目前为止,我尝试了一个docker-compose方法:运行官方ArangoDB映像并构建另一个配备Foxx CLI的映像来安装源文件,但是当我运行“foxx install”时,我从数据库服务器收到“连接被拒绝”错误来自容器的方法。 (The ArangoDB server was working fine and I could run the "foxx install" command successfully outside virtualization). (ArangoDB服务器工作正常,我可以在虚拟化之外成功运行“foxx install”命令)。

For development purposes, I just keep the Foxx services in development mode and map the Foxx folder in my ArangoDB container (/var/lib/arangodb3-apps/_db/) to a folder in my machine using docker-compose volume definition. 出于开发目的,我只是将Foxx服务保持在开发模式,并使用docker-compose卷定义将我的ArangoDB容器中的Foxx文件夹(/ var / lib / arangodb3-apps / _db /)映射到我的机器中的文件夹。

Here is what a sample docker-compose service for ArangoDB could look like: 以下是ArangoDB的docker-compose服务示例:

services:
  arangodb_dev:
    image: arangodb
    container_name: my_arangodb_dev
    environment:
      - ARANGO_ROOT_PASSWORD=XXXXXX
    ports:
      - "8529:8529"
    volumes:
        - ./Arango/db:/var/lib/arangodb3
        - ./Arango/apps_db_system:/var/lib/arangodb3-apps/_db/ 

Above we map both the Foxx service directory and the DB files directory to a local folder for persistency purposes. 上面我们将Foxx服务目录和DB文件目录映射到本地文件夹以实现持久性目的。

Beyond development, you probably want to copy the files to the correct folder in the container instead of mapping the folder 除了开发之外,您可能希望将文件复制到容器中的正确文件夹,而不是映射文件夹

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM