Documentation and build process

Former-commit-id: cbe39498c3
This commit is contained in:
John D 2021-05-25 06:24:54 -07:00
parent 8fc84f8187
commit fd975f4f24
5 changed files with 107 additions and 1 deletions

View File

@ -14,7 +14,7 @@ mv /usr/libexec/podman/conmon /usr/libexec/podman/conmon.old
ln -s $CONMON_DL /usr/libexec/podman/conmon
if [ ! -f $PODMAN_DL ]; then
curl -fsSLo $PODMAN_DL https://raw.githubusercontent.com/boostchicken/udm-utilities/master/podman-update/bin/podman
curl -fsSLo $PODMAN_DL https://raw.githubusercontent.com/boostchicken/udm-utilities/master/podman-update/bin/podman-3.2.0-dev
fi
chmod +x $PODMAN_DL
mv /usr/bin/podman /usr/bin/podman.old

67
podman-update/README.md Normal file
View File

@ -0,0 +1,67 @@
# Podman Update
## Features
1. Podman 3.2.0
1. Persists through reboots and firmware updates
1. Full Docker / Docker Compose compatibility!
```sh
$ docker-compose -H 10.0.0.1:2375 up
Starting minecraft_1 ... done
Attaching to minecraft_1
minecraft_1 | [init] Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x 4 1000 1000 240 May 25 11:55 /data'
minecraft_1 | [init] Resolved version given LATEST into 1.16.5
minecraft_1 | [init] Resolving type given VANILLA
minecraft_1 | [init] server.properties already created, skipping
minecraft_1 | [init] Checking for JSON files.
minecraft_1 | [init] Setting initial memory to 1G and max to 1G
minecraft_1 | [init] Starting the Minecraft server...
```
## Requirements
1. You have successfully set up the on boot script described [here](https://github.com/boostchicken/udm-utilities/tree/master/on-boot-script)
## Customization
* You can not expose the docker daemon by commenting out the podman service in [00-podman-update.sh](00-podman-update.sh)
## Podman Build Process
* This is a custom-built binary by me. It was cross compiled on Ubuntu-20.04 in WSL2.
* The Makefile needs tweaks. I have supplied the [Makefile.patch](build/Makefile.patch). Apply it to a fresh [podman](https://github.com/containers/podman/) checkout
* You will need [libseccomp-dev:arm64](build/libseccomp-dev_2.2.3-3ubuntu3_arm64.deb) package installed
* You will need [go](https://golang.org/doc/install#download) > 1.12.1 installed
* Setup Cross-Compiler
```sh
sudo apt-get install libc6-arm64-cross libc6-dev-arm64-cross binutils-aarch64-linux-gnu libncurses5-dev build-essential bison flex libssl-dev bc gcc-aarch64-linux-gnu
```
* Compile
```sh
make CC="aarch64-linux-gnu-gcc" local-cross
```
## Steps
1. Copy [00-podman-update.sh](00-podman-update.sh) to /mnt/data/on_boot.d
1. Comment out the Podman service if you do not wish to expose the Docker/Podman Daemon
1. Execute /mnt/data/on_boot.d/[00-podman-update.sh](00-podman-update.sh)
1. Verify Podman version
```sh
$ podman version
Version: 3.2.0-dev
API Version: 3.2.0-dev
Go Version: go1.16.4
Git Commit: 78df4f6fb2e2a404ace69219a50652f4335b7ce1-dirty
Built: Tue May 25 04:52:19 2021
OS/Arch: linux/arm64
```
## Docker Compose
There is no docker-compose binary to run on the UDMP yet, so please use docker-compose from a remote system and specify to run on your UDM.
```docker-compose -H 10.0.0.1:2375 up```
You can also use any regular docker binary and do remote management as well
```
$ docker -H 10.0.0.1:2375 ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
608a24fd121e localhost/unifi-os:latest "/sbin/init" 8 weeks ago Up 8 days unifi-os
```

View File

@ -0,0 +1,39 @@
diff --git a/Makefile b/Makefile
index 15d6d9fb6..8b44da6ae 100644
--- a/Makefile
+++ b/Makefile
@@ -65,7 +65,7 @@ SOURCES = $(shell find . -path './.*' -prune -o \( -name '*.go' -a ! -name '*_te
BUILDFLAGS := -mod=vendor $(BUILDFLAGS)
-BUILDTAGS_CROSS ?= containers_image_openpgp exclude_graphdriver_btrfs exclude_graphdriver_devicemapper exclude_graphdriver_overlay
+BUILDTAGS_CROSS ?= containers_image_openpgp exclude_graphdriver_btrfs exclude_graphdriver_devicemapper exclude_graphdriver_overlay seccomp
CONTAINER_RUNTIME := $(shell command -v podman 2> /dev/null || echo docker)
OCI_RUNTIME ?= ""
@@ -133,16 +133,7 @@ export PATH := $(PATH):$(GOBIN)
GOMD2MAN ?= $(shell command -v go-md2man || echo '$(GOBIN)/go-md2man')
CROSS_BUILD_TARGETS := \
- bin/podman.cross.linux.amd64 \
- bin/podman.cross.linux.ppc64le \
- bin/podman.cross.linux.arm \
bin/podman.cross.linux.arm64 \
- bin/podman.cross.linux.386 \
- bin/podman.cross.linux.s390x \
- bin/podman.cross.linux.mips \
- bin/podman.cross.linux.mipsle \
- bin/podman.cross.linux.mips64 \
- bin/podman.cross.linux.mips64le
# Dereference variable $(1), return value if non-empty, otherwise raise an error.
err_if_empty = $(if $(strip $($(1))),$(strip $($(1))),$(error Required variable $(1) value is undefined, whitespace, or empty))
@@ -370,7 +361,7 @@ bin/podman.cross.%: .gopathok
TARGET="$*"; \
GOOS="$${TARGET%%.*}"; \
GOARCH="$${TARGET##*.}"; \
- CGO_ENABLED=0 \
+ CGO_ENABLED=1 \
$(GO) build \
$(BUILDFLAGS) \
-gcflags '$(GCFLAGS)' \