Skip to content
Snippets Groups Projects
Commit 1efc0da7 authored by Neil-Jocelyn Schark's avatar Neil-Jocelyn Schark
Browse files

Building a devcontainer setup

See merge request !562

Co-authored-by: Neil-Jocelyn Schark <--global>
parent 05a57bc6
No related branches found
No related tags found
1 merge request!562Building a devcontainer setup
Pipeline #163893 passed
# The devcontainer will be based on Python
# The base container already has entrypoint, vscode user account, etc. out of the box
FROM mcr.microsoft.com/devcontainers/python:3-bookworm
# containelab version will be set in devcontainer.json
ARG _CLAB_VERSION
# install some basic tools inside the container
# adjust this list based on your demands
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
sshpass \
curl \
iputils-ping \
htop \
&& rm -rf /var/lib/apt/lists/* \
&& rm -Rf /usr/share/doc && rm -Rf /usr/share/man \
&& apt-get clean
# install preferred version of the containerlab
RUN bash -c "$(curl -sL https://get.containerlab.dev)" -- -v ${_CLAB_VERSION} \
&& pip3 install --user yamllint
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "clab-for-arm",
"build": {
"dockerfile": "Dockerfile",
"args": {
"_CLAB_VERSION": "0.46.1"
}
},
"features": {
// Containerlab will run in a docker-in-docker container
// it is also possible to use docker-outside-docker feature
"ghcr.io/devcontainers/features/docker-in-docker:2.7.0": {
"version": "latest"
},
"ghcr.io/devcontainers/features/go:1": {
"version": "1.21.1"
}
},
// add any required extensions that must be pre-installed in the devcontainer
"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.vscode-docker",
"golang.go",
"EditorConfig.EditorConfig",
"eamodio.gitlens",
"ms-vscode.makefile-tools",
"redhat.vscode-yaml"
]
}
}
}
......@@ -85,6 +85,8 @@ start-dev-env: containerize-gosdn containerize-plugin-registry
stop-dev-env:
./scripts/simple-dev-setup.sh --mode stop --topology dev_env_data/clab/basic_two_aristas.yaml
generate-certs: generate-gnmi-target-certs generate-gosdn-certs
clean:
$(GOCLEAN)
rm -rf $(BUILD_ARTIFACTS_PATH)
......@@ -33,6 +33,7 @@ There you can also find some tutorials to get to know the SDN controller:
- [Playground](#playground)
- [Additional services](#additional-services)
- [Configuration file](#configuration-file)
- [Development-Tutorial](#development-tutorial)
- [Contributing](CONTRIBUTING.md)
- [License](LICENSE)
- [CI Status](#ci-status)
......@@ -226,8 +227,27 @@ Information about how to use the CLI is provided in the `cli` folder, see [here]
## Development Tutorial
There are several options on how to create a dev environment. A more classic way or the option to use devcontainers with VSCode.
### Devcontainer - local
For this method you only need `docker` and `vscode` with the plugin `Dev Containers` from Microsoft installed.
After you installed the required tools, you can simply open the folder in the dev container.
Either you click on `Open in Container` if a pop-up appears on the bottom right, or by selecting `Open in Container` after clicking on `Remote Explorer` in the left bar in VSCode. Please note: depending on your internet connection and the performance of the device, the initial creation of the container can take several minuts or longer! Furthermore the initial git discovery of every submodule in this repo (if installed) can also take some minutes.
The devcontainer has everything you need in it (even relevant VSCode plugins), so you should not need anything more.
Please keep in mind that this setup is not tested thoroughly!
### Devcontainer - remote
If for example your local device is not very performant, an ARM device or youw ant for other reasons use a remote device to develop, you can use the devcontainer setup remotely via SSH on a different device/server.
TBD.
### Classic
The classic installation requires `go`, `docker`, `docker compose` and `containerlab`.
To help with developing there is a small script available, which helps to create the complete dev environment.
For it to work, you need `go`, `docker`, `docker compose` and `containerlab`.
For a quick start simply use `make start-dev-env` to start everything. This can take a while. Afterwards, you see the output of goSDN, to stop it hit Ctrl+C. To stop everything else use `make stop-dev-env`.
......
name: gosdn_one_arista
mgmt:
network: gosdn-net
ipv4-subnet: 172.100.0.0/16
ipv6-subnet: 2001:db8::/64
topology:
kinds:
ceos:
image: registry.code.fbi.h-da.de/danet/containers/ceos:4.28.2F
nodes:
ceos0:
kind: ceos
mgmt-ipv4: 172.100.0.11
name: gosdn_sts_demo_basic
name: gosdn_two_aristas
mgmt:
network: gosdn-net
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment