Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
92a5b9f
Add adapter base
abnegate Jan 9, 2026
a5005ac
Performance tweaks
abnegate Jan 13, 2026
722c4c7
Add coroutine server + benchmarks
abnegate Jan 15, 2026
aaa8df0
Add CI workflows and update config
abnegate Jan 16, 2026
19a370c
Replace Service classes with Resolver pattern
abnegate Jan 16, 2026
86ca764
Update adapters and servers to use Resolver
abnegate Jan 16, 2026
d883ab7
Update proxies, examples, and benchmarks for Resolver
abnegate Jan 16, 2026
b52f618
Update tests and add MockResolver
abnegate Jan 16, 2026
2856ece
Update docs
abnegate Jan 22, 2026
36e9663
Fix composer
abnegate Jan 23, 2026
caa4cd9
Remove platform
abnegate Jan 23, 2026
eebb9c9
Remove redundant dep
abnegate Jan 27, 2026
334ad72
Fix trailing comma in composer.json
abnegate Jan 29, 2026
06a084b
Merge pull request #1 from utopia-php/fix/composer-json-syntax
abnegate Jan 29, 2026
9176c3d
Merge remote-tracking branch 'origin/main' into dev
abnegate Jan 30, 2026
e9ba926
perf: optimize TCP proxy for lower latency and higher throughput
abnegate Jan 30, 2026
2abc68d
feat: add Linux performance tuning script for benchmarks
abnegate Jan 30, 2026
c1f6893
feat: add production-safe Linux tuning script
abnegate Jan 30, 2026
324274c
feat: add one-shot droplet benchmark bootstrap script
abnegate Jan 30, 2026
47aa0db
feat: add bootstrap test script for debugging
abnegate Jan 30, 2026
90dd36e
fix: bootstrap script PHP/Swoole installation
abnegate Jan 30, 2026
bf6553b
docs: add Docker quick-test option to bootstrap script
abnegate Jan 30, 2026
e5104c6
feat: add sustained load test benchmark
abnegate Jan 30, 2026
4d91d7d
feat: increase benchmark targets to 1M burst, 100k sustained
abnegate Jan 30, 2026
e202f99
Fix bench bootstraps
abnegate Jan 30, 2026
8611a94
Update bench scripts
abnegate Jan 30, 2026
dcd9e15
Update docs
abnegate Jan 30, 2026
f7257b8
Update docs
abnegate Jan 30, 2026
0723e59
Fix composer
abnegate Mar 9, 2026
d0e5d8e
Merge remote-tracking branch 'origin/main' into dev
abnegate Mar 9, 2026
e20ebae
(refactor): Use PHP 8.4 property hooks, readonly class, and optimise …
abnegate Mar 9, 2026
2ff9a33
(refactor): Add PHPStan type annotations to HTTP and SMTP servers
abnegate Mar 9, 2026
2eb0137
(refactor): Replace config array with named parameters in TCP server
abnegate Mar 9, 2026
953f5fc
(chore): Update PHPStan memory limit and remove unused import
abnegate Mar 9, 2026
ed5a9be
Abstract config
abnegate Mar 9, 2026
3c66bb6
Remove dep
abnegate Mar 10, 2026
2d46040
(feat): Add TLS and TlsContext classes for TCP proxy TLS termination
abnegate Mar 12, 2026
771243b
(feat): Add QueryParser and ReadWriteResolver for read/write split ro…
abnegate Mar 12, 2026
2fac054
(feat): Integrate TLS termination, read/write split, MongoDB support,…
abnegate Mar 12, 2026
fe7b9fc
(test): Add tests for QueryParser, read/write split, integration, and…
abnegate Mar 12, 2026
40150e1
(refactor): Collapse adapter hierarchy, add Protocol enum, rename Res…
abnegate Mar 12, 2026
6bad65c
(refactor): Extract query parser to utopia-php/query dependency
abnegate Mar 12, 2026
1d91e37
(test): Update tests for adapter refactor and query parser extraction
abnegate Mar 12, 2026
4b81d8d
(style): Convert test method names from snake_case to camelCase
abnegate Mar 12, 2026
e2c66a7
(chore): Update Dockerfile and remove unused files
abnegate Mar 12, 2026
27d1e9e
(docs): Update README to match current codebase
abnegate Mar 12, 2026
5d9b048
fix: resolve CI failures for composer, lint, and unit test workflows
abnegate Mar 12, 2026
c13ca9e
fix: use correct query package branch and resolve PHPStan errors
abnegate Mar 12, 2026
48c8f49
fix: relax parse performance threshold for CI runners
abnegate Mar 12, 2026
18d464f
(chore): Remove orphaned docblock, profanity in comments, and section…
abnegate Mar 12, 2026
3305edd
(test): Add 217 unit tests for TLS, Config, byte tracking, endpoint v…
abnegate Mar 12, 2026
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
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.git
.gitignore
.idea
vendor
*.md
.dockerignore
Dockerfile
docker-compose.yml
24 changes: 24 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Database Configuration
DB_HOST=mariadb
DB_PORT=3306
DB_USER=appwrite
DB_PASS=password
DB_NAME=appwrite

# Redis Configuration
REDIS_HOST=redis
REDIS_PORT=6379

# Compute API Configuration
COMPUTE_API_URL=http://appwrite-api/v1/compute
COMPUTE_API_KEY=

# MySQL Root Password (for docker-compose)
MYSQL_ROOT_PASSWORD=rootpassword

# TLS Configuration (for TCP proxy)
PROXY_TLS_ENABLED=false
PROXY_TLS_CERT=
PROXY_TLS_KEY=
PROXY_TLS_CA=
PROXY_TLS_REQUIRE_CLIENT_CERT=false
29 changes: 29 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Integration Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
integration:
name: Integration Tests
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: swoole, redis, sockets
tools: composer:v2

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run integration tests
run: composer test:integration
29 changes: 29 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Lint

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
pint:
name: Laravel Pint
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: swoole, redis
tools: composer:v2

- name: Install dependencies
run: composer install --no-interaction --prefer-dist

- name: Run Pint
run: composer lint
29 changes: 29 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Static Analysis

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: swoole, redis
tools: composer:v2

- name: Install dependencies
run: composer install --no-interaction --prefer-dist

- name: Run PHPStan
run: composer check
24 changes: 24 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
unit:
name: Unit Tests
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build test image
run: |
docker build -t protocol-proxy-test --target test -f Dockerfile.test .

- name: Run tests
run: |
docker run --rm protocol-proxy-test composer test
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
/vendor/
/composer.lock
/.phpunit.cache
/.phpunit.result.cache
/.php-cs-fixer.cache
/phpstan.neon
/.idea/
.DS_Store
*.log
/coverage/

# Environment files
.env

# Docker volumes
/docker-volumes/
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM php:8.4.18-cli-alpine3.23

RUN apk update && apk upgrade && apk add --no-cache \
autoconf \
g++ \
make \
linux-headers \
libstdc++ \
brotli-dev \
libzip-dev \
openssl-dev \
&& rm -rf /var/cache/apk/*

RUN docker-php-ext-install \
pcntl \
sockets \
zip

RUN pecl channel-update pecl.php.net

RUN pecl install swoole && \
docker-php-ext-enable swoole

RUN pecl install redis && \
docker-php-ext-enable redis

WORKDIR /app

COPY composer.json ./
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
RUN composer install \
--no-dev \
--optimize-autoloader \
--ignore-platform-reqs
Comment on lines +31 to +34
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

git ls-files | grep -i dockerfile | head -20

Repository: utopia-php/protocol-proxy

Length of output: 79


🏁 Script executed:

cat -n Dockerfile | head -50

Repository: utopia-php/protocol-proxy

Length of output: 1089


🏁 Script executed:

cat composer.json

Repository: utopia-php/protocol-proxy

Length of output: 1895


Remove --ignore-platform-reqs to validate required extensions.

The Dockerfile installs ext-swoole and ext-redis before running Composer, and composer.json explicitly requires both extensions. Using --ignore-platform-reqs suppresses Composer's platform validation, masking installation failures and deferring errors to runtime. Remove the flag to ensure Composer verifies that the required extensions are actually available.

Proposed change
 RUN composer install \
     --no-dev \
-    --optimize-autoloader \
-    --ignore-platform-reqs
+    --optimize-autoloader
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
RUN composer install \
--no-dev \
--optimize-autoloader \
--ignore-platform-reqs
RUN composer install \
--no-dev \
--optimize-autoloader
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Dockerfile` around lines 31 - 34, Remove the --ignore-platform-reqs flag from
the Composer install command in the Dockerfile so Composer validates required
PHP extensions (ext-swoole, ext-redis) at build time; update the RUN composer
install invocation (the existing "RUN composer install \ --no-dev \
--optimize-autoloader \ --ignore-platform-reqs" command) to omit
--ignore-platform-reqs and ensure the image installs/ENABLED the ext-swoole and
ext-redis extensions before running that Composer step so platform checks
succeed.


COPY . .

EXPOSE 8080 8081 8025

CMD ["php", "proxies/http.php"]
Comment on lines +36 to +40
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Drop root before starting the proxy.

This container still runs as root at runtime. The proxy only binds to unprivileged ports, so it should run as a dedicated user instead of keeping full container privileges.

Proposed change
+RUN addgroup -S app && adduser -S -G app app
+
-COPY . .
+COPY --chown=app:app . .
+RUN chown -R app:app /app
 
 EXPOSE 8080 8081 8025
 
+USER app
 CMD ["php", "proxies/http.php"]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Dockerfile` around lines 36 - 40, The container currently runs as root at
runtime; create and switch to a non-root user in the Dockerfile, ensure
application files are owned by that user, and switch to that user before the CMD
that launches the proxy (referencing the EXPOSE lines and CMD ["php",
"proxies/http.php"]). Specifically: add a non-root user/group (e.g., create user
"app" or "proxy"), chown the application directory and any runtime directories
to that user, and add a USER instruction prior to the CMD so the proxy runs as
the dedicated user instead of root; no capability changes are needed because the
proxy binds only to unprivileged ports (8080, 8081, 8025).

33 changes: 33 additions & 0 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM php:8.4-cli-alpine AS test

RUN apk add --no-cache \
autoconf \
g++ \
make \
linux-headers \
libstdc++ \
brotli-dev \
libzip-dev \
openssl-dev

RUN docker-php-ext-install \
pcntl \
sockets \
zip

RUN pecl channel-update pecl.php.net && \
pecl install swoole && \
docker-php-ext-enable swoole

RUN pecl install redis && \
docker-php-ext-enable redis

WORKDIR /app

COPY composer.json ./
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
RUN composer install \
--optimize-autoloader \
--ignore-platform-reqs

COPY . .
Loading
Loading