Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .rbtrc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dev run --python

# Set the application name for commands that require it.
cloud up --name=chat-room
cloud down --name=chat-room
cloud down --name=chat-room --expunge
dev expunge --name=chat-room
dev run --name=chat-room
serve run --name=chat-room
Expand Down
63 changes: 54 additions & 9 deletions .tests/serve_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,26 @@ stop_container() {
}

perform_curl() {
local url="localhost:8787/chat_room.v1.ChatRoomMethods/Messages"
local headers=(
"-H" "x-reboot-state-ref:chat_room.v1.ChatRoom:reboot-chat-room"
local state_id="$1"
local method="$2"
local actual_output_file="$3"
local data="$4"
local url="localhost:8787/chat_room.v1.ChatRoomMethods/${method}"
local curl_args=(
-v -s
-o "$actual_output_file"
-w "%{http_code}"
-XPOST
-H "x-reboot-state-ref:chat_room.v1.ChatRoom:${state_id}"
)
local actual_output_file="$1"

# Discard the 'curl' exit code, since we want to continue even if the request fails.
http_status=$(curl -v -s -o "$actual_output_file" -w "%{http_code}" -XPOST $url "${headers[@]}" || true)
if [ -n "$data" ]; then
curl_args+=(-H "Content-Type: application/json" -d "$data")
fi

# Discard the 'curl' exit code, since we want to
# continue even if the request fails.
http_status=$(curl "${curl_args[@]}" $url || true)

# Print the output of 'curl' to aid in debugging.
cat "$actual_output_file"
Expand Down Expand Up @@ -98,9 +110,10 @@ if command -v docker &> /dev/null; then

actual_output_file=$(mktemp)

# Try to reach the backend.
# Try to reach the backend using the known state ID to
# wait for the server to be ready.
retries=0
while ! perform_curl "$actual_output_file"; do
while ! perform_curl "reboot-chat-room" "Messages" "$actual_output_file"; do
if [ "$retries" -ge 30 ]; then
# This is taking an unusually long time. Print the Docker logs to aid in
# debugging.
Expand All @@ -113,12 +126,44 @@ if command -v docker &> /dev/null; then
retries=$((retries+1))
done

# Check the output.
# Check the output of the known state ID.
if ! diff -u "${SANDBOX_ROOT}$EXPECTED_CURL_OUTPUT_FILE" "$actual_output_file"; then
echo "The actual output does not match the expected output."
exit 1
fi

# At this point we know the server is up and can respond to requests.
# Now we want to test that all servers in the cluster are reachable,
# by sending requests to 30 different random state IDs so that
# the load balancer distributes them across all servers.
# If all requests succeed, all servers should be reachable.
for i in $(seq 1 30); do
state_id=$(cat /proc/sys/kernel/random/uuid)
# First, send a message to construct the state.
if ! perform_curl "$state_id" "Send" "$actual_output_file" '{"message":"test"}'; then
echo "Send request to state ID '$state_id' failed."
echo "###### Docker logs ######"
docker logs $container_id
echo "###### End Docker logs ######"
exit 1
fi
# Then, read the messages back and verify the content.
if ! perform_curl "$state_id" "Messages" "$actual_output_file"; then
echo "Messages request to state ID '$state_id' failed."
echo "###### Docker logs ######"
docker logs $container_id
echo "###### End Docker logs ######"
exit 1
fi
# Verify the response contains the message we sent.
# Collapse whitespace since the JSON response is pretty-printed.
if ! tr -d ' \n' < "$actual_output_file" | grep -q '"messages":\["test"\]'; then
echo "Expected '\"messages\":[\"test\"]' in response for state ID '$state_id', got:"
cat "$actual_output_file"
exit 1
fi
done

rm "$actual_output_file"
popd
else
Expand Down
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This `BUILD.bazel` file allows a `bazel` system (configured outside of this
# repository) to use code in this directory and its subdirectories.

load("@com_github_reboot_dev_mono//reboot/examples:rules.bzl", "write_templated_source_file")
load("//reboot/examples:rules.bzl", "write_templated_source_file")

filegroup(
name = "everything",
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/reboot-dev/reboot-base:0.44.0
FROM ghcr.io/reboot-dev/reboot-base:0.45.2

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Once you've received an invitation to use Reboot Cloud, you will also receive an
API key. You can then run this application on Reboot Cloud as follows:

```console
rbt cloud up --api-key=YOUR_API_KEY
rbt cloud up --api-key=YOUR_API_KEY --organization=YOUR_ORG_NAME
```

To make calls to the application that just started, find the application's URL
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[project]
requires-python = ">= 3.10"
dependencies = [
"reboot==0.44.0",
"reboot==0.45.2",
]

[tool.rye]
dev-dependencies = [
"mypy==1.18.1",
"pytest>=7.4.2",
"types-protobuf>=4.24.0.20240129",
"reboot==0.44.0",
"reboot==0.45.2",
]

# This project only uses `rye` to provide `python` and its dependencies, so
Expand Down
29 changes: 13 additions & 16 deletions reboot-non-react-web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion reboot-non-react-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"dependencies": {
"@bufbuild/protobuf": "1.10.1",
"@reboot-dev/reboot-web": "^0.44.0",
"@reboot-dev/reboot-web": "^0.45.2",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
Expand Down
61 changes: 54 additions & 7 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,22 @@ aiosignal==1.4.0
annotated-types==0.7.0
# via pydantic
anyio==4.9.0
# via httpx
# via mcp
# via reboot
# via sse-starlette
# via starlette
async-timeout==4.0.3
# via aiohttp
attrs==24.2.0
# via aiohttp
# via jsonschema
# via referencing
bitarray==3.8.0
# via reboot
certifi==2024.8.30
# via httpcore
# via httpx
# via kubernetes-asyncio
cffi==1.17.1
# via cryptography
Expand All @@ -36,6 +44,7 @@ click==8.1.8
colorama==0.4.6
# via reboot
cryptography==44.0.0
# via pyjwt
# via reboot
deprecated==1.2.15
# via opentelemetry-api
Expand Down Expand Up @@ -72,15 +81,23 @@ grpcio-status==1.64.3
grpcio-tools==1.64.3
# via reboot
h11==0.14.0
# via httpcore
# via uvicorn
h2==4.3.0
# via reboot
hpack==4.1.0
# via h2
httpcore==1.0.8
# via httpx
httpx==0.28.1
# via mcp
httpx-sse==0.4.3
# via mcp
hyperframe==6.1.0
# via h2
idna==3.10
# via anyio
# via httpx
# via yarl
importlib-metadata==8.5.0
# via opentelemetry-api
Expand All @@ -91,10 +108,16 @@ jinja2==3.1.2
# via reboot
jinja2-strcase==0.0.2
# via reboot
jsonschema==4.26.0
# via mcp
jsonschema-specifications==2025.9.1
# via jsonschema
kubernetes-asyncio==31.1.0
# via reboot
markupsafe==2.1.5
# via jinja2
mcp==1.26.0
# via reboot
multidict==6.1.0
# via aiohttp
# via yarl
Expand Down Expand Up @@ -153,51 +176,74 @@ psutil==6.0.0
# via reboot
pycparser==2.22
# via cffi
pydantic==2.9.2
pydantic==2.12.5
# via fastapi
# via mcp
# via pydantic-settings
# via reboot
pydantic-core==2.23.4
pydantic-core==2.41.5
# via pydantic
pydantic-settings==2.13.1
# via mcp
pyjwt==2.10.1
# via mcp
# via reboot
pyprctl==0.1.3
# via reboot
pytest==8.3.3
python-dateutil==2.9.0.post0
# via kubernetes-asyncio
python-dotenv==1.2.2
# via pydantic-settings
python-multipart==0.0.22
# via mcp
pyyaml==6.0.2
# via kubernetes-asyncio
# via reboot
reboot==0.44.0
reboot==0.45.2
referencing==0.37.0
# via jsonschema
# via jsonschema-specifications
rpds-py==0.30.0
# via jsonschema
# via referencing
setuptools==75.1.0
# via grpcio-tools
six==1.16.0
# via kubernetes-asyncio
# via python-dateutil
sniffio==1.3.1
# via anyio
sortedcontainers==2.4.0
# via reboot
sse-starlette==3.0.3
# via mcp
starlette==0.46.2
# via fastapi
# via mcp
# via reboot
tabulate==0.9.0
# via reboot
tomli==2.0.1
# via mypy
# via pytest
types-protobuf==5.28.0.20240924
# via mypy-protobuf
typing-extensions==4.9.0
typing-extensions==4.15.0
# via aiosignal
# via anyio
# via fastapi
# via mcp
# via multidict
# via mypy
# via opentelemetry-sdk
# via pydantic
# via pydantic-core
# via reboot
# via referencing
# via typing-inspection
# via uvicorn
typing-inspection==0.4.2
# via mcp
# via pydantic
# via pydantic-settings
tzlocal==5.3
# via reboot
urllib3==1.26.15
Expand All @@ -206,6 +252,7 @@ urllib3==1.26.15
uuid7-standard==1.1.0
# via reboot
uvicorn==0.34.0
# via mcp
# via reboot
watchdog==6.0.0
# via reboot
Expand Down
Loading