Skip to content

Commit

Permalink
Merge branch 'main' into ci/add-docker-codeowner
Browse files Browse the repository at this point in the history
  • Loading branch information
tanertopal authored Sep 6, 2024
2 parents 2ecd20d + a0b4b06 commit 451e240
Show file tree
Hide file tree
Showing 4 changed files with 204 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/docker/distributed/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
superexec-certificates
superlink-certificates
server/state
6 changes: 6 additions & 0 deletions src/docker/distributed/certs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
gen-certs:
build:
args:
SUPERLINK_IP: ${SUPERLINK_IP:-127.0.0.1}
SUPEREXEC_IP: ${SUPEREXEC_IP:-127.0.0.1}
128 changes: 128 additions & 0 deletions src/docker/distributed/client/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
services:
supernode-1:
image: flwr/supernode:${FLWR_VERSION:-1.11.0}
command:
- --superlink
- ${SUPERLINK_IP:-127.0.0.1}:9092
- --supernode-address
- 0.0.0.0:9094
- --isolation
- process
- --node-config
- "partition-id=0 num-partitions=2"
- --root-certificates
- certificates/ca.crt
secrets:
- source: superlink-ca-certfile
target: /app/certificates/ca.crt

supernode-2:
image: flwr/supernode:${FLWR_VERSION:-1.11.0}
command:
- --superlink
- ${SUPERLINK_IP:-127.0.0.1}:9092
- --supernode-address
- 0.0.0.0:9095
- --isolation
- process
- --node-config
- "partition-id=1 num-partitions=2"
- --root-certificates
- certificates/ca.crt
secrets:
- source: superlink-ca-certfile
target: /app/certificates/ca.crt

# uncomment to add another SuperNode
#
# supernode-3:
# image: flwr/supernode:${FLWR_VERSION:-1.11.0}
# command:
# - --superlink
# - ${SUPERLINK_IP:-127.0.0.1}:9092
# - --supernode-address
# - 0.0.0.0:9096
# - --isolation
# - process
# - --node-config
# - "partition-id=1 num-partitions=2"
# - --root-certificates
# - certificates/ca.crt
# secrets:
# - source: superlink-ca-certfile
# target: /app/certificates/ca.crt

clientapp-1:
build:
context: ${PROJECT_DIR:-.}
dockerfile_inline: |
FROM flwr/clientapp:${FLWR_VERSION:-1.11.0}
WORKDIR /app
COPY --chown=app:app pyproject.toml .
RUN sed -i 's/.*flwr\[simulation\].*//' pyproject.toml \
&& python -m pip install -U --no-cache-dir .
ENTRYPOINT ["flwr-clientapp"]
command:
- --supernode
- supernode-1:9094
deploy:
resources:
limits:
cpus: "2"
stop_signal: SIGINT
depends_on:
- supernode-1

clientapp-2:
build:
context: ${PROJECT_DIR:-.}
dockerfile_inline: |
FROM flwr/clientapp:${FLWR_VERSION:-1.11.0}
WORKDIR /app
COPY --chown=app:app pyproject.toml .
RUN sed -i 's/.*flwr\[simulation\].*//' pyproject.toml \
&& python -m pip install -U --no-cache-dir .
ENTRYPOINT ["flwr-clientapp"]
command:
- --supernode
- supernode-2:9095
deploy:
resources:
limits:
cpus: "2"
stop_signal: SIGINT
depends_on:
- supernode-2

# uncomment to add another ClientApp
#
# clientapp-3:
# build:
# context: ${PROJECT_DIR:-.}
# dockerfile_inline: |
# FROM flwr/clientapp:${FLWR_VERSION:-1.11.0}

# WORKDIR /app
# COPY --chown=app:app pyproject.toml .
# RUN sed -i 's/.*flwr\[simulation\].*//' pyproject.toml \
# && python -m pip install -U --no-cache-dir .

# ENTRYPOINT ["flwr-clientapp"]
# command:
# - --supernode
# - supernode-3:9096
# deploy:
# resources:
# limits:
# cpus: "2"
# stop_signal: SIGINT
# depends_on:
# - supernode-3

secrets:
superlink-ca-certfile:
file: ../superlink-certificates/ca.crt
67 changes: 67 additions & 0 deletions src/docker/distributed/server/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
services:
superlink:
image: flwr/superlink:${FLWR_VERSION:-1.11.0}
command:
- --ssl-ca-certfile=certificates/ca.crt
- --ssl-certfile=certificates/server.pem
- --ssl-keyfile=certificates/server.key
- --database=state/state.db
volumes:
- ./state/:/app/state/:rw
secrets:
- source: superlink-ca-certfile
target: /app/certificates/ca.crt
- source: superlink-certfile
target: /app/certificates/server.pem
- source: superlink-keyfile
target: /app/certificates/server.key
ports:
- 9092:9092

superexec:
build:
context: ${PROJECT_DIR:-.}
dockerfile_inline: |
FROM flwr/superexec:${FLWR_VERSION:-1.11.0}
WORKDIR /app
COPY --chown=app:app pyproject.toml .
RUN sed -i 's/.*flwr\[simulation\].*//' pyproject.toml \
&& python -m pip install -U --no-cache-dir .
ENTRYPOINT ["flower-superexec"]
command:
- --executor
- flwr.superexec.deployment:executor
- --executor-config
- superlink="superlink:9091" root-certificates="certificates/superlink-ca.crt"
- --ssl-ca-certfile=certificates/ca.crt
- --ssl-certfile=certificates/server.pem
- --ssl-keyfile=certificates/server.key
secrets:
- source: superlink-ca-certfile
target: /app/certificates/superlink-ca.crt
- source: superexec-ca-certfile
target: /app/certificates/ca.crt
- source: superexec-certfile
target: /app/certificates/server.pem
- source: superexec-keyfile
target: /app/certificates/server.key
ports:
- 9093:9093
depends_on:
- superlink

secrets:
superlink-ca-certfile:
file: ../superlink-certificates/ca.crt
superlink-certfile:
file: ../superlink-certificates/server.pem
superlink-keyfile:
file: ../superlink-certificates/server.key
superexec-ca-certfile:
file: ../superexec-certificates/ca.crt
superexec-certfile:
file: ../superexec-certificates/server.pem
superexec-keyfile:
file: ../superexec-certificates/server.key

0 comments on commit 451e240

Please sign in to comment.