Skip to content

Commit

Permalink
make using docker for satgen possible
Browse files Browse the repository at this point in the history
  • Loading branch information
pfandzelter committed Mar 26, 2024
1 parent 85d73a1 commit 99a955c
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 164 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ PROJECT_NAME := "celestial"
PKG := "github.com/OpenFogStack/$(PROJECT_NAME)"
GO_FILES := $(shell find . -name '*.go' | grep -v _test.go)

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

build: celestial.bin

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

satgen-docker: satgen.Dockerfile satgen.py requirements.txt celestial/*.py ## build the satgen container
@docker build -f $< -t $@ .

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
@docker build --platform=linux/amd64 -t $@:latest builder/
14 changes: 0 additions & 14 deletions TODO.md

This file was deleted.

17 changes: 17 additions & 0 deletions docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ source .venv/bin/activate
python3 -m pip install -r requirements.txt
```

Alternatively, you can also run this with Docker.
Build the `satgen-docker` image:

```sh
make satgen-docker
```

#### Running Satellite Trajectory Generation

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

If you want to use the Docker image instead:

```sh
docker run --rm \
-v ${pwd}:/app \
satgen-docker \
/app/[PATH_TO_CONFIG] \
/app/[OUTPUT_PATH] \
```

After a few seconds to minutes (depending on the size of the constellation
you want to emulate) you will end up with a `.zip` file that you can use for
further emulation.
Expand Down
4 changes: 2 additions & 2 deletions proto/celestial/celestial.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 32 additions & 9 deletions proto/celestial/celestial_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion proto/celestial/celestial_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 39 additions & 11 deletions proto/celestial/celestial_pb2_grpc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,19 @@ import abc
import celestial_pb2
import collections.abc
import grpc
import grpc.aio
import typing

_T = typing.TypeVar('_T')

class _MaybeAsyncIterator(collections.abc.AsyncIterator[_T], collections.abc.Iterator[_T], metaclass=abc.ABCMeta):
...

class _ServicerContext(grpc.ServicerContext, grpc.aio.ServicerContext): # type: ignore
...

class CelestialStub:
def __init__(self, channel: grpc.Channel) -> None: ...
def __init__(self, channel: typing.Union[grpc.Channel, grpc.aio.Channel]) -> None: ...
Register: grpc.UnaryUnaryMultiCallable[
celestial_pb2.RegisterRequest,
celestial_pb2.RegisterResponse,
Expand All @@ -41,30 +51,48 @@ class CelestialStub:
celestial_pb2.Empty,
]

class CelestialAsyncStub:
Register: grpc.aio.UnaryUnaryMultiCallable[
celestial_pb2.RegisterRequest,
celestial_pb2.RegisterResponse,
]
Init: grpc.aio.UnaryUnaryMultiCallable[
celestial_pb2.InitRequest,
celestial_pb2.Empty,
]
Update: grpc.aio.StreamUnaryMultiCallable[
celestial_pb2.StateUpdateRequest,
celestial_pb2.Empty,
]
Stop: grpc.aio.UnaryUnaryMultiCallable[
celestial_pb2.Empty,
celestial_pb2.Empty,
]

class CelestialServicer(metaclass=abc.ABCMeta):
@abc.abstractmethod
def Register(
self,
request: celestial_pb2.RegisterRequest,
context: grpc.ServicerContext,
) -> celestial_pb2.RegisterResponse: ...
context: _ServicerContext,
) -> typing.Union[celestial_pb2.RegisterResponse, collections.abc.Awaitable[celestial_pb2.RegisterResponse]]: ...
@abc.abstractmethod
def Init(
self,
request: celestial_pb2.InitRequest,
context: grpc.ServicerContext,
) -> celestial_pb2.Empty: ...
context: _ServicerContext,
) -> typing.Union[celestial_pb2.Empty, collections.abc.Awaitable[celestial_pb2.Empty]]: ...
@abc.abstractmethod
def Update(
self,
request_iterator: collections.abc.Iterator[celestial_pb2.StateUpdateRequest],
context: grpc.ServicerContext,
) -> celestial_pb2.Empty: ...
request_iterator: _MaybeAsyncIterator[celestial_pb2.StateUpdateRequest],
context: _ServicerContext,
) -> typing.Union[celestial_pb2.Empty, collections.abc.Awaitable[celestial_pb2.Empty]]: ...
@abc.abstractmethod
def Stop(
self,
request: celestial_pb2.Empty,
context: grpc.ServicerContext,
) -> celestial_pb2.Empty: ...
context: _ServicerContext,
) -> typing.Union[celestial_pb2.Empty, collections.abc.Awaitable[celestial_pb2.Empty]]: ...

def add_CelestialServicer_to_server(servicer: CelestialServicer, server: grpc.Server) -> None: ...
def add_CelestialServicer_to_server(servicer: CelestialServicer, server: typing.Union[grpc.Server, grpc.aio.Server]) -> None: ...
32 changes: 32 additions & 0 deletions satgen.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# This file is part of Celestial (https://github.com/OpenFogStack/celestial).
# Copyright (c) 2024 Tobias Pfandzelter, The OpenFogStack Team.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

FROM python:3.11-slim

RUN apt update && apt install -y \
--no-install-recommends \
--no-install-suggests \
git && \
apt clean && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
RUN pip install -r requirements.txt

COPY satgen.py .
COPY celestial/*.py celestial/

ENTRYPOINT ["python", "satgen.py"]
Loading

0 comments on commit 99a955c

Please sign in to comment.