Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/eliza/feb 10 #37

Open
wants to merge 201 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
201 commits
Select commit Hold shift + click to select a range
558aa60
start of new version
Dec 12, 2024
2138b04
now creating
Dec 12, 2024
2badf08
machine image
Dec 12, 2024
51a0906
update
Dec 12, 2024
fdac521
now running
Dec 13, 2024
5ed453c
using ami
Dec 13, 2024
f29b5df
bugfix egress
Dec 13, 2024
f381197
adding updates and proposed changes
Dec 13, 2024
5c7e3a2
work in progress
Dec 13, 2024
7f1fd3a
starting
Dec 13, 2024
b9a7e36
moving towards asg support
Dec 14, 2024
d8898a4
now trying again with medium
Dec 14, 2024
7e7f8f9
many sizes
Dec 14, 2024
7f40ba1
now creating more sizes
Dec 14, 2024
107ae6a
removing too small
Dec 14, 2024
68c39a9
alb
Dec 16, 2024
790bb6b
create tg
Dec 16, 2024
8c10213
create tg
Dec 16, 2024
bb62580
applied
Dec 16, 2024
f9d0d56
group coming online
Dec 16, 2024
a135fe8
plan
Dec 16, 2024
b561619
wip
Dec 16, 2024
7e4cf29
update
Dec 16, 2024
1cf2295
health check
Dec 16, 2024
c6fd42c
update
Dec 16, 2024
049c6ef
start of swarms deploy
Dec 16, 2024
05ed0bd
start of swarms
Dec 16, 2024
248221c
now applying
Dec 17, 2024
1063aed
now applying
Dec 17, 2024
06f9a86
adding readme
Dec 17, 2024
790758e
starting cognito
Dec 17, 2024
e671f30
apply
Dec 17, 2024
3cd307a
appplied
Dec 17, 2024
e64a39a
google
Dec 17, 2024
e43831e
Delete accounts/swarms/.terraform.lock.hcl
jmikedupont2 Dec 17, 2024
ea2a611
more scopes
Dec 17, 2024
0e86ce3
adding ses
Dec 17, 2024
a2bff67
starting on ses verification
Dec 17, 2024
464cc1c
insecure listener and updated instructions
Dec 18, 2024
334207b
building ami
Dec 18, 2024
79ec0b3
now larger drive
Dec 18, 2024
ada7442
new ami asg
Dec 18, 2024
2e59cc2
loading
Dec 18, 2024
c38d394
new installer
Dec 18, 2024
45f8b38
update
Dec 18, 2024
13621be
remove the slow asg
Dec 18, 2024
06a8b41
simple autoscale policy
Dec 19, 2024
eedf499
swarmdeploy
Dec 19, 2024
cac4c79
now just hacking this for now
Dec 19, 2024
554f901
bugfix: use the install in the root dir
Dec 19, 2024
f708fad
proof of godaddy working
Dec 19, 2024
b6f8961
secrets loading
Dec 19, 2024
e8aa000
version 1
Dec 19, 2024
aa37da0
fix the yaml
Dec 19, 2024
cc6d1e8
call swarms
Dec 19, 2024
57d111e
notes from todays meeting
Dec 19, 2024
3011848
Update README.md
jmikedupont2 Dec 19, 2024
b9cd606
Update README.md
jmikedupont2 Dec 19, 2024
112773e
test
Dec 19, 2024
c512375
first version of call swarms calling
Dec 19, 2024
69de293
update job version
Dec 19, 2024
3c4a68b
starting on a new autoscaling group
Dec 19, 2024
ea44b5f
customer test
Dec 19, 2024
eca5690
working it seems
Dec 19, 2024
db93c71
now adding a call swarms.sh
Dec 20, 2024
749092d
update
Dec 20, 2024
dcf219e
fixing bug
Dec 20, 2024
b6b8460
removing test code
Dec 20, 2024
d482d1c
deploy
Dec 20, 2024
832898b
start of the observability
Dec 21, 2024
76dea16
applied
Dec 21, 2024
08e85bd
allow decrypt
Dec 21, 2024
06b9a22
wip
Dec 21, 2024
3c23717
work in progress
Dec 21, 2024
dd2b6fd
call swarms
Dec 21, 2024
c849407
gitignore
Dec 21, 2024
45427cd
fixing more perms
Dec 21, 2024
fcbecca
wip
Dec 22, 2024
d0b08da
report
Dec 22, 2024
1cb80d1
adding branch name
Dec 22, 2024
151c3e8
now fixing the logging config
Dec 22, 2024
aee8856
swap
Dec 22, 2024
41a652d
update the code to fetch then checkout
Dec 22, 2024
f1da299
pdev
Dec 22, 2024
c930829
pdev
Dec 22, 2024
9dd1a41
pdev
Dec 22, 2024
cb9a924
adding main
Dec 22, 2024
f4326f3
starting with docker
Dec 23, 2024
3899d69
update readme
Dec 23, 2024
4342004
normalizing the names
Dec 23, 2024
42a947f
adding status
Dec 23, 2024
b2c2099
top level module
Dec 24, 2024
198627d
tofu apply -target module.call_swarms.aws_ssm_document.deploy-docker
Dec 24, 2024
4c8eba2
example logs
Dec 24, 2024
0761940
creating readme
Dec 24, 2024
b96bfdd
creating readme
Dec 24, 2024
9fa1b3a
fix fmt
Dec 24, 2024
8138b4a
now its pulling
Dec 24, 2024
02bbed9
resize
Dec 25, 2024
f71554b
max price 0.0275
Dec 25, 2024
81564cb
fmt
Dec 25, 2024
66dda6e
adding spot
Dec 25, 2024
ecb23ac
Delete environments/swarms-aws-agent-api/dev/us-east-1/Readme.md~
jmikedupont2 Dec 26, 2024
ddb49a5
moving traffic source attachments
Dec 26, 2024
0357e1b
fixing size
Dec 26, 2024
45768a5
increase size
Dec 26, 2024
cc23a5a
removing spot for now
Dec 26, 2024
00452be
fixing branch to be constant in user data
Dec 27, 2024
a045f4b
creating cname
Dec 27, 2024
aee30ad
creating new mcs subcomponent
Dec 27, 2024
3de651f
tofu fmt
Dec 27, 2024
41ef75c
fixing path name
Dec 27, 2024
a792f31
fixing branch
Dec 28, 2024
038b0b7
changing health check path https://github.com/The-Swarm-Corporation/M…
Dec 28, 2024
73bb419
parser now producing better results
Dec 28, 2024
6b959d0
report
Dec 28, 2024
679e81e
now generating new code
Dec 29, 2024
9784e4f
generated first version
Dec 29, 2024
4ab9ced
adding in documentation
Dec 31, 2024
1ff4b4e
getlogs
Dec 31, 2024
67998a8
creating mcs dev
Dec 31, 2024
bcc9ee1
adding mcs dev
Dec 31, 2024
e12be67
update
Dec 31, 2024
eb322e3
Merge branch 'feature/ses' into feature/mcs
Jan 9, 2025
d4b64fb
applied
Jan 9, 2025
edce93d
step one create ssm infra
Jan 9, 2025
faf3eb5
adding eliza
Jan 9, 2025
0982e88
applied
Jan 9, 2025
723bfad
fixing name of log file
Jan 9, 2025
d4a3eaa
work in progress starting to boot
Jan 10, 2025
27ee585
applied
Jan 10, 2025
97d36b0
new sizes
Jan 10, 2025
c9a23d4
renaming
Jan 12, 2025
8db2f0f
wip
Jan 12, 2025
50ed993
adding in bogus azs
Jan 12, 2025
03d3b0d
adding owners
Jan 13, 2025
cc47c09
removing my key
Jan 13, 2025
2fef929
update readme
Jan 13, 2025
f09fb87
comment out kms id
Jan 13, 2025
8b46a9a
keypairs
Jan 13, 2025
a0f7676
fixing
Jan 13, 2025
c5be841
move to branch
Jan 14, 2025
4eb3ee8
allow github to create repositories
Jan 14, 2025
a62af86
wip
Jan 14, 2025
ecd5950
adding more detailed instructions
Jan 14, 2025
316a26e
adding ai notes back in
Jan 14, 2025
88ef79a
tofu
Jan 14, 2025
83c5524
Merge branch 'feature/aitokenteam' into feature/codebuild
Jan 14, 2025
24b2c90
adding codebuild
Jan 14, 2025
7c751db
notes
Jan 15, 2025
164c02d
bugfix
Jan 15, 2025
02933b3
v1 of solfnum meme infra plan
Jan 20, 2025
9c707b9
plan with one click
Jan 20, 2025
1de1e7f
parking for jump
Jan 20, 2025
44bb255
adding cloudformation
Jan 21, 2025
25403a9
adding another part of the puzzle
Jan 21, 2025
a2f2c1f
more cf files
Jan 21, 2025
8e8071e
update
Jan 21, 2025
66e00d4
now applied with terraform
Jan 21, 2025
6b012ca
lagging changes
Jan 21, 2025
db8077a
update readme
Jan 26, 2025
92398e9
refactor
Jan 26, 2025
730e400
fixed deps
Jan 26, 2025
9d793a1
why are there any changes
jmikedupont2 Jan 26, 2025
3624163
adding new cloudformer output
Jan 30, 2025
2bbdb41
now applying v1
Jan 30, 2025
4214b61
moving user data to inline
Jan 30, 2025
478a6f4
applied
Jan 30, 2025
ff45030
now improving
Jan 30, 2025
bb9239f
updated version
Jan 30, 2025
0819ab6
Merge remote-tracking branch 'origin/feature/windoze' into feature/cl…
jmikedupont2 Jan 31, 2025
0b119bf
adding new resources
Jan 31, 2025
91e5ca5
apply complete
Jan 31, 2025
e56cc66
moving to new branch for debugging
Jan 31, 2025
36f5af8
working now
Jan 31, 2025
376bd49
kms
Feb 1, 2025
9c6584f
adding parameters for the lt
Feb 1, 2025
8425fff
still grinding
Feb 1, 2025
259709b
example
Feb 1, 2025
e5fc939
adding installer stack link
Feb 1, 2025
83fb971
bugfix
Feb 1, 2025
f958615
regions
Feb 2, 2025
4fe6855
readme
Feb 2, 2025
abcb182
update names
Feb 2, 2025
18861da
adding sensitive values
Feb 2, 2025
f391604
format
Feb 2, 2025
8d66d9a
update variable name
Feb 2, 2025
6080eb3
Now should be better
Feb 2, 2025
e4afd9e
bugfix in url
Feb 2, 2025
415273f
lets try again
Feb 2, 2025
07d5439
fix
Feb 3, 2025
a235cf7
patch one
Feb 3, 2025
6182ab6
applied and created new regions
Feb 3, 2025
4147c71
all reachable regions
Feb 3, 2025
250a0bb
bugfix tokenizer image
Feb 3, 2025
76e86e9
fmt
Feb 5, 2025
3f43a39
patching
Feb 5, 2025
729e171
format
Feb 5, 2025
43cca6b
removed noecho
Feb 5, 2025
40b3fac
adding new feb files
Feb 12, 2025
8e05553
new isnstaller
Feb 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/call-swarms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
workflow_dispatch:
push:
branches:
- "feature/docker"
# pull_request:
# branches:
# - "main"
# paths:
# - ".github/workflows/call-swarms.yaml"

name: CallSwarms
jobs:
caller-identity:
name: Return the IAM user
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github
- uses: actions/checkout@v2
- run: bash -x -e ./actions/call_swarms.sh
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,5 @@ flycheck_*.el
# network security
/network-security.data

/logs/logs/
.aider*
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
find -name \*.tf -exec grep -r provider {} \; -print
250 changes: 249 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,265 @@
# cloudformation files

here are files from terraform in clouformation, needs to be cleaned up.

Idea:
results of cloudformation created from terraformed results.
use terraform to deploy
capture as cloudformation
parameterize
create one click deploy of cloudformation.

# one click installer plan

Using cloudformation
https://github.com/meta-introspector/cfn-tf-meta-introspector/issues/1 still need someone to try this

we want a step by step instructions to setup your aws
and then they click on this
https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=tfcfn-custom-type-resources&templateURL=https://s3.amazonaws.com/ianmckay-us-east-1/cfn-tf-custom-types/template.yml

and then we port our repo https://github.com/meta-introspector/ai-agent-terraform/tree/feature/aitokenteam into running inside of cloudformation

TODO : Great asset
transform our terraform resources into cloudformation yaml to use tf provider
we could deploy azure or gcp from aws in terraform.

For the mean time, we will deploy terraform.

Another alternative is
https://runatlantis.io/

# solfun meme branch of ai-agent terraform

This will deploy the :
1. solfunmeme dao agent to work for the solfunmeme dao
1.1. (eliza)

2. solfunmeme web server(done)
2.1 to vercel
2.1.1. (done, manually not terraformed)
2.2 to aws (TBD)
https://codeberg.org/introspector/SOLFUNMEME/issues/25

stakeholders will login via the phantom wallet compatible web app with wallet and be able to vote on important decisions :

3. terraform to admin discord :
who is admin in
telegram
discord

what versions of what bots with what permissions do we have in telegram
what software projects are important to work on
what marketing and listing should we persue
etc.
This will be the core of the dao, I will use this as my oracle for every day decisions and try and act in the best interest of the team and hope all of us will.

We are going to build something amazing, I have tons of work ready, many ideas ready to launch when we have this running.

3. the dns records to namecheap.
3.1 done manually
3.2 add terraform

4. cognito with web3 Integration
https://codeberg.org/introspector/SOLFUNMEME/issues/5

## agent spec :

What the agent will do

resolve tickets :
in codeberg and
in github and
later in gitlab, jira

but talk in:
discord,
telegram,
twitter it should

the agent will update the main web page as well.
we will deploy the main page to terraform as well.

LANGUAGE API:
Deploy open lite llm server, connect to multiple backends.

# terraform-template

```
git clone https://github.com/aitokenteam/ai-agent-terraform.git
cd ai-agent-terraform/accounts/AI_Token_Team/
git checkout feature/aitokenteam

terraform init

aws ecr create-repository --repository-name agent/eliza
aws ecr create-repository --repository-name nodemodules/sql-lite-vec

aws ssm put-parameter --name "agent_openai_key" --value "${OPENAI_API_KEY}" --type String

terraform apply --target module.ssm_observer.aws_ssm_parameter.cw_agent_config --target module.ssm_observer.aws_ssm_parameter.cw_agent_config_details
terraform apply
```

Terraform project template for deploying infrastructure across multiple environments and regions, following best practices with modular structure and automated syntax checks (GitHub Actions)

## Installation

1. setup aws account
2. create user with administrator privledges for terraform/tofu

Directly attach Policy name `AdministratorAccess` to user
replace <USERNAME> in the following url
`https://us-east-1.console.aws.amazon.com/iam/home?region=us-east-2#/users/details/<USERNAME>?section=permissions`

create access key
https://us-east-1.console.aws.amazon.com/iam/home?region=us-east-2#/users/details/mdupont/create-access-key

~/.aws/credentials

aws cli install
https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html

`aws configure`

opentofu install
https://opentofu.org/docs/intro/install/

Go to ami catalog in your region:
https://us-west-1.console.aws.amazon.com/ec2/home?region=us-west-1#AMICatalog:

Search for "ubuntu-noble-24.04-amd64-minimal" in the third tab "aws marketplace amis"

Accept license.

## Status report

Currently we are building out a dev infrastructure using our existing code
and adding in a docker target, this has the advantage that we can build and test
the docker outside of aws and then deploy it easily.

## Repo structure

```
terraform-template/ # Root directory of the Terraform template repository
├── README.md # Project documentation and overview
├── environments
├── accounts
│ ├── swarms # the main swarms account
├── environments
│ ├── swarms-aws-agent-api
│ │ ├── dev # Development environment configuration for the demo-azure-vm setup
│ │ │ └── us-east-1
├── modules # Directory containing reusable Terraform modules
│ ├── swarms
```

to ss to the server
`aws ssm start-session --target i-0e156165e86473c93 --profile mdupont --region us-east-2`

to install secret
`aws ssm put-parameter --name "agent_openai_key" --value "${OPENAI_API_KEY}" --type String`

If you get this error:
```
│ Error: reading SSM Parameter (arn:aws:ssm:us-east-1:AKIA4SYAMCQ5MMLC6NU3:parameter/cloudwatch-agent/config/details): operation error SSM: GetParameter, https response error StatusCode: 400, RequestID: 159177cb-91f0-4c2e-a354-07cdc2e64041, api error ValidationException: Invalid Account Id in: arn:aws:ssm:us-east-1:AKIA4SYAMCQ5MMLC6NU3:parameter/cloudwatch-agent/config/details
│ with module.eliza_server.module.eliza.module.lt_docker["t3a.small"].data.aws_ssm_parameter.cw_agent_config,
│ on ../../environments/eliza-agent-api/components/launch_template_docker_mcs/main.tf line 77, in data "aws_ssm_parameter" "cw_agent_config":
│ 77: data "aws_ssm_parameter" "cw_agent_config" {
```
we need to apply this first:
`tofu apply --target module.ssm_observer.aws_ssm_parameter.cw_agent_config --target module.ssm_observer.aws_ssm_parameter.cw_agent_config_details`

check the ECR images
`aws ecr list-images --region us-east-2 --repository-name swarms/mcs`

To login from docker to ecr
`docker login -u AWS -p $(aws ecr get-login-password --region us-east-2) 767503528736.dkr.ecr.us-east-2.amazonaws.com' 767503528736.dkr.ecr.us-east-2.amazonaws.com/agent/eliza:latest`

# setup
we dont use terraform for the ecr or the secrets because they will change so often here are the simple aws scripts for them.

`aws ecr create-repository --repository-name agent/eliza`

`set_secrets.sh` calls
`aws ssm put-parameter --name "agent_openai_key" --value "${OPENAI_API_KEY}" --type String`

## connecting with server
`ssh-ssm.py` to find the server

for example:
`aws ssm start-session --target i-0e156165e86473c93 --profile mdupont --region us-east-2`

## terraform-aws-oidc-github
https://github.com/jmikedupont2/terraform-aws-oidc-github

in my time 2024/12/18/terraform-aws-oidc-github on branch
run the tofu apply in the example after editing the variables and files.

# debug
`pnpm start:debug --characters=./characters/eliza.character.json`
start direct client here

# set the az
#~/terraform/accounts/AI_Token_Team/main.tf
edit
aws_availability_zones = ["us-west-1a","us-west-1b","us-west-1c"]

if you ge the errror:
00000003]
module.ssm_setup.module.ssm.aws_s3_bucket_lifecycle_configuration.access_log_bucket: Creation complete after 32s [id=ai-token-team-session-access-logs-20250113203757298300000002]
│ Error: creating EC2 Subnet: operation error EC2: CreateSubnet, https response error StatusCode: 400, RequestID: 05eeaa25-0855-4d71-8945-04b0d6233520, api error InvalidParameterValue: Value (us-west-1b) for parameter availabilityZone is invalid. Subnets can currently only be created in the following availability zones: us-east-1a, us-east-1b, us-east-1c, us-east-1d, us-east-1e, us-east-1f.
│ with module.eliza_server.module.vpc.module.vpc.aws_subnet.public[1],
│ on .terraform/modules/eliza_server.vpc.vpc/main.tf line 98, in resource "aws_subnet" "public":
│ 98: resource "aws_subnet" "public" {


nter a value: yes

# key pair
module.eliza_server.module.eliza.module.asg["t3a.small"].module.autoscaling.aws_autoscaling_group.this[0]: Creating...
│ Error: creating Auto Scaling Group (docker-agent-ami-t3a.small-20250113205357496400000001): operation error Auto Scaling: CreateAutoScalingGroup, https response error StatusCode: 400, RequestID: 380d0f57-bf60-40fd-ace6-d86563107c85, api error ValidationError: You must use a valid fully-formed launch template. The key pair does not exist
│ with module.eliza_server.module.eliza.module.asg["t3a.small"].module.autoscaling.aws_autoscaling_group.this[0],
│ on .terraform/modules/eliza_server.eliza.asg.autoscaling/main.tf line 347, in resource "aws_autoscaling_group" "this":
│ 347: resource "aws_autoscaling_group" "this" {
edit
~/terraform/environments/eliza-agent-api/components/keypairs/main.tf

resource "aws_key_pair" "deployer" {
key_name = "ai-token-deployer-key"
public_key = "<insert your personal cat ~/.ssh/id_pub.rsa"
}

# connect via ssm

switch to su
`sudo su -`

`cd /opt/agent `
`git pull `
`git fetch --all`
`docker ps`
`cat /var/log/cloud-init-output`
`cat /var/log/agent-docker`
`cat /etc/systemd/system/agent-docker.service`
`bash /opt/agent/rundocker.sh`
`aws sts get-caller-identity`

instance/ security/ security group,
click on security group
edit inbound rules,
add new rule, do not edit existing.
custom tcp, port 3000, source (my ip),blank
use my eliza starter
https://github.com/meta-introspector/eliza-starter

docker inspect agent-docker.service
docker logs agent-docker.service
lsof -iTCP:3000

"TINE-IntrospectorIsNotEliza"
60 changes: 60 additions & 0 deletions accounts/AI_Token_Team/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
provider "aws" {
region = "us-west-1"
#profile = "ai-token-team"
profile = "default"
}

locals {
dns = "aitokenteam.com" # fixme
region = "us-west-1"
project = "ai-token-team" # dont change
}

module "ssm_observer" {
source = "../../modules/aws/ssm/observability"
ami_id = data.aws_ami.ami.id
}

module "ssm_setup" {
source = "../../modules/aws/ssm/setup"
bucket_name = "${local.project}-session-logs"
access_log_bucket_name = "${local.project}-ssm-access-logs"
project = local.project
}

locals {
ami_name = "ubuntu-minimal/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-minimal-*"
}
data "aws_ami" "ami" { # slow
most_recent = true
owners = ["679593333241"]
name_regex = "^${local.ami_name}"
}

module "eliza_server" {
#count = 0
#aws_account_id = local.account
aws_account_id = var.aws_account_id
region = local.region
source = "../../environments/eliza-agent-api/" # FIXME rename
domain = local.dns
ami_id = data.aws_ami.ami.id
name = local.project
project = local.project
key_name = "ai-token-deployer-key"
tags = { project = local.project }

branch = "feature/AI_Token_Team"
spot_max_price = 0.028
instance_types = [
"t3a.small",
# "t3.small",
# "t2.small",
# "t3.medium" # works for sure

]
repo = "https://github.com/meta-introspector/cloud-deployment-eliza/"
aws_availability_zones = ["us-west-1a",
#"us-west-1b",
"us-west-1c"]
}
Loading