Skip to content

Commit

Permalink
update 3 files and create 1 file
Browse files Browse the repository at this point in the history
  • Loading branch information
frank chen committed Jan 26, 2024
1 parent a9794d1 commit 21e43bb
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 2 deletions.
29 changes: 29 additions & 0 deletions blog/cheatsheet-traefik-docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,35 @@ bar12345:
- traefik.http.services.bar12345.loadbalancer.server.port=12345
```

## Specify more than one router and service per container

In this example, requests are forwarded for `http://127.0.0.1/web2ports-a` to `http://<private IP of container>:8001` in addition to `http://127.0.0.1/web2ports-b` forwarding to `http://<private IP of container>:8002`:

```yml
web2ports:
image: python:3.10
ports:
- 8001:8001
- 8002:8002
working_dir: /app
volumes:
- ./server_whoami.py:/app/server_whoami.py
command: >
sh -c "python3 server_whoami.py --port 8001
& python3 server_whoami.py --port 8002"
labels:
- traefik.enable=true
# Specify more than one router and service per container
- traefik.http.routers.a-router.entrypoints=web
- traefik.http.routers.a-router.rule=PathPrefix(`/web2ports-a`)
- traefik.http.routers.a-router.service=a-service
- traefik.http.services.a-service.loadbalancer.server.port=8001
- traefik.http.routers.b-router.entrypoints=web
- traefik.http.routers.b-router.rule=PathPrefix(`/web2ports-b`)
- traefik.http.routers.b-router.service=b-service
- traefik.http.services.b-service.loadbalancer.server.port=8002
```
## Resources
Expand Down
42 changes: 42 additions & 0 deletions blog/wiki-socket.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
authors:
- frank
tags:
- Wiki Socket
description: Wiki Socket
keywords:
- Wiki Socket
image: https://i.imgur.com/mErPwqL.png
date: 2024-01-26
draft: false
enableComments: true # for Gisqus
---

# Wiki Socket


Terms of sockets in socket programming,

- On the server side:
- The socket responsible for listening and accepting incoming connections is commonly referred to as the "**server socket**".
- The individual sockets created for each accepted connection, responsible for data exchange with the connected clients, are often referred to as "**client socket**" (or simply "**socket**").
- On the client side:
- The socket responsible for initiating a connection to the server and handling data exchange is commonly referred to as the "**client socket**" or "**socket**"

In summary:
- Server Side:
- Listening Socket: "**Server Socket**"
- Data Exchange Sockets (for each connection): "**Client Socket**" or just "**Socket**"
- Client Side:
- Data Exchange Socket: "**Client Socket**" or just "**Socket**"


<!--truncate-->

## Resources

[Transports and Protocols Python 3.12.1 documentation](https://docs.python.org/3/library/asyncio-protocol.html)

[selectors High-level I/O multiplexing Python 3.12.1 documentation](https://docs.python.org/3/library/selectors.html)

[socket Low-level networking interface Python 3.12.1 documentation](https://docs.python.org/3/library/socket.html)
2 changes: 1 addition & 1 deletion code-snippets/docker-compose
2 changes: 1 addition & 1 deletion code-snippets/python
Submodule python updated 2 files
+16 −29 server.py
+70 −37 server_whoami.py

0 comments on commit 21e43bb

Please sign in to comment.