Skip to content

Commit

Permalink
prepare a quick-start tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
pfandzelter committed Apr 27, 2022
1 parent 1bad954 commit 23117b2
Show file tree
Hide file tree
Showing 51 changed files with 1,024 additions and 1,090 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ test.toml
.idea/
.mypy_cache/
*.bin
/animation/

~$*

Expand Down
24 changes: 7 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,21 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

.PHONY: build client server container binary runclient runserver installserver cleanupserver
.PHONY: build container celestial-make rootfs-builder

build: proto container binary
client: proto container runclient
server: proto binary runserver
build: proto celestial.bin

container: proto Dockerfile celestial.py celestial ## build client docker container
docker build -t celestial .

binary: celestial.bin

celestial.bin: celestial.go pkg proto ## build go binary
go build -o celestial.bin .

proto: ## build proto files
proto/: ## build proto files
cd ./proto ; make ; cd ..

runclient: container ## run client
docker run --rm -it -v $(pwd)/config.toml:/config.toml celestial /config.toml

runserver: celestial.bin ## run server
sudo ./celestial.bin

cleanupserver: ## run server cleanup
bash ./cleanupserver.sh
celestial-make: ## build the compile container
docker build -f compile.Dockerfile -t celestial-make .

installserver: ## install dependencies on server
bash ./installserver.sh
rootfsbuilder: ## build the rootfs builder container
cd ./builder ; make rootfsbuilder ; cd ..
24 changes: 24 additions & 0 deletions animation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Animation Only

If you would like to animate a satellite constellation, use the `animate.py`
program in the root of the repository like so:

```sh
python3 animate.py ./path/to/configuration.toml
```

![Constellation Animation](../docs/assets/celestial-constellation.gif)

In the [`animation`](./animation) directory, you can find two example
configuration files.

`starlink.toml` has all parameters for the complete Starlink phase I
constellation, so use that to animate that constellation:

```sh
# in /celestial root directory
python3 animate.py ./animation/starlink.toml
```

`geostationary.toml` has a single geo-stationary satellite in orbit
around earth.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions celestial.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,20 @@ func main() {
panic(err.Error())
}
}()

go func() {
err := infoserver.Start(*infoServerPort, o)
if err != nil {
panic(err.Error())
}
}()

go func() {
err := s.Serve(lisS)
if err != nil {
panic(err.Error())
}
}()

panic(p.Serve(lisP))
}
4 changes: 2 additions & 2 deletions celestial/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ def __init__(
self.shell_actors.append(types.SimpleNamespace())
self.isl_actors.append(types.SimpleNamespace())

self.sat_colors = sns.color_palette(n_colors=self.num_shells+3)[3:]
self.isl_colors = sns.color_palette(n_colors=self.num_shells+3, desat=0.5)[3:]
self.sat_colors = sns.color_palette(n_colors=self.num_shells)
self.isl_colors = sns.color_palette(n_colors=self.num_shells, desat=0.5)

self.draw_links = draw_links

Expand Down
44 changes: 44 additions & 0 deletions compile.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
FROM debian:bullseye@sha256:bdf44f19d09b558203306836a612cc8e42a1106b2f731fbeb000e2696c04f9c8

RUN apt-get update && apt-get install -y \
--no-install-recommends \
--no-install-suggests \
ca-certificates \
wget \
make \
unzip \
python3 \
git \
python3-pip && \
apt-get clean && rm -rf /var/lib/apt/lists/*

RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip && \
unzip protoc-3.15.8-linux-x86_64.zip -d protoc-3.15.8 && \
mv protoc-3.15.8 /usr/local/protoc && \
rm protoc-3.15.8-linux-x86_64.zip && \
chmod +x /usr/local/protoc/bin/* && \
ln -s /usr/local/protoc/bin/protoc /usr/local/bin/protoc

RUN wget https://go.dev/dl/go1.18.1.linux-amd64.tar.gz && \
rm -rf /usr/local/go && \
tar -C /usr/local -xzf go1.18.1.linux-amd64.tar.gz && \
echo 'export PATH="$PATH:/usr/local/go/bin"' >> /etc/profile && \
echo 'export PATH="$PATH:/root/go/bin"' >> /etc/profile && \
echo 'export GOPATH=/root/go' >> /etc/profile && \
echo 'export GOBIN="/root/go/bin"' >> /etc/profile && \
rm -rf go1.18.1.linux-amd64.tar.gz

ENV PATH $PATH:/usr/local/go/bin
ENV PATH $PATH:/root/go/bin
ENV GOPATH /root/go
ENV GOBIN /root/go/bin

RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26.0 && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1

COPY requirements.txt requirements.txt
RUN python3 -m pip install -r requirements.txt -U

WORKDIR /celestial

ENTRYPOINT [ "make" ]
Binary file added docs/assets/actual_line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added docs/assets/diff_ecdf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/expected_line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/reachable_actual.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/reachable_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/results_scatter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 11 additions & 20 deletions docs/compilation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,20 @@ nav_order: 4

## Compilation

Use the Makefiles to compile the project.
Use Docker to compile the project.

### Protocol Buffer

You can use the pre-compiled gRPC/protobuf files or compile your own.
### Building the Compile Container

To compile the `proto` files (needed for communication between server and client),
you will need the following tools:
Run `make celestial-make` to build a container that has all the dependencies
needed to compile the project.

- `go`, version 1.16 or later
- `python3`, preferably Python 3.8 or later
- `protoc`, version 3.15.8 or later (on macOS, install with `brew install protobuf`)
- `mypy-protobuf` (`pip3 install mypy-protobuf`) to compile type hints for
generated Python files
- `grpcio-tools`, version 1.37.1 or later (`pip3 install grpcio-tools`) to
generate gRPC Python files
- `protoc-gen-go` (install with `go install google.golang.org/protobuf/cmd/protoc-gen-go@latest`)
to generate gRPC Go files
### Protocol Buffer

Once you have these tools installed, execute:
You can use the pre-compiled gRPC/protobuf files or compile your own:

```sh
# compile all protofiles for python and go
make proto
docker run --rm -v $(pwd):/celestial celestial-make proto/
```

### Python Client
Expand All @@ -46,13 +36,14 @@ You can also package that client as a Docker container if you want.
This requires the `docker` command available on your system.

```sh
make container
# make container
docker build -t celestial .
```

### Go Server

To compile the server, you need `go` version 1.16 or later.
Compile the host server with:

```sh
make binary
docker run --rm -v $(pwd):/celestial celestial-make celestial.bin
```
2 changes: 1 addition & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
layout: default
title: Contribution
title: Contributing
nav_order: 2
---

Expand Down
Loading

0 comments on commit 23117b2

Please sign in to comment.