Build container
openmamba-docker-buildvm
provides a Docker image with a complete openmamba build environment:
autospec, autodist, autoport, autodistd and the webbuild web interface. It is
the same base as the official build hosts (buildvm-x86_64, buildvm-i586,
…) and lets you build and maintain openmamba packages on any system with
Docker, without installing openmamba.
Supported platforms:
| Docker | openmamba architecture |
|---|---|
linux/amd64 | x86_64 |
linux/arm64 | aarch64 |
linux/386 | i586 |
Creating the container
Install Docker
On openmamba:
# dnf install docker docker-buildx
# usermod -aG docker <user>
# systemctl start docker.socketAfter adding your user to the docker group log in again. On other systems
follow the installation instructions of Docker and buildx.
Get the repository
$ git clone https://src.openmamba.org/openmamba/openmamba-docker-buildvm.git
$ cd openmamba-docker-buildvmBuild the image
$ docker buildx build -t buildvm --platform linux/amd64 .For aarch64 use --platform linux/arm64. For an i586 image on an x86_64 host
there is a dedicated Dockerfile:
$ docker buildx build -t buildvm-i586 --platform linux/386 -f Dockerfile-i586 .Start the container
$ docker run --name buildvm --hostname buildvm -d \
-p 4567:80 -p 8567:8021 buildvmPort 4567 exposes webbuild, 8567 the autodistd API; if you don’t need to
reach autodistd from outside, leave out the second one. Container name and
local ports can be changed as you like.
What’s inside
The image starts from openmamba/openmamba:latest and installs autodist,
autospec, webbuild, Apache and the development tools
(devel-base-openmamba), with the unstable-makedist repository already
enabled.
| Path | Content |
|---|---|
/var/autodist/ | Home of the autodist user, the one you work with |
/var/autodist/RPM/ | rpm and autospec working directory: SPECS, SOURCES, BUILD, RPMS, SRPMS |
/var/autodist/log/ | autodist and autoport logs |
/var/autodist/.autospec | autospec configuration, with all the repositories (base, devel-makedist, devel-misc, devel-autodist, devel-kernel, devel-contrib) |
/etc/autodist/ | autodist, autoport and autodistd configuration |
/var/webbuild/users/ | webbuild users |
The main process of the container is buildvm-init, under tini: it starts
Apache (webbuild, port 80) and autodistd (port 8021) and restarts them if
they stop, also when they are killed on purpose to load an update.
Using the container
Open a shell as the autodist user:
$ docker exec -it --user autodist buildvm /bin/bashor as root, to install packages or change the configuration:
$ docker exec -it --user root buildvm /bin/bashIn an i586 container on an x86_64 host commands must be prefixed by
linux32:
$ docker exec -it --user autodist buildvm-i586 linux32 /bin/bashConfiguring autospec
/var/autodist/.autospec has “Automatic Build System” as packager and no
upload credentials. Before working set your own name and, if you were given
them, the credentials of the repository you can upload to:
packager_fullname="Jane Doe"
packager_email="jane.doe@example.org"
ftp_rw_user[5]="<user>"
ftp_rw_passwd[5]="<password>"Index 5 is devel-contrib; the list of repositories with their indexes is
in the same file. From here on you work with autospec,
autodist and autoport as described in the
previous pages: inside the container the paths are those under
/var/autodist/RPM/.
$ autodist -p nasm
$ autospec -u nasm -a5,6 -bautodistd
autodistd reads its configuration from /etc/autodist/autodistd in the
container (not from Docker environment variables):
| Variable | Meaning |
|---|---|
AUTODISTD_API_KEY | Key for the write operations of the API; without it, the API is read-only |
AUTODISTD_START_PAUSED | If 1, environments start paused and run nothing until started from the API |
AUTODISTD_PORT | Listening port, default 8021 |
$ docker exec --user root buildvm sh -c \
'echo "AUTODISTD_API_KEY=$(openssl rand -hex 32)" >> /etc/autodist/autodistd'Environments (update or porting queues run at regular intervals) are defined
in /etc/autodist/autoport, as described in
autoport; the default configuration has none and autoport
disabled, so a new container doesn’t start any queue by itself; enabling it
needs AUTOPORT_ENABLE=1 in the same file. The state is read from the API:
$ curl -s http://localhost:8567/v1/environmentsThe full API schema is at http://localhost:8567/openapi.json, with the
Swagger interface at http://localhost:8567/docs. autodistd also replaces
the old cron jobs that ran autoport-launcher on the host.
webbuild
webbuild answers on http://localhost:4567, with user autodist and
password openmamba; from another computer replace localhost with the
host address and check that the port is open in the firewall. If the
container can be reached by others, change the password.
Managing the container
# stop and start it again
$ docker stop buildvm
$ docker start buildvm
# start automatically with Docker or when the host reboots
$ docker update --restart unless-stopped buildvm
# CPU and memory limits
$ docker update --cpuset-cpus="0-3" --cpus="4" --memory="8g" buildvmBackup and recreation
To recreate a container, for example after an image update, first save everything that isn’t part of the image, because the container uses no Docker volumes:
| Path | Content |
|---|---|
/etc/autodist | autodist configuration, secrets included |
/var/autodist/.autospec | autospec configuration, with the credentials |
/var/webbuild/users/ | webbuild users |
Save the configuration
$ mkdir -p backup/etc backup/var/autodist backup/var/webbuild
$ docker cp buildvm:/etc/autodist backup/etc/
$ docker cp buildvm:/var/autodist/.autospec backup/var/autodist/.autospec
$ docker cp buildvm:/var/webbuild/users backup/var/webbuild/The files contain credentials: keep them out of any Git repository.
Recreate the container
$ docker stop buildvm
$ docker rm buildvm
$ docker buildx build -t buildvm --platform linux/amd64 .
$ docker run --name buildvm --hostname buildvm -d -p 4567:80 -p 8567:8021 buildvmRestore the configuration
$ docker cp backup/etc/autodist buildvm:/etc/
$ docker cp backup/var/autodist/.autospec buildvm:/var/autodist/.autospec
$ docker cp backup/var/webbuild/users buildvm:/var/webbuild/Fix file ownership
docker cp keeps the numeric UIDs and GIDs of the copied files, which may
not match those of the new container:
$ docker exec --user root buildvm chown -R root:autodist /etc/autodist
$ docker exec --user root buildvm chown apache:autodist /etc/autodist/secrets
$ docker exec --user root buildvm chown autodist:autodist /var/autodist/.autospec
$ docker exec --user root buildvm chown -R apache:nobody /var/webbuild/usersCheck the expected owners with ls -la before applying them: they may
change from one image version to another.