Quickstart
Install Docker Compose
Do not use
docker-compose
Always use
docker compose
instead ofdocker-compose
to avoid docker related issues.
LatticeFlow is deployed using docker compose
. To check if Docker Compose is installed, run the following command on your machine:
docker compose version
How to install Docker Compose?
If you do not have docker compose
installed yet, please follow the instructions below or the official docker documentation:
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
# Install the latest version
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Manage Docker as a non-root user
# https://docs.docker.com/engine/install/linux-postinstall/
# Create the docker group.
sudo groupadd docker
# Add your user to the docker group.
sudo usermod -aG docker $USER
# Activate the changes to groups or log out/log in
newgrp docker
sudo yum install -y docker
# Start the Docker service.
sudo service docker start
# Manage Docker as a non-root user
# https://docs.docker.com/engine/install/linux-postinstall/
sudo usermod -a -G docker $USER
# Install docker compose plugin
DOCKER_CONFIG=/usr/local/lib/docker
sudo mkdir -p $DOCKER_CONFIG/cli-plugins
sudo curl -SL "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o $DOCKER_CONFIG/cli-plugins/docker-compose
sudo chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
# Activate the changes to groups or log out/log in
newgrp docker
# Please follow the instructions at:
# https://docs.latticeflow.io/page/latticeflow-web-installation-on-windows
Step 1: Login to Docker Registry
LatticeFlow Web is a containerized application. To gain access to LatticeFlow Docker images, login into the LatticeFlow Docker registry.
To login, use your the Docker credentials in the command below and run it.
docker login registry.gitlab.com -u <username> -p <password>
Step 2: Configure Deployment
The LatticeFlow Web deployment is configured using environment variables.
Create an .env
file, copy the contents below into it, and adjust the environment variables to your needs.
Web Versions
LF_ASSESSMENT_VERSION
defines the version of LatticeFlow Web to be deployed.
LF_ASSESSMENT_VERSION="0.10.0"
# Environment for which LatticeFlow is deployed
ENV="prod"
LF_DEPLOYMENT_NAME="prod"
# (Optional) Various secrets
OPENAI_API_KEY=""
OPENAI_ORG=""
TOGETHER_API_KEY=""
GEMINI_API_KEY=""
# (Optional) Adjust the port on which the LatticeFlow will be available.
LF_ASSESSMENT_PORT="5005"
LF_ASSESSMENT_JUPYTER_PORT="8888"
Step 3: Deploy LatticeFlow Web
Warning
The default LatticeFlow deployment comes without SSL encryption. Please run it in a trusted environment or adapt it to add SSL encryption following your company's best practices.
In the directory with the .env
file create a new file named docker-compose.yaml
and paste the contents of the docker compose template:
Docker Compose Template Contents
name: assessment
services:
latticeflow-assessment-redis:
restart: unless-stopped
image: redis:7.2.5
command: redis-server --save ""
volumes:
- lf-data-redis:/data
networks:
- internal
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 1s
timeout: 3s
retries: 5
labels:
- ai.latticeflow.product=ai-assessments
latticeflow-assessment-db:
restart: unless-stopped
image: postgres:15.2
shm_size: 1024mb
networks:
- internal
volumes:
- lf-persistence:/var/lib/postgresql/data
environment:
- POSTGRES_DB=${LF_DB_NAME:-assessment}
- POSTGRES_USER=${LF_DB_USER:-latticeflow}
- POSTGRES_PASSWORD=${LF_DB_PASSWORD:-Uplifted8}
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -d ${LF_DB_NAME:-assessment} -U ${LF_DB_USER:-latticeflow}",
]
interval: 30s
timeout: 60s
retries: 5
start_period: 80s
labels:
- ai.latticeflow.product=ai-assessments
latticeflow-assessment-app:
user: "assessment:assessment"
security_opt:
- no-new-privileges:true
restart: unless-stopped
image: registry.gitlab.com/latticeflow/cloud/cloud/latticeflow-assessment:${LF_ASSESSMENT_VERSION:?error}
working_dir: /app/latticeflow-assessment
entrypoint: "lf_start_assessment"
ports:
- "${LF_ASSESSMENT_PORT:-5005}:5005"
volumes:
- lf-data-reports:/app/latticeflow-assessment/lf_data/data/reports
- lf-data-logs:/app/latticeflow-assessment/lf_data/data/logs
environment:
- POSTGRES_DB=${LF_DB_NAME:-assessment}
- POSTGRES_USER=${LF_DB_USER:-latticeflow}
- POSTGRES_PASSWORD=${LF_DB_PASSWORD:-Uplifted8}
- POSTGRES_HOST=latticeflow-assessment-db
- LF_JOB_QUEUE_BROKER=redis://latticeflow-assessment-redis:6379
- LF_LOAD_USER_PROVIDED_PLUGINS=${LF_LOAD_USER_PROVIDED_PLUGINS:-False}
- OPENAI_API_KEY=${OPENAI_API_KEY}
- OPENAI_ORG=${OPENAI_ORG}
- TOGETHER_API_KEY=${TOGETHER_API_KEY}
- GEMINI_API_KEY=${GEMINI_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- NOVITA_API_KEY=${NOVITA_API_KEY}
networks:
- external
- internal
depends_on:
- latticeflow-assessment-redis
- latticeflow-assessment-db
labels:
- ai.latticeflow.product=ai-assessments
latticeflow-assessment-jupyter:
user: "assessment:assessment"
security_opt:
- no-new-privileges:true
restart: unless-stopped
image: registry.gitlab.com/latticeflow/cloud/cloud/latticeflow-assessment:${LF_ASSESSMENT_VERSION:?error}
working_dir: /app/latticeflow-assessment
entrypoint: "python -m jupyter notebook --ip 0.0.0.0 --port 8888"
ports:
- "${LF_ASSESSMENT_JUPYTER_PORT:-8888}:8888"
volumes:
- lf-data-reports:/app/latticeflow-assessment/lf_data/data/reports
environment:
- POSTGRES_DB=${LF_DB_NAME:-assessment}
- POSTGRES_USER=${LF_DB_USER:-latticeflow}
- POSTGRES_PASSWORD=${LF_DB_PASSWORD:-Uplifted8}
- POSTGRES_HOST=latticeflow-assessment-db
- LF_JOB_QUEUE_BROKER=redis://latticeflow-assessment-redis:6379
- LF_LOAD_USER_PROVIDED_PLUGINS=${LF_LOAD_USER_PROVIDED_PLUGINS:-False}
- OPENAI_API_KEY=${OPENAI_API_KEY}
- OPENAI_ORG=${OPENAI_ORG}
- TOGETHER_API_KEY=${TOGETHER_API_KEY}
- GEMINI_API_KEY=${GEMINI_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- NOVITA_API_KEY=${NOVITA_API_KEY}
networks:
- external
- internal
depends_on:
- latticeflow-assessment-app
- latticeflow-assessment-redis
- latticeflow-assessment-db
labels:
- ai.latticeflow.product=ai-assessments
latticeflow-assessment-workers:
user: "assessment:assessment"
security_opt:
- no-new-privileges:true
restart: "no"
image: registry.gitlab.com/latticeflow/cloud/cloud/latticeflow-assessment:${LF_ASSESSMENT_VERSION:?error}
working_dir: /app/latticeflow-assessment
entrypoint: "lf_start_workers"
command:
- "--disable_error_monitoring"
- "--disable_analytics"
environment:
- POSTGRES_DB=${LF_DB_NAME:-assessment}
- POSTGRES_USER=${LF_DB_USER:-latticeflow}
- POSTGRES_PASSWORD=${LF_DB_PASSWORD:-Uplifted8}
- POSTGRES_HOST=latticeflow-assessment-db
- LF_JOB_QUEUE_BROKER=redis://latticeflow-assessment-redis:6379
- LF_LOAD_USER_PROVIDED_PLUGINS=${LF_LOAD_USER_PROVIDED_PLUGINS:-False}
- OPENAI_API_KEY=${OPENAI_API_KEY}
- OPENAI_ORG=${OPENAI_ORG}
- TOGETHER_API_KEY=${TOGETHER_API_KEY}
- GEMINI_API_KEY=${GEMINI_API_KEY}
- HF_TOKEN=${HF_TOKEN}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- NOVITA_API_KEY=${NOVITA_API_KEY}
volumes:
- lf-data-reports:/app/latticeflow-assessment/lf_data/data/reports
- lf-data-logs:/app/latticeflow-assessment/lf_data/data/logs
networks:
- internal
- external
depends_on:
- latticeflow-assessment-app
- latticeflow-assessment-db
- latticeflow-assessment-redis
labels:
- ai.latticeflow.product=ai-assessments
latticeflow-assessment-logrotate:
image: blacklabelops/logrotate
restart: unless-stopped
volumes:
- lf-data-logs:/app/latticeflow-assessment/lf_data/data/logs
environment:
- LOGS_DIRECTORIES=/app/latticeflow-assessment/lf_data/data/logs
- LOGROTATE_SIZE=10M
- LOGROTATE_COPIES=3
networks:
external:
driver: bridge
internal:
driver: bridge
internal: true
volumes:
lf-data-redis:
driver: local
lf-persistence:
driver: local
lf-data-reports:
driver: local
lf-data-logs:
driver: local
In the directory with the .env
file, run the following commands to fetch LatticeFlow Web Docker images and deploy LatticeFlow Web.
source .env # If using `/bin/sh` shell, then use: . $PWD/.env
docker compose up --detach
If everything started successfully, you should see an output similar to the one below.
[+] Running 11/11
✔ Network external Created 0.1s
✔ Network internal Created 0.1s
✔ Volume "lf-data-redis" Created 0.0s
✔ Volume "lf-persistence" Created 0.0s
✔ Volume "lf-data-data" Created 0.0s
✔ Volume "lf-data-reports" Created 0.0s
✔ Container latticeflow-assessment-redis-1 Healthy 22.6s
✔ Container latticeflow-assessment-db-1 Healthy 22.6s
✔ Container latticeflow-assessment-app-1 Healthy 51.2s
✔ Container latticeflow-assessment-jupyter-1 Started 6.2s
✔ Container latticeflow-assessment-workers-1 Started 52.0s
Step 4: Setup LatticeFlow Web
After successfully starting the deployment, LatticeFlow Web should be accessible at [http://localhost:5005
].If a different port than 5005 was picked in Step 2, adapt the URL.
Updated 8 days ago