Skip to content

Commit

Permalink
infernet-1.0.0 update
Browse files Browse the repository at this point in the history
  • Loading branch information
arshan-ritual committed Jun 6, 2024
1 parent 2a11fd3 commit 40a6c59
Show file tree
Hide file tree
Showing 98 changed files with 882 additions and 509 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,10 @@ venv

# sync scripts
remote_sync

# forge generated files
**/broadcast
**/out

# secrets
*-key.json
16 changes: 11 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
url = https://github.com/foundry-rs/forge-std
[submodule "projects/hello-world/contracts/lib/infernet-sdk"]
path = projects/hello-world/contracts/lib/infernet-sdk
url = https://github.com/ritual-net/infernet-sdk
url = https://github.com/ritual-net/infernet-sdk.git
[submodule "projects/torch-iris/contracts/lib/infernet-sdk"]
path = projects/torch-iris/contracts/lib/infernet-sdk
url = https://github.com/ritual-net/infernet-sdk
url = https://github.com/ritual-net/infernet-sdk.git
[submodule "projects/torch-iris/contracts/lib/forge-std"]
path = projects/torch-iris/contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "projects/onnx-iris/contracts/lib/infernet-sdk"]
path = projects/onnx-iris/contracts/lib/infernet-sdk
url = https://github.com/ritual-net/infernet-sdk
url = https://github.com/ritual-net/infernet-sdk.git
[submodule "projects/onnx-iris/contracts/lib/forge-std"]
path = projects/onnx-iris/contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
Expand All @@ -21,13 +21,13 @@
url = https://github.com/foundry-rs/forge-std
[submodule "projects/prompt-to-nft/contracts/lib/infernet-sdk"]
path = projects/prompt-to-nft/contracts/lib/infernet-sdk
url = https://github.com/ritual-net/infernet-sdk
url = https://github.com/ritual-net/infernet-sdk.git
[submodule "projects/prompt-to-nft/contracts/lib/solmate"]
path = projects/prompt-to-nft/contracts/lib/solmate
url = https://github.com/transmissions11/solmate
[submodule "projects/gpt4/contracts/lib/infernet-sdk"]
path = projects/gpt4/contracts/lib/infernet-sdk
url = https://github.com/ritual-net/infernet-sdk
url = https://github.com/ritual-net/infernet-sdk.git
[submodule "projects/gpt4/contracts/lib/forge-std"]
path = projects/gpt4/contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
Expand All @@ -36,4 +36,10 @@
url = https://github.com/foundry-rs/forge-std
[submodule "projects/tgi-llm/contracts/lib/infernet-sdk"]
path = projects/tgi-llm/contracts/lib/infernet-sdk
url = https://github.com/ritual-net/infernet-sdk.git
[submodule "projects/payment/contracts/lib/forge-std"]
path = projects/payment/contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "projects/payment/contracts/lib/infernet-sdk"]
path = projects/payment/contracts/lib/infernet-sdk
url = https://github.com/ritual-net/infernet-sdk
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Changelog

All notable changes to this project will be documented in this file.

- ##### The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- ##### This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0] - 2024-06-06

### Added
- New project `payment` for an end-to-end flow of the payments feature of `infernet
1.0.0`.

### Changed
- All workflows are updated to use `infernet-ml 1.0.0`
- All contracts are updated to use `infernet-sdk 1.0.0`

### Fixed
- Recursive submodule cloning issue with forge's libraries.

## [0.1.0] - 2024-03-21

### Added
- Initial release of the Infernet Container Starter repository.
20 changes: 16 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
build-container:
$(MAKE) -C ./projects/$(project)/container build
include internal.mk

index_url ?= ''

build-container: get_index_url
$(MAKE) -C ./projects/$(project)/container build index_url=$(index_url)

remove-containers:
docker compose -f deploy/docker-compose.yaml down || true
Expand All @@ -8,10 +12,18 @@ remove-containers:
build-multiplatform:
$(MAKE) -C ./projects/$(project)/container build-multiplatform

deploy-container:
$(MAKE) remove-containers
deploy-container: stop-container
cp ./projects/$(project)/container/config.json deploy/config.json
docker compose -f deploy/docker-compose.yaml up -d
docker logs infernet-node -f

stop-container:
docker compose -f deploy/docker-compose.yaml kill || true
docker compose -f deploy/docker-compose.yaml rm -f || true
docker kill $(project) || true
docker rm $(project) || true

watch-logs:
docker compose -f deploy/docker-compose.yaml logs -f

deploy-contracts:
Expand Down
6 changes: 6 additions & 0 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

## Get Rid Of
- [ ] build versions in libraries
- [ ] Node version in dockerfiles
- [ ] `get_index_url`, `index_url` can stay
- [ ] change ci not to use extra index url (requires pypi release)
20 changes: 15 additions & 5 deletions deploy/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,30 @@ version: '3'

services:
node:
image: ritualnetwork/infernet-node:latest
image: ritualnetwork/infernet-node:1.0.0
ports:
- "0.0.0.0:4000:4000"
volumes:
- ./config.json:/app/config.json
- node-logs:/logs
- /var/run/docker.sock:/var/run/docker.sock
tty: true
networks:
- network
depends_on:
- redis
- infernet-anvil
restart:
on-failure
extra_hosts:
- "host.docker.internal:host-gateway"
stop_grace_period: 1m
tty: true
container_name: infernet-node

redis:
image: redis:latest
expose:
- "6379"
ports:
- "6379:6379"
networks:
- network
volumes:
Expand All @@ -46,10 +48,18 @@ services:
restart:
on-failure

infernet-anvil:
image: ritualnetwork/infernet-anvil:1.0.0
command: --host 0.0.0.0 --port 3000 --load-state infernet_deployed.json -b 1
ports:
- "8545:3000"
networks:
- network
container_name: infernet-anvil

networks:
network:


volumes:
node-logs:
redis-data:
10 changes: 10 additions & 0 deletions internal.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ifneq ("$(wildcard gcp.env)","")
include gcp.env
endif

get_index_url:
$(eval token := $(shell gcloud auth print-access-token))
$(eval index_url := "https://_token:$(token)@$(artifact_location)-python.pkg.dev/$(gcp_project)/$(artifact_repo)/simple")

generate-uv-env-file: get_index_url
@echo "`echo $(export_prefix)`UV_EXTRA_INDEX_URL=$(index_url)" > uv.env
5 changes: 4 additions & 1 deletion projects/gpt4/container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ ENV PYTHONDONTWRITEBYTECODE 1
ENV PIP_NO_CACHE_DIR 1
ENV RUNTIME docker
ENV PYTHONPATH src
ARG index_url
ENV UV_EXTRA_INDEX_URL ${index_url}

RUN apt-get update
RUN apt-get install -y git curl

# install uv
ADD --chmod=755 https://astral.sh/uv/install.sh /install.sh
ADD https://astral.sh/uv/install.sh /install.sh
RUN chmod 755 /install.sh
RUN /install.sh && rm /install.sh

COPY src/requirements.txt .
Expand Down
3 changes: 1 addition & 2 deletions projects/gpt4/container/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ TAG := $(DOCKER_ORG)/example-$(EXAMPLE_NAME)-infernet:latest
.phony: build run build-multiplatform try-prompt

build:
mkdir -p root-config
@docker build -t $(TAG) .
@docker build -t $(TAG) --build-arg index_url=$(index_url) .

run: build
@docker run --env-file $(EXAMPLE_NAME).env -p 3000:3000 $(TAG)
Expand Down
2 changes: 1 addition & 1 deletion projects/gpt4/container/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ make run
## Test the Container
```bash
curl -X POST localhost:3000/service_output -H "Content-Type: application/json" \
-d '{"source": 1, "data": {"text": "can shrimps actually fry rice?"}}'
-d '{"source": 1, "data": {"prompt": "can shrimps actually fry rice?"}}'
```
22 changes: 8 additions & 14 deletions projects/gpt4/container/config.sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"enabled": true,
"trail_head_blocks": 0,
"rpc_url": "http://host.docker.internal:8545",
"coordinator_address": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
"registry_address": "0x663F3ad617193148711d28f5334eE4Ed07016602",
"wallet": {
"max_gas_limit": 4000000,
"private_key": "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
Expand All @@ -23,6 +23,10 @@
"port": 6379
},
"forward_stats": true,
"snapshot_sync": {
"sleep": 3,
"batch_size": 100
},
"containers": [
{
"id": "gpt4",
Expand All @@ -34,19 +38,9 @@
"allowed_ips": [],
"command": "--bind=0.0.0.0:3000 --workers=2",
"env": {
"OPENAI_API_KEY": "barabeem baraboom"
}
},
{
"id": "anvil-node",
"image": "ritualnetwork/infernet-anvil:0.0.0",
"external": true,
"port": "8545",
"allowed_delegate_addresses": [],
"allowed_addresses": [],
"allowed_ips": [],
"command": "",
"env": {}
"OPENAI_API_KEY": "your-key"
},
"accepted_payments": {}
}
]
}
Loading

0 comments on commit 40a6c59

Please sign in to comment.