Skip to content

Commit

Permalink
Add NextMN-Lite & update srv6/srv6-ctrl
Browse files Browse the repository at this point in the history
  • Loading branch information
louisroyer committed Dec 4, 2024
1 parent 9f56ff4 commit 2d60208
Show file tree
Hide file tree
Showing 19 changed files with 716 additions and 5 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/docker-image-cp-lite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Docker Image CI - CP-Lite

on:
push:
paths:
- 'cp-lite/**'
branches: [ master ]
workflow_dispatch:
repository_dispatch:
types: [docker-build]

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ vars.DOCKERHUB_USERNAME }}/${{ vars.DOCKERHUB_REPO_CP_LITE }}
tags: |
type=raw,enable=true,priority=100,prefix=bookworm-,suffix=-slim,value={{date 'YYYY-MM-DD'}}-{{sha}}
flavor: |
latest=true
prefix=
suffix=
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:cp-lite"
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: BUILD_DATE=${{ steps.date.outputs.date }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
59 changes: 59 additions & 0 deletions .github/workflows/docker-image-gnb-lite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Docker Image CI - gNB-Lite

on:
push:
paths:
- 'gnb-lite/**'
branches: [ master ]
workflow_dispatch:
repository_dispatch:
types: [docker-build]

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ vars.DOCKERHUB_USERNAME }}/${{ vars.DOCKERHUB_REPO_GNB_LITE }}
tags: |
type=raw,enable=true,priority=100,prefix=bookworm-,suffix=-slim,value={{date 'YYYY-MM-DD'}}-{{sha}}
flavor: |
latest=true
prefix=
suffix=
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:gnb-lite"
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: BUILD_DATE=${{ steps.date.outputs.date }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
59 changes: 59 additions & 0 deletions .github/workflows/docker-image-ue-lite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Docker Image CI - UE-Lite

on:
push:
paths:
- 'ue-lite/**'
branches: [ master ]
workflow_dispatch:
repository_dispatch:
types: [docker-build]

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ vars.DOCKERHUB_USERNAME }}/${{ vars.DOCKERHUB_REPO_UE_LITE }}
tags: |
type=raw,enable=true,priority=100,prefix=bookworm-,suffix=-slim,value={{date 'YYYY-MM-DD'}}-{{sha}}
flavor: |
latest=true
prefix=
suffix=
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:ue-lite"
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: BUILD_DATE=${{ steps.date.outputs.date }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.PHONY: docker

all: docker/upf docker/srv6 docker/srv6-ctrl
all: docker/upf docker/srv6 docker/srv6-ctrl docker/ue-lite docker/gnb-lite docker/cp-lite
docker/%:
docker buildx build -t louisroyer/dev-nextmn-$(@F) ./$(@F)
143 changes: 143 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,146 @@ sysctls:
- net.ipv6.conf.all.seg6_enabled=1
- net.ipv6.conf.default.seg6_enabled=1
```
### NextMN UE-Lite
- On Dockerhub: [`louisroyer/dev-nextmn-ue-lite`](https://hub.docker.com/r/louisroyer/dev-nextmn-ue-lite).
> [!NOTE]
> Please note that even if this software is not yet properly packaged using `.deb`, the generated binary file `/usr/local/bin/ue-lite` is provided to you under MIT License.
> A copy of the source code is available at in the repository [`nextmn/ue-lite`](https://github.com/nextmn/ue-lite).
Environment variable used to select templating system:
```yaml
environment:
ROUTING_SCRIPT: "docker-setup"
TEMPLATE_SCRIPT: "template-script.sh"
TEMPLATE_SCRIPT_ARGS: ""
CONFIG_FILE: "/etc/nextmn/ue-lite.yaml"
CONFIG_TEMPLATE: "/usr/local/share/nextmn/template-ue-lite.yaml"
```
Environment variables for templating:
```yaml
environment:
HTTP_ADDRESS: "192.0.2.3"
HTTP_PORT: "8080"
RAN: |-
bind-addr: "10.1.0.2:1234"
gnbs:
- "http://192.0.2.4:8080"
pdu-sessions:
- gnb: "http://192.0.2.4:8080"
dnn: "nextmn-lite"
LOG_LEVEL: "info"
```
#### Routing
> [!TIP]
> If you choose to configure the container using `docker-setup` (default), please refer to [`docker-setup`'s documentation](https://github.com/louisroyer/docker-setup). The environment variable ONESHOT is set to "true".
#### Container deployment
> [!IMPORTANT]
> - The container requires the `NET_ADMIN` capability;
> - The tun interface (`/dev/net/tun`) must be available in the container.
This can be done in `docker-compose.yaml` by defining the following for the service:
```yaml
cap_add:
- NET_ADMIN
devices:
- "/dev/net/tun"
```
### NextMN gNB-Lite
- On Dockerhub: [`louisroyer/dev-nextmn-gnb-lite`](https://hub.docker.com/r/louisroyer/dev-nextmn-gnb-lite).
> [!NOTE]
> Please note that even if this software is not yet properly packaged using `.deb`, the generated binary file `/usr/local/bin/gnb-lite` is provided to you under MIT License.
> A copy of the source code is available at in the repository [`nextmn/gnb-lite`](https://github.com/nextmn/gnb-lite).
Environment variable used to select templating system:
```yaml
environment:
ROUTING_SCRIPT: "docker-setup"
TEMPLATE_SCRIPT: "template-script.sh"
TEMPLATE_SCRIPT_ARGS: ""
CONFIG_FILE: "/etc/nextmn/gnb-lite.yaml"
CONFIG_TEMPLATE: "/usr/local/share/nextmn/template-gnb-lite.yaml"
```
Environment variables for templating:
```yaml
environment:
HTTP_ADDRESS: "192.0.2.4"
HTTP_PORT: "8080"
CP: "http://192.0.2.5:8080"
N3: "10.0.200.4"
RAN: |-
bind-addr: "10.1.0.1:1234"
LOG_LEVEL: "info"
```
#### Routing
> [!TIP]
> If you choose to configure the container using `docker-setup` (default), please refer to [`docker-setup`'s documentation](https://github.com/louisroyer/docker-setup). The environment variable ONESHOT is set to "true".
#### Container deployment
> [!IMPORTANT]
> - The container requires the `NET_ADMIN` capability (if you want to configure the container using `docker-setup`).
This can be done in `docker-compose.yaml` by defining the following for the service:
```yaml
cap_add:
- NET_ADMIN
```
### NextMN CP-Lite
- On Dockerhub: [`louisroyer/dev-nextmn-cp-lite`](https://hub.docker.com/r/louisroyer/dev-nextmn-cp-lite).
> [!NOTE]
> Please note that even if this software is not yet properly packaged using `.deb`, the generated binary file `/usr/local/bin/cp-lite` is provided to you under MIT License.
> A copy of the source code is available at in the repository [`nextmn/cp-lite`](https://github.com/nextmn/cp-lite).
Environment variable used to select templating system:
```yaml
environment:
ROUTING_SCRIPT: "docker-setup"
TEMPLATE_SCRIPT: "template-script.sh"
TEMPLATE_SCRIPT_ARGS: ""
CONFIG_FILE: "/etc/nextmn/cp-lite.yaml"
CONFIG_TEMPLATE: "/usr/local/share/nextmn/template-cp-lite.yaml"
```
Environment variables for templating:
```yaml
environment:
N4: "203.0.113.3"
HTTP_ADDRESS: "192.0.2.5"
HTTP_PORT: "8080"
SLICES: |-
nextmn-lite:
pool: "10.0.111.0/24"
upfs:
- node-id: "203.0.113.2"
interfaces:
- type: "N3"
addr: "10.0.200.3"
LOG_LEVEL: "info"
```
#### Routing
> [!TIP]
> If you choose to configure the container using `docker-setup` (default), please refer to [`docker-setup`'s documentation](https://github.com/louisroyer/docker-setup). The environment variable ONESHOT is set to "true".
#### Container deployment
> [!IMPORTANT]
> - The container requires the `NET_ADMIN` capability (if you want to configure the container using `docker-setup`).
This can be done in `docker-compose.yaml` by defining the following for the service:
```yaml
cap_add:
- NET_ADMIN
```
40 changes: 40 additions & 0 deletions cp-lite/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2024 Louis Royer. All rights reserved.
# Use of this source code is governed by a MIT-style license that can be
# found in the LICENSE file.
# SPDX-License-Identifier: MIT

FROM golang:1.22 AS builder
ARG COMMIT=v0.0.1
RUN : ${COMMIT:? Missing build-arg COMMIT.} && go install github.com/nextmn/cp-lite@${COMMIT}


FROM louisroyer/base-irit:latest

LABEL maintainer="Louis Royer <[email protected]>" \
org.opencontainers.image.authors="Louis Royer <[email protected]>" \
org.opencontainers.image.source="https://github.com/louisroyer-docker/nextmn"

# Used to disable caching of next steps, if not build since 1 day,
# allowing to search and apply security upgrades
ARG BUILD_DATE=""

RUN apt-get update -q && DEBIAN_FRONTEND=non-interactive apt-get install -qy --no-install-recommends --no-install-suggests \
docker-setup \
&& apt-get upgrade -qy \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /go/bin/cp-lite /usr/local/bin/cp-lite
COPY ./*.sh /usr/local/bin/
COPY ./template-cp-lite.yaml /usr/local/share/nextmn/
ENV ROUTING_SCRIPT="docker-setup" \
ONESHOT="true" \
TEMPLATE_SCRIPT="template-script.sh" \
TEMPLATE_SCRIPT_ARGS="" \
CONFIG_FILE="/etc/nextmn/cp-lite.yaml" \
CONFIG_TEMPLATE="/usr/local/share/nextmn/template-cp-lite.yaml"

ENTRYPOINT ["entrypoint.sh"]
CMD ["--help"]

HEALTHCHECK --interval=1m --timeout=1s --retries=3 --start-period=5s --start-interval=100ms \
CMD ["entrypoint.sh", "healthcheck"]
Loading

0 comments on commit 2d60208

Please sign in to comment.