build(quic): bundle Linux runtime libraries [CI]
This commit is contained in:
1 parent
e2e5e437cb
commit
29d998bc94
18 files changed
+227
-15
No files matched your search
@@ -7,11 +7,13 @@ LABEL org.opencontainers.image.title="MoShiro Agent" \
|
||||
org.opencontainers.image.version="$APP_VERSION"
|
||||
|
||||
COPY --chown=1654:1654 app/moshiro-agent /usr/local/bin/moshiro-agent
|
||||
COPY --chown=1654:1654 app/lib*.so.* /usr/local/bin/
|
||||
COPY --chown=1654:1654 app/fleet-enroll /usr/local/bin/fleet-enroll
|
||||
COPY --chown=1654:1654 config/ /etc/moshiro/
|
||||
COPY --chown=1654:1654 --chmod=0755 entrypoint.sh /usr/local/bin/moshiro-entrypoint
|
||||
|
||||
ENV MOSHIRO_ROLE=agent
|
||||
ENV LD_LIBRARY_PATH=/usr/local/bin
|
||||
USER 1654:1654
|
||||
WORKDIR /etc/moshiro
|
||||
VOLUME ["/etc/moshiro"]
|
||||
|
||||
@@ -26,6 +26,10 @@ RUN test -x /out/agent/moshiro-agent && test -x /out/enroll/fleet-enroll \
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/runtime-deps:10.0-alpine
|
||||
|
||||
# Include MsQuic and its musl runtime dependencies in the resulting image.
|
||||
RUN apk add --no-cache libmsquic numactl lttng-ust zlib \
|
||||
&& cp -a /usr/lib/libmsquic.so* /usr/lib/libnuma.so* /usr/lib/liblttng-ust*.so* /usr/lib/libz.so* /usr/local/bin/
|
||||
|
||||
ARG APP_VERSION=main
|
||||
LABEL org.opencontainers.image.title="MoShiro Agent" \
|
||||
org.opencontainers.image.description="MoShiro node agent for Linux" \
|
||||
@@ -38,6 +42,7 @@ COPY --chown=1654:1654 config/ /etc/moshiro/
|
||||
COPY --chown=1654:1654 --chmod=0755 entrypoint.sh /usr/local/bin/moshiro-entrypoint
|
||||
|
||||
ENV MOSHIRO_ROLE=agent
|
||||
ENV LD_LIBRARY_PATH=/usr/local/bin
|
||||
USER 1654:1654
|
||||
WORKDIR /etc/moshiro
|
||||
VOLUME ["/etc/moshiro"]
|
||||
|
||||
@@ -7,11 +7,13 @@ LABEL org.opencontainers.image.title="MoShiro Probe" \
|
||||
org.opencontainers.image.version="$APP_VERSION"
|
||||
|
||||
COPY --chown=1654:1654 app/moshiro-probe /usr/local/bin/moshiro-probe
|
||||
COPY --chown=1654:1654 app/lib*.so.* /usr/local/bin/
|
||||
COPY --chown=1654:1654 app/fleet-enroll /usr/local/bin/fleet-enroll
|
||||
COPY --chown=1654:1654 config/ /etc/moshiro/
|
||||
COPY --chown=1654:1654 --chmod=0755 entrypoint.sh /usr/local/bin/moshiro-entrypoint
|
||||
|
||||
ENV MOSHIRO_ROLE=probe
|
||||
ENV LD_LIBRARY_PATH=/usr/local/bin
|
||||
USER 1654:1654
|
||||
WORKDIR /etc/moshiro
|
||||
VOLUME ["/etc/moshiro"]
|
||||
|
||||
@@ -26,6 +26,10 @@ RUN test -x /out/probe/moshiro-probe && test -x /out/enroll/fleet-enroll \
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/runtime-deps:10.0-alpine
|
||||
|
||||
# Include MsQuic and its musl runtime dependencies in the resulting image.
|
||||
RUN apk add --no-cache libmsquic numactl lttng-ust zlib \
|
||||
&& cp -a /usr/lib/libmsquic.so* /usr/lib/libnuma.so* /usr/lib/liblttng-ust*.so* /usr/lib/libz.so* /usr/local/bin/
|
||||
|
||||
ARG APP_VERSION=main
|
||||
LABEL org.opencontainers.image.title="MoShiro Probe" \
|
||||
org.opencontainers.image.description="MoShiro network measurement probe for Linux" \
|
||||
@@ -38,6 +42,7 @@ COPY --chown=1654:1654 config/ /etc/moshiro/
|
||||
COPY --chown=1654:1654 --chmod=0755 entrypoint.sh /usr/local/bin/moshiro-entrypoint
|
||||
|
||||
ENV MOSHIRO_ROLE=probe
|
||||
ENV LD_LIBRARY_PATH=/usr/local/bin
|
||||
USER 1654:1654
|
||||
WORKDIR /etc/moshiro
|
||||
VOLUME ["/etc/moshiro"]
|
||||
|
||||
+13
-1
@@ -62,6 +62,14 @@ install_binary() {
|
||||
put 0755 "$HERE/$src" "$PREFIX/$src"
|
||||
}
|
||||
|
||||
install_quic_runtime() {
|
||||
[ -f "$HERE/libmsquic.so.2" ] || die "libmsquic.so.2 is missing from this Linux release archive"
|
||||
[ -f "$HERE/libnuma.so.1" ] || die "libnuma.so.1 is missing from this Linux release archive"
|
||||
set -- "$HERE"/lib*.so.*
|
||||
mkdir -p "$PREFIX"
|
||||
for library do put 0644 "$library" "$PREFIX/$(basename "$library")"; done
|
||||
}
|
||||
|
||||
write_config() {
|
||||
if [ "$1" = agent ]; then
|
||||
cat >"$CONFIG/agent.json" <<JSON
|
||||
@@ -104,6 +112,7 @@ install_role() {
|
||||
|
||||
install_binary "moshiro-$role"
|
||||
install_binary fleet-enroll
|
||||
install_quic_runtime
|
||||
say "installed binaries to $PREFIX"
|
||||
|
||||
init="$(init_system)"
|
||||
@@ -117,7 +126,7 @@ install_role() {
|
||||
put 0755 "$HERE/openwrt/moshiro-probe.init" /etc/init.d/moshiro-probe
|
||||
mkdir -p /lib/upgrade/keep.d
|
||||
put 0644 "$HERE/openwrt/moshiro.keep" /lib/upgrade/keep.d/moshiro ;;
|
||||
*) echo "warning: no systemd or procd found: start $PREFIX/moshiro-$role --config $CONFIG/$role.json with your own supervisor" >&2 ;;
|
||||
*) echo "warning: no systemd or procd found: start with LD_LIBRARY_PATH=$PREFIX $PREFIX/moshiro-$role --config $CONFIG/$role.json under your own supervisor" >&2 ;;
|
||||
esac
|
||||
|
||||
ready=0
|
||||
@@ -162,6 +171,9 @@ uninstall() {
|
||||
esac
|
||||
rm -f "$PREFIX/moshiro-$role"
|
||||
rm -f "$PREFIX/fleet-enroll"
|
||||
other_role=agent
|
||||
[ "$role" = agent ] && other_role=probe
|
||||
[ -x "$PREFIX/moshiro-$other_role" ] || rm -f "$PREFIX"/lib*.so.*
|
||||
rmdir "$PREFIX" 2>/dev/null || true
|
||||
if [ "$purge" -eq 1 ]; then
|
||||
rm -rf "$CONFIG"
|
||||
|
||||
@@ -14,6 +14,7 @@ start_service() {
|
||||
return 1
|
||||
}
|
||||
procd_open_instance
|
||||
procd_set_param env LD_LIBRARY_PATH=/usr/lib/moshiro
|
||||
procd_set_param command "$PROG" --config "$CONF"
|
||||
# respawn: threshold(s) timeout(s) retry (0 = forever)
|
||||
procd_set_param respawn 3600 5 0
|
||||
|
||||
@@ -40,6 +40,7 @@ Environment=HOST_PROC=/host/proc
|
||||
Environment=HOST_SYS=/host/sys
|
||||
Environment=HOST_ROOT=/host/root
|
||||
Environment=MOSHIRO_NETWORK_SCOPE=host
|
||||
Environment=LD_LIBRARY_PATH=/usr/local/bin
|
||||
# 告诉节点:退出之后外面会重新拉取,所以「更新」就是退出(没有这一行,节点不报告更新状态)
|
||||
Environment=MOSHIRO_UPDATE=restart
|
||||
EnvironmentFile=%h/.config/moshiro/agent.env
|
||||
|
||||
@@ -40,6 +40,7 @@ Environment=HOST_PROC=/host/proc
|
||||
Environment=HOST_SYS=/host/sys
|
||||
Environment=HOST_ROOT=/host/root
|
||||
Environment=MOSHIRO_NETWORK_SCOPE=host
|
||||
Environment=LD_LIBRARY_PATH=/usr/local/bin
|
||||
# 告诉节点:退出之后外面会重新拉取,所以「更新」就是退出(没有这一行,节点不报告更新状态)
|
||||
Environment=MOSHIRO_UPDATE=restart
|
||||
EnvironmentFile=%h/.config/moshiro/probe.env
|
||||
|
||||
@@ -7,6 +7,7 @@ Wants=network-online.target
|
||||
Type=exec
|
||||
User=moshiro
|
||||
Group=moshiro
|
||||
Environment=LD_LIBRARY_PATH=/usr/lib/moshiro
|
||||
ExecStart=/usr/lib/moshiro/moshiro-agent --config /etc/moshiro/agent.json
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
@@ -7,6 +7,7 @@ Wants=network-online.target
|
||||
Type=exec
|
||||
User=moshiro
|
||||
Group=moshiro
|
||||
Environment=LD_LIBRARY_PATH=/usr/lib/moshiro
|
||||
ExecStart=/usr/lib/moshiro/moshiro-probe --config /etc/moshiro/probe.json
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
Reference in new issue
Block a user