Shoulder.dev Logo Shoulder.dev

Deployment - docker/genai-stack

The genai-stack is a collection of tools and components designed to simplify AI/ML integration, making it accessible to developers. In this guide, we will walk you through the process of deploying and installing the genai-stack using Docker. We assume you have a good understanding of Docker and its related concepts.

Prerequisites

Before we begin, ensure you have the following prerequisites installed:

  1. Docker: Install Docker on your system following the official documentation.
  2. Docker Compose: Docker Compose is included in the Docker Desktop package. If you’re using a different installation method, follow the official documentation to install it.

Installing genai-stack components

The genai-stack includes various components, such as Grafana, Loki, and the GenAI Stack itself. In this guide, we will cover the installation of Grafana and Loki using Docker.

Grafana

Grafana is an open-source platform for data visualization and monitoring. To install Grafana using Docker, follow these steps:

  1. Pull the Grafana image: Use the following command to pull the latest Grafana image from Docker Hub:
docker pull grafana/grafana
  1. Run Grafana: To start Grafana, create a docker-compose.yml file with the following content:
version: '3'
services:
grafana:
image: grafana/grafana:latest
container_name: grafana
ports:
- "3000:3000"
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
volumes:
- ./grafana-data:/var/lib/grafana

This file sets up a single service named grafana using the official Grafana image. It also maps the container’s port 3000 to the host’s port 3000 and sets up a volume for data persistence.

  1. Start Grafana: Run the following command to start the Grafana container:
docker-compose up -d

This command starts the container in detached mode.

  1. Access Grafana: Open your web browser and navigate to http://localhost:3000 to access the Grafana web interface. Use the default admin credentials (username: admin, password: admin) to log in.

Loki

Loki is an open-source, horizontally-scalable, highly-available, multi-tenant log aggregation system inspired by Prometheus. To install Loki using Docker, follow these steps:

  1. Pull the Loki image: Use the following command to pull the latest Loki image from Docker Hub:
docker pull grafana/loki:latest
  1. Run Loki: Create a docker-compose.yml file with the following content:
version: '3'
services:
loki:
image: grafana/loki:latest
container_name: loki
ports:
- "3100:3100"
volumes:
- ./loki-data:/var/lib/loki
environment:
- LOCAL_TSDB_DATA_DIR=/var/lib/loki/tsdb
- LOCAL_TSDB_RETENTION_DELETES_KEEP=7d
- LOCAL_TSDB_RETENTION_PERIOD=168h
- GF_LOG_LEVEL=info

This file sets up a single service named loki using the official Loki image. It also maps the container’s port 3100 to the host’s port 3100 and sets up a volume for data persistence.

  1. Start Loki: Run the following command to start the Loki container:
docker-compose up -d

This command starts the container in detached mode.

  1. Access Loki: Open your web browser and navigate to http://localhost:3100 to access the Loki web interface. Use the default admin credentials (username: admin, password: admin) to log in.

Conclusion

In this guide, we covered the process of deploying and installing the Grafana and Loki components of the genai-stack using Docker. With these components in place, you can begin your AI/ML integration journey. For more information on the genai-stack and its components, refer to the official documentation.