System Architecture
Core Features
Data Management
Frontend Components
Backend Systems
The following files were used as context for generating this wiki page:
This document describes the setup for running the Embedchain API server using Docker Compose. The provided docker-compose.yml file defines a single service, backend, which encapsulates the API server application. This setup facilitates easy deployment and management of the API server within a containerized environment, ensuring consistent operation across different development and production stages.
The primary purpose of this configuration is to build the API server's Docker image, manage its environment variables, map necessary ports for external access, and mount local directories for development or persistent storage.
The docker-compose.yml file specifies the configuration for the backend service, which represents the Embedchain API server. This service is designed to be built from a local Dockerfile and run as a Docker container.
backendThe backend service is the core component defined in the Docker Compose file. It outlines how the API server container should be built and executed.
The backend service is configured to build its image from a Dockerfile in the current context, use environment variables from variables.env, expose port 5000, and mount the current directory as a volume.
The container for the backend service is explicitly named embedchain_api. This ensures a predictable and easily identifiable container name. The restart: unless-stopped policy dictates that the container will automatically restart unless it is explicitly stopped by the user or Docker daemon.
Sources: embedchain/examples/api_server/docker-compose.yml:5-6
The Docker image for the backend service is built from a Dockerfile located in the current directory (.). This allows for custom build instructions specific to the API server application.
Sources: embedchain/examples/api_server/docker-compose.yml:7-9
Environment variables required by the API server are loaded from a file named variables.env. This approach keeps sensitive or configuration-specific variables separate from the docker-compose.yml file, promoting better security practices and easier management.
Sources: embedchain/examples/api_server/docker-compose.yml:10-11
The API server running inside the container listens on port 5000. This port is mapped to port 5000 on the host machine, making the API server accessible from outside the Docker container at http://localhost:5000 (or the host's IP address).
Sources: embedchain/examples/api_server/docker-compose.yml:12-13
A volume is mounted from the current directory (.) on the host machine to /usr/src/api inside the container. This is particularly useful for development, allowing changes made to the source code on the host to be reflected inside the container without rebuilding the image, often enabling hot-reloading features of the application.
Sources: embedchain/examples/api_server/docker-compose.yml:14-15
The following diagram illustrates the steps involved in deploying the Embedchain API server using the provided docker-compose.yml file.
The table below summarizes the key configuration parameters for the backend service as defined in the docker-compose.yml.
The API server, once running, is designed to interact with external clients via the exposed port 5000. The variables.env file would typically contain configurations for databases, external APIs, or other services that the API server depends on.
build.context. |
Directory where the Dockerfile is located. |
| docker-compose.yml:8 |
build.dockerfile | Dockerfile | The name of the Dockerfile to use. | docker-compose.yml:9 |
env_file | variables.env | File containing environment variables. | docker-compose.yml:11 |
ports | 5000:5000 | Maps host port 5000 to container port 5000. | docker-compose.yml:13 |
volumes | .:/usr/src/api | Mounts the current directory to /usr/src/api inside the container. | docker-compose.yml:15 |