Search

infrastructureblogia

Update: LibreChat version v0.7.6 with automated deployment on AWS EC2

Update: LibreChat version v0.7.6 with automated deployment on AWS EC2

I’m happy to announce that my automated deployment project for LibreChat on AWS EC2 has been updated to fix issues related to recent changes in the way LibreChat is installed, and now supports version v0.7.6. This update also includes the ability to choose between On-Demand and Spot instances, as well as improvements to simplify usage, even for beginners.

What’s new in this update?

Support for LibreChat version v0.7.6

The project clones the LibreChat tag v0.7.6 directly, ensuring that all deployments use a validated and tested version. This avoids surprises from unexpected changes in the upstream repository.

Updated code in the User-Data script:

# Clone le dépôt LibreChat avec uniquement le tag v0.7.6
git clone --branch v0.7.6 --depth 1 https://github.com/danny-avila/LibreChat.git
cd LibreChat/

On-Demand and Spot instance management

I added a Terraform variable spot_enabled that allows dynamically choosing whether the deployment uses Spot or On-Demand instances. By default, On-Demand mode is enabled to provide a more accessible experience for beginners, avoiding the need to configure spot prices. This ensures the project is immediately functional for everyone.

Updated excerpt from ec2.tf:

# Bloc dynamique pour conditionner les options du marché Spot
dynamic "instance_market_options" {
  for_each = var.spot_enabled ? [1] : [] # Si spot_enabled est true, le bloc est créé
  content {
    market_type = "spot"
    spot_options {
      max_price                      = var.spot_max_price[var.instance_type]
      instance_interruption_behavior = var.spot_request_type == "persistent" ? "stop" : null
      spot_instance_type             = var.spot_request_type
    }
  }
}

Excerpt from variables.tf:

variable "spot_enabled" {
  description = "Active ou désactive l'utilisation du marché Spot"
  type        = bool
  default     = false
}

Terraform version update

The Terraform version used in the project has been updated from 1.5.7 to 1.10.3. This ensures compatibility with the latest Terraform features and improvements.

# Version de l'image Docker Terraform
TERRAFORM_VERSION: hashicorp/terraform:1.10.3

Fixes for Mistral model configuration

The Mistral configuration in librechat.yaml has been updated to support format changes in the latest version. The API key is still retrieved from AWS Systems Manager (SSM), as with the other models, and the default models now include mistral-large-latest.

Updated code:

# Remplace la ligne contenant apiKey: '${MISTRAL_API_KEY}' par la clé réelle dans librechat.yaml
sed -i "s|apiKey: '\${MISTRAL_API_KEY}'|apiKey: '${MISTRAL_API_KEY}'|" librechat.yaml

# Modèles par défaut pour Mistral
sed -i '/- name:.*Mistral/,/default:/ s|default:.*|default: [\'mistral-tiny\', \'mistral-small\', \'mistral-medium\', \'mistral-large-latest\']|' librechat.yaml

Added multilingual README files

To make the project accessible to a wider range of users worldwide, I used my AI-powered Markdown file translation script, powered by the GPT-4o model, to generate README files in multiple languages. Supported languages include English, German, Spanish, Japanese, Korean, and Chinese.

Files added:

  • README-de-gpt-4o.md
  • README-en-gpt-4o.md
  • README-es-gpt-4o.md
  • README-ja-gpt-4o.md
  • README-ko-gpt-4o.md
  • README-zh-gpt-4o.md

Nginx configuration update

The default Nginx configuration for SSL was deprecated in this release. I fixed this by adjusting the directives and adding support for SSL certificates with sed commands to ensure compatibility.

Updated code:

# Monter les certificats SSL dans le fichier deploy-compose.yml
sed -i '/- .\/client\/nginx.conf:\/etc\/nginx\/conf.d\/default.conf/a \      - \/etc\/nginx\/ssl:\/etc\/nginx\/ssl' deploy-compose.yml

# Corrige les directives dans nginx.conf pour la version récente de Nginx
sed -i '/listen 443 ssl;/!s/listen 443 ssl;/listen 443 ssl http2;/' client/nginx.conf
sed -i '/listen \[::\]:443 ssl;/!s/listen \[::\]:443 ssl;/listen [::]:443 ssl http2;/' client/nginx.conf

# Corriger les erreurs de commentaire sur les URLs
sed -i 's|https://docs.nginx.com/nginx/admin-guide/web-server/compression/|# https://docs.nginx.com/nginx/admin-guide/web-server/compression/|' client/nginx.conf
sed -i 's|https://docs.nginx.com/nginx/admin-guide/web-server/compression/|# &|' client/nginx.conf

Terraform improvements

  • Changed the default instance type from t3a.micro to t3a.small for better performance.
  • Updated spot prices in variables.tf to reflect current costs.

Updated excerpt from variables.tf:

variable "spot_max_price" {
  default = {
    "t3a.large"  = "0.0376"
    "t3a.small"  = "0.0095"
    "t3a.medium" = "0.01940"
    "t3a.micro"  = "0.006"
  }
}

Why this update is important

By pinning the LibreChat version, fixing issues related to Nginx and Mistral configurations, and offering the option to choose between On-Demand and Spot instances, this update strengthens the project’s reliability and flexibility. With On-Demand mode as the default, even beginners can deploy LibreChat without complex prerequisites.

Summary

  • Support for LibreChat version v0.7.6: Cloning the correct tag to avoid issues caused by uncontrolled changes.
  • Instance management: Choice between On-Demand and Spot, with On-Demand as default to simplify the user experience.
  • Terraform version: Updated to version 1.10.3 to take advantage of the latest improvements.
  • Mistral AI: Automatic management of API keys and models, adapted to the new format.
  • Multilingual README files: Documentation available in multiple languages.
  • Nginx: SSL configuration fixed and adapted to the new directives.
  • Terraform: Adjustments for improved performance and accurate costs.

Check out the full project

You can view and use this project on the GitLab repository.

Feel free to share your feedback or contribute to the project!

This document was translated from the fr version into the en language using the gpt-5-mini model. For more information on the translation process, see https://gitlab.com/jls42/ai-powered-markdown-translator