Skip to content

Commit

Permalink
modify tf files
Browse files Browse the repository at this point in the history
  • Loading branch information
david1542 committed Jul 25, 2024
1 parent 15a1ffd commit fd9f660
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/deployments/aws-terraform/merlinn.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ resource "aws_ebs_volume" "merlinn-volume" {
tags = local.tags

lifecycle {
prevent_destroy = true
prevent_destroy = false
}
}

Expand Down
30 changes: 29 additions & 1 deletion examples/deployments/aws-terraform/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,25 @@

# Note: This is run as root

echo "Starting startup script..."

echo "CD to home directory"
cd ~

export slack_bot_token="${slack_bot_token}"
export slack_app_token="${slack_app_token}"
export slack_signing_secret="${slack_signing_secret}"
export openai_token="${openai_token}"

replace_env_value() {
local filename=$1
local var_name=$2
local new_value=$3

# Use sed to replace the value of the variable
sed -i "s|${var_name}=\"[^\"]*\"|${var_name}=\"${new_value}\"|g" "$filename"
}

apt-get update -y
apt-get install -y ca-certificates curl gnupg lsb-release
mkdir -m 0755 -p /etc/apt/keyrings
Expand All @@ -18,4 +35,15 @@ apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin do
usermod -aG docker ubuntu
git clone https://github.com/merlinn-co/merlinn.git && cd merlinn

docker compose up -d --build
cp config/litellm/.env.example config/litellm/.env
cp config/litellm/config.example.yaml config/litellm/config.yaml
replace_env_value config/litellm/.env OPENAI_API_KEY $openai_token

cp .env.example .env
replace_env_value .env SLACK_BOT_TOKEN $slack_bot_token
replace_env_value .env SLACK_APP_TOKEN $slack_app_token
replace_env_value .env SLACK_SIGNING_SECRET $slack_signing_secret

docker compose up -d --build

echo "Done!"
7 changes: 6 additions & 1 deletion examples/deployments/aws-terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ data "template_file" "user_data" {
variable "region" {
description = "AWS Region"
type = string
default = "us-west-1"
default = "us-east-1"
}

variable "instance_type" {
Expand Down Expand Up @@ -98,4 +98,9 @@ variable "slack_app_token" {
variable "slack_signing_secret" {
description = "Slack Signing Secret"
type = string
}

variable "openai_token" {
description = "OpenAI token"
type = string
}

0 comments on commit fd9f660

Please sign in to comment.