System Architecture
Core Features
Data Management
Frontend Components
Backend Systems
The following files were used as context for generating this wiki page:
Local deployment for Embedchain examples leverages Docker Compose to orchestrate multi-container applications. This approach provides a consistent and isolated environment for running various components, such as backend APIs, frontend user interfaces, and specialized bots, without interfering with the host system's dependencies. By defining services, networks, and volumes in a docker-compose.yml file, developers can easily set up and manage complex application stacks locally.
This document outlines the local deployment strategies for several Embedchain examples, including a full-stack application, a standalone API server, and a Discord bot, all based on their respective Docker Compose configurations.
To deploy these examples locally, you must have Docker and Docker Compose installed on your system.
All provided Docker Compose configurations adhere to a common structure and utilize similar principles for service definition:
version: "3.9", indicating compatibility with Docker Compose file format version 3.9.service.container_name is explicitly set for each service to provide a human-readable identifier for the running container.restart: unless-stopped policy ensures that containers automatically restart if they stop for any reason, unless explicitly stopped by the user.Dockerfile located within a specified context directory.
Sources: embedchain/examples/full_stack/docker-compose.yml:1-19, embedchain/examples/api_server/docker-compose.yml:1-13, embedchain/examples/discord_bot/docker-compose.yml:1-9The full-stack example demonstrates a complete web application with a separate backend API and a frontend user interface.
This deployment consists of two primary services: backend and frontend. The frontend service is configured to depend on the backend service, ensuring the backend is available before the frontend attempts to start. Both services expose specific ports to the host machine, allowing external access.
backend service:
container_name: embedchain-backendbuild: Uses backend/Dockerfile within the backend context.image: embedchain/backendports: Maps host port 8000 to container port 8000.frontend service:
container_name: embedchain-frontendbuild: Uses frontend/Dockerfile within the frontend context.image: embedchain/frontendports: Maps host port 3000 to container port 3000.depends_on: Ensures the backend service starts before the frontend.
Sources: embedchain/examples/full_stack/docker-compose.yml:3-19The API server example focuses on deploying a standalone backend API.
This deployment consists of a single backend service that acts as the API server. It exposes a specific port, mounts a local directory as a volume for development or configuration, and loads environment variables from a dedicated file.
backend service:
container_name: embedchain_apibuild: Uses Dockerfile within the current directory (.) context.env_file: Loads environment variables from variables.env.ports: Maps host port 5000 to container port 5000.volumes: Mounts the current host directory (.) to /usr/src/api inside the container. This is useful for hot-reloading code changes during development.
Sources: embedchain/examples/api_server/docker-compose.yml:3-13The Discord bot example demonstrates deploying a bot application.
This deployment consists of a single backend service responsible for running the Discord bot logic. It builds from a local Dockerfile and relies on an environment file for sensitive configurations like API tokens.
backend service:
container_name: embedchain_discord_botbuild: Uses Dockerfile within the current directory (.) context.env_file: Loads environment variables from variables.env. This file would typically contain the Discord bot token and other necessary credentials.
Sources: embedchain/examples/discord_bot/docker-compose.yml:3-9Change your current directory to the specific Embedchain example you wish to deploy (e.g., embedchain/examples/full_stack).
If the example uses an env_file (like api_server or discord_bot), create a variables.env file in the root of that example directory and populate it with the necessary environment variables (e.g., API keys, tokens).
Run the following command in your terminal from the example directory:
docker compose up -dThe -d flag runs the containers in detached mode, allowing them to run in the background.
http://localhost:3000.http://localhost:5000. You can use tools like curl or Postman to interact with it.To stop and remove the containers, networks, and volumes created by docker compose up, run:
docker compose down