Skip to content

Commit

Permalink
moved obs-tester-server ubuntu-vm to ghrc.io and make it multi-arch c…
Browse files Browse the repository at this point in the history
…ompatible
  • Loading branch information
Bart Van Bos committed Nov 30, 2023
1 parent 662e0ce commit 5b014fc
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 184 deletions.
45 changes: 45 additions & 0 deletions docker-images/Dockerfile.obs-tester-server.ubuntu-vm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright (c) Tetrate, Inc 2023 All Rights Reserved.
FROM ubuntu:jammy
ENV TZ=UTC
ENV LC_ALL C
ENV DEBIAN_FRONTEND noninteractive

ARG OCI_REVISION
ARG OCI_SOURCE
ARG PACKAGE_VENDOR
ARG TAG
ARG TARGETARCH

LABEL description "This is a container with obs-tester-server binary and init system to mimic a VM"
LABEL name "obs-tester-server-ubuntu-vm"
LABEL org.opencontainers.image.revision ${OCI_REVISION}
LABEL org.opencontainers.image.source ${OCI_SOURCE}
LABEL org.opencontainers.image.title "obs-tester-server-ubuntu-vm"
LABEL release ${TAG}
LABEL vendor ${PACKAGE_VENDOR}
LABEL version ${TAG}

ADD build/bin/linux/${TARGETARCH}/obs-tester-server-static /usr/local/bin/obs-tester-server
RUN apt-get update -y \
&& apt-get install --no-install-recommends -y apt-transport-https ca-certificates curl file git gnupg2 iproute2 iptables iputils-ping net-tools netcat nmap openssh-server sudo systemd systemd-sysv tree vim \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN rm -f /lib/systemd/system/multi-user.target.wants/* \
/etc/systemd/system/*.wants/* \
/lib/systemd/system/local-fs.target.wants/* \
/lib/systemd/system/sockets.target.wants/*udev* \
/lib/systemd/system/sockets.target.wants/*initctl* \
/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup* \
/lib/systemd/system/systemd-update-utmp*
RUN systemctl enable ssh
RUN /bin/bash -c 'echo -e "root\nroot" | passwd root'
RUN /bin/bash -c 'echo -e "\n\nPermitRootLogin yes" | tee -a /etc/ssh/sshd_config'
RUN /bin/bash -c 'useradd --create-home -p $(openssl passwd -1 ubuntu) ubuntu'
RUN /bin/bash -c 'usermod -aG sudo ubuntu'
RUN /bin/bash -c 'echo -e "\n\nubuntu ALL=(ALL:ALL) NOPASSWD:ALL" | tee -a /etc/sudoers'
RUN /bin/bash -c 'usermod --shell /bin/bash root'
RUN /bin/bash -c 'usermod --shell /bin/bash ubuntu'

VOLUME [ "/sys/fs/cgroup" ]
WORKDIR /
ENTRYPOINT ["/sbin/init"]
51 changes: 48 additions & 3 deletions docker-images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ github token with the right permissions. You should be able to use a classic tok
docker login ghcr.io -u $GITHUB_USER -p $GITHUB_TOKEN
```

## Build and publsh obs-tester-server image
## Build and publish obs-tester-server image

Go to tetrate's monorepo (`test/services/obs-tester`) and build/push the container.
Go to tetrateio's monorepo (`test/services/obs-tester`) and build/push the container.

```bash
docker buildx build --builder tetrate-builder --push \
Expand All @@ -43,4 +43,49 @@ docker push ghcr.io/tetratecx/tsb-single-vm/netshoot:v0.11
docker pull nicolaka/netshoot:latest
docker tag nicolaka/netshoot:latest ghcr.io/tetratecx/tsb-single-vm/netshoot:latest
docker push ghcr.io/tetratecx/tsb-single-vm/netshoot:latest
```
```

## Build and publish obs-tester-java image

Go to tetratecx's obs-tester-java repo and build/push the container.

```bash
docker buildx build --builder tetrate-builder --push \
--platform linux/amd64,linux/arm64 \
--build-arg OCI_SOURCE=tetratecx/obs-tester-java \
--build-arg OCI_REVISION=$(git rev-parse HEAD | cut -c 1-10) \
--file Dockerfile \
--build-arg "TAG=1.0" \
--build-arg "PACKAGE_VENDOR=Tetrate.io Inc" \
-t ghcr.io/tetratecx/tsb-single-vm/obs-tester-java:1.0 \
-t ghcr.io/tetratecx/tsb-single-vm/obs-tester-java:latest .
```

## Build and publish obs-tester-server-ubuntu-vm image

This containers provides the tools that would be available on a VM as well.
- systemd is installed (init process PID=0)
- ssh systemd service is enabled
- root/root and ubuntu/ubuntu credentials to get ssh access
- obs-tester-server in /usr/local/bin (part of $PATH)
- pre-installed apt packages (apt-transport-https ca-certificates curl file git gnupg2 iproute2 iptables iputils-ping net-tools netcat nmap openssh-server sudo systemd systemd-sysv tree vim)

Go to tetrateio's monorepo (`test/services/obs-tester`) and build/push the container using the following [Dockerfile.obs-tester-server.ubuntu-vm](Dockerfile.obs-tester-server.ubuntu-vm) dockerfile.

```bash
docker buildx build --builder tetrate-builder --push \
--platform linux/amd64,linux/arm64 \
--build-arg OCI_SOURCE=tetrateio/tetrate \
--build-arg OCI_REVISION=$(git rev-parse HEAD | cut -c 1-10) \
--file Dockerfile.obs-tester-server.ubuntu-vm \
--build-arg "TAG=1.0" \
--build-arg "PACKAGE_VENDOR=Tetrate.io Inc" \
-t ghcr.io/tetratecx/tsb-single-vm/obs-tester-server-ubuntu-vm:1.0 \
-t ghcr.io/tetratecx/tsb-single-vm/obs-tester-server-ubuntu-vm:latest .
```

To run this vm simulating docker container.

```bash
docker run --privileged --tmpfs /tmp --tmpfs /run -v /sys/fs/cgroup:/sys/fs/cgroup --cgroupns=host -it --name=obs-tester-server-ubuntu-vm ghcr.io/tetratecx/tsb-single-vm/obs-tester-server-ubuntu-vm:latest
```
2 changes: 0 additions & 2 deletions docker-images/tsb-fedora-vm/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions docker-images/tsb-ubuntu-vm/.gitignore

This file was deleted.

69 changes: 0 additions & 69 deletions docker-images/tsb-ubuntu-vm/Dockerfile

This file was deleted.

54 changes: 0 additions & 54 deletions docker-images/tsb-ubuntu-vm/Makefile

This file was deleted.

40 changes: 0 additions & 40 deletions docker-images/tsb-ubuntu-vm/README.md

This file was deleted.

12 changes: 6 additions & 6 deletions topologies/infra-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
},
"vms": [
{
"image": "boeboe/tsb-ubuntu-vm:1.0.0",
"image": "ghcr.io/tetratecx/tsb-single-vm/obs-tester-server-ubuntu-vm:latest",
"name": "active-vm1"
},
{
"image": "boeboe/tsb-ubuntu-vm:1.0.0",
"image": "ghcr.io/tetratecx/tsb-single-vm/obs-tester-server-ubuntu-vm:latest",
"name": "active-vm2"
}
],
Expand All @@ -32,11 +32,11 @@
},
"vms": [
{
"image": "boeboe/tsb-ubuntu-vm:1.0.0",
"image": "ghcr.io/tetratecx/tsb-single-vm/obs-tester-server-ubuntu-vm:latest",
"name": "standby-vm1"
},
{
"image": "boeboe/tsb-ubuntu-vm:1.0.0",
"image": "ghcr.io/tetratecx/tsb-single-vm/obs-tester-server-ubuntu-vm:latest",
"name": "standby-vm2"
}
],
Expand All @@ -56,11 +56,11 @@
},
"vms": [
{
"image": "boeboe/tsb-ubuntu-vm:1.0.0",
"image": "ghcr.io/tetratecx/tsb-single-vm/obs-tester-server-ubuntu-vm:latest",
"name": "mgmt-vm1"
},
{
"image": "boeboe/tsb-ubuntu-vm:1.0.0",
"image": "ghcr.io/tetratecx/tsb-single-vm/obs-tester-server-ubuntu-vm:latest",
"name": "mgmt-vm2"
}
],
Expand Down
2 changes: 1 addition & 1 deletion topologies/tsb-training/infra.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"vms": [
{
"image": "boeboe/tsb-ubuntu-vm:1.0.0",
"image": "ghcr.io/tetratecx/tsb-single-vm/obs-tester-server-ubuntu-vm:latest",
"name": "ratings-vm"
}
],
Expand Down
6 changes: 3 additions & 3 deletions topologies/vm-expansion/infra.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
},
"vms": [
{
"image": "boeboe/tsb-ubuntu-vm:1.0.0",
"image": "ghcr.io/tetratecx/tsb-single-vm/obs-tester-server-ubuntu-vm:latest",
"name": "vm1"
},
{
"image": "boeboe/tsb-ubuntu-vm:1.0.0",
"image": "ghcr.io/tetratecx/tsb-single-vm/obs-tester-server-ubuntu-vm:latest",
"name": "vm2"
},
{
"image": "boeboe/tsb-ubuntu-vm:1.0.0",
"image": "ghcr.io/tetratecx/tsb-single-vm/obs-tester-server-ubuntu-vm:latest",
"name": "vm3"
}
],
Expand Down
8 changes: 4 additions & 4 deletions topologies/vm-only/infra.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
},
"vms": [
{
"image": "boeboe/tsb-ubuntu-vm:1.0.0",
"image": "ghcr.io/tetratecx/tsb-single-vm/obs-tester-server-ubuntu-vm:latest",
"name": "vm1"
},
{
"image": "boeboe/tsb-ubuntu-vm:1.0.0",
"image": "ghcr.io/tetratecx/tsb-single-vm/obs-tester-server-ubuntu-vm:latest",
"name": "vm2"
},
{
"image": "boeboe/tsb-ubuntu-vm:1.0.0",
"image": "ghcr.io/tetratecx/tsb-single-vm/obs-tester-server-ubuntu-vm:latest",
"name": "vm3"
},
{
"image": "boeboe/tsb-ubuntu-vm:1.0.0",
"image": "ghcr.io/tetratecx/tsb-single-vm/obs-tester-server-ubuntu-vm:latest",
"name": "vm4"
}
],
Expand Down

0 comments on commit 5b014fc

Please sign in to comment.