Skip to content

Commit

Permalink
chore(dev): replace plork images (#22217)
Browse files Browse the repository at this point in the history
* chore(dev): replace plork images

* add a python server that accepts POST requests

* spelling

* fix md lint

* prune docker images to free up space
  • Loading branch information
pront authored Jan 16, 2025
1 parent e27ea3a commit 8e15aeb
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -510,3 +510,4 @@ UMTS
WCDMA
XMODEM
cbor
requestline
1 change: 0 additions & 1 deletion .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@ PIDs
PII
plainify
ple
plork
podspec
Ponge
POSINT
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ jobs:
with:
submodules: "recursive"

- run: docker image prune -af ; docker container prune -f

- name: Download JSON artifact from changes.yml
uses: actions/download-artifact@v4
with:
Expand Down
49 changes: 47 additions & 2 deletions docs/tutorials/sinks/2_http_sink.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,55 @@ incoming events and the `BasicService` we created above.

We can now run our new sink.

Let's run a test HTTP server to accept the responses our sink sends:
Here is a potential `simple_http_server.py` server to accept the responses our sink sends:

```python
import http.server
import socketserver


class RequestHandler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
# Print the request line and headers
print(f"Request Line: {self.requestline}")
print("Headers:")
for header, value in self.headers.items():
print(f"{header}: {value}")

# Send a response
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write(b'GET request received')

def do_POST(self):
print(f"Request Line: {self.requestline}")
print("Headers:")
for header, value in self.headers.items():
print(f"{header}: {value}")

content_length = int(self.headers['Content-Length'])
post_data = self.rfile.read(content_length)
print(f"Body: {post_data.decode('utf-8')}")

self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write(b'POST request received')


PORT = 3000
Handler = RequestHandler

with socketserver.TCPServer(("", PORT), Handler) as httpd:
print(f"Serving HTTP on port {PORT}...")
httpd.serve_forever()
```

Run the server:

```sh
docker run -p 3000:3000 plork/httpdump
python3 simple_http_server.py
```

Our sink has a new configuration field for the endpoint. Update it to look like:
Expand Down
2 changes: 1 addition & 1 deletion scripts/integration/gcp/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
- PUBSUB_PROJECT1=testproject,topic1:subscription1
- PUBSUB_PROJECT2=sourceproject,topic2:subscription2
chronicle-emulator:
image: docker.io/plork/chronicle-emulator:${CONFIG_VERSION}
image: docker.io/timberio/chronicle-emulator:${CONFIG_VERSION}
ports:
- 3000:3000
volumes:
Expand Down

0 comments on commit 8e15aeb

Please sign in to comment.