Skip to content

Commit 99a955c

Browse files
committed
make using docker for satgen possible
1 parent 85d73a1 commit 99a955c

9 files changed

+126
-164
lines changed

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ PROJECT_NAME := "celestial"
2727
PKG := "github.com/OpenFogStack/$(PROJECT_NAME)"
2828
GO_FILES := $(shell find . -name '*.go' | grep -v _test.go)
2929

30-
.PHONY: build proto ebpf celestial-make rootfsbuilder
30+
.PHONY: build proto ebpf celestial-make satgen-docker rootfsbuilder
3131

3232
build: celestial.bin
3333

@@ -47,5 +47,8 @@ celestial.bin: go.mod go.sum celestial.go ${GO_FILES} ## build go binary
4747
celestial-make: compile.Dockerfile ## build the compile container
4848
@docker build --platform ${OS}/${ARCH} -f $< -t $@ .
4949

50+
satgen-docker: satgen.Dockerfile satgen.py requirements.txt celestial/*.py ## build the satgen container
51+
@docker build -f $< -t $@ .
52+
5053
rootfsbuilder: builder/build-script.sh builder/Dockerfile builder/fcinit.c builder/inittab builder/interfaces builder/run-user-script builder/prepare.sh builder/ceinit ## build the rootfs builder container
5154
@docker build --platform=linux/amd64 -t $@:latest builder/

TODO.md

-14
This file was deleted.

docs/setup.md

+17
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ source .venv/bin/activate
101101
python3 -m pip install -r requirements.txt
102102
```
103103

104+
Alternatively, you can also run this with Docker.
105+
Build the `satgen-docker` image:
106+
107+
```sh
108+
make satgen-docker
109+
```
110+
104111
#### Running Satellite Trajectory Generation
105112

106113
We can then use the `satgen.py` script to generate trajectories:
@@ -112,6 +119,16 @@ python3 satgen.py [PATH_TO_CONFIG] [OUTPUT_PATH]
112119
Replace `PATH_TO_CONFIG` with the path to your configuration file and the
113120
optional `OUTPUT_PATH` with a path to your output file.
114121

122+
If you want to use the Docker image instead:
123+
124+
```sh
125+
docker run --rm \
126+
-v ${pwd}:/app \
127+
satgen-docker \
128+
/app/[PATH_TO_CONFIG] \
129+
/app/[OUTPUT_PATH] \
130+
```
131+
115132
After a few seconds to minutes (depending on the size of the constellation
116133
you want to emulate) you will end up with a `.zip` file that you can use for
117134
further emulation.

proto/celestial/celestial.pb.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/celestial/celestial_grpc.pb.go

+32-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/celestial/celestial_pb2.py

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/celestial/celestial_pb2_grpc.pyi

+39-11
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,19 @@ import abc
2121
import celestial_pb2
2222
import collections.abc
2323
import grpc
24+
import grpc.aio
25+
import typing
26+
27+
_T = typing.TypeVar('_T')
28+
29+
class _MaybeAsyncIterator(collections.abc.AsyncIterator[_T], collections.abc.Iterator[_T], metaclass=abc.ABCMeta):
30+
...
31+
32+
class _ServicerContext(grpc.ServicerContext, grpc.aio.ServicerContext): # type: ignore
33+
...
2434

2535
class CelestialStub:
26-
def __init__(self, channel: grpc.Channel) -> None: ...
36+
def __init__(self, channel: typing.Union[grpc.Channel, grpc.aio.Channel]) -> None: ...
2737
Register: grpc.UnaryUnaryMultiCallable[
2838
celestial_pb2.RegisterRequest,
2939
celestial_pb2.RegisterResponse,
@@ -41,30 +51,48 @@ class CelestialStub:
4151
celestial_pb2.Empty,
4252
]
4353

54+
class CelestialAsyncStub:
55+
Register: grpc.aio.UnaryUnaryMultiCallable[
56+
celestial_pb2.RegisterRequest,
57+
celestial_pb2.RegisterResponse,
58+
]
59+
Init: grpc.aio.UnaryUnaryMultiCallable[
60+
celestial_pb2.InitRequest,
61+
celestial_pb2.Empty,
62+
]
63+
Update: grpc.aio.StreamUnaryMultiCallable[
64+
celestial_pb2.StateUpdateRequest,
65+
celestial_pb2.Empty,
66+
]
67+
Stop: grpc.aio.UnaryUnaryMultiCallable[
68+
celestial_pb2.Empty,
69+
celestial_pb2.Empty,
70+
]
71+
4472
class CelestialServicer(metaclass=abc.ABCMeta):
4573
@abc.abstractmethod
4674
def Register(
4775
self,
4876
request: celestial_pb2.RegisterRequest,
49-
context: grpc.ServicerContext,
50-
) -> celestial_pb2.RegisterResponse: ...
77+
context: _ServicerContext,
78+
) -> typing.Union[celestial_pb2.RegisterResponse, collections.abc.Awaitable[celestial_pb2.RegisterResponse]]: ...
5179
@abc.abstractmethod
5280
def Init(
5381
self,
5482
request: celestial_pb2.InitRequest,
55-
context: grpc.ServicerContext,
56-
) -> celestial_pb2.Empty: ...
83+
context: _ServicerContext,
84+
) -> typing.Union[celestial_pb2.Empty, collections.abc.Awaitable[celestial_pb2.Empty]]: ...
5785
@abc.abstractmethod
5886
def Update(
5987
self,
60-
request_iterator: collections.abc.Iterator[celestial_pb2.StateUpdateRequest],
61-
context: grpc.ServicerContext,
62-
) -> celestial_pb2.Empty: ...
88+
request_iterator: _MaybeAsyncIterator[celestial_pb2.StateUpdateRequest],
89+
context: _ServicerContext,
90+
) -> typing.Union[celestial_pb2.Empty, collections.abc.Awaitable[celestial_pb2.Empty]]: ...
6391
@abc.abstractmethod
6492
def Stop(
6593
self,
6694
request: celestial_pb2.Empty,
67-
context: grpc.ServicerContext,
68-
) -> celestial_pb2.Empty: ...
95+
context: _ServicerContext,
96+
) -> typing.Union[celestial_pb2.Empty, collections.abc.Awaitable[celestial_pb2.Empty]]: ...
6997

70-
def add_CelestialServicer_to_server(servicer: CelestialServicer, server: grpc.Server) -> None: ...
98+
def add_CelestialServicer_to_server(servicer: CelestialServicer, server: typing.Union[grpc.Server, grpc.aio.Server]) -> None: ...

satgen.Dockerfile

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# This file is part of Celestial (https://github.com/OpenFogStack/celestial).
3+
# Copyright (c) 2024 Tobias Pfandzelter, The OpenFogStack Team.
4+
#
5+
# This program is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation, version 3.
8+
#
9+
# This program is distributed in the hope that it will be useful, but
10+
# WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
# General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
#
17+
18+
FROM python:3.11-slim
19+
20+
RUN apt update && apt install -y \
21+
--no-install-recommends \
22+
--no-install-suggests \
23+
git && \
24+
apt clean && rm -rf /var/lib/apt/lists/*
25+
26+
COPY requirements.txt .
27+
RUN pip install -r requirements.txt
28+
29+
COPY satgen.py .
30+
COPY celestial/*.py celestial/
31+
32+
ENTRYPOINT ["python", "satgen.py"]

0 commit comments

Comments
 (0)