From b663d484cf3d106b1ac5bf201ea50242faca8a85 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Fri, 30 Jan 2026 12:47:18 -0600 Subject: [PATCH] nif ci fix complie in ci --- .dockerignore | 5 +++++ .gitignore | 5 +++++ Dockerfile | 6 ++++-- lib/towerops/profiles/profile_watcher.ex | 24 ++++++++++++++++------- priv/towerops_nif.so | Bin 51248 -> 0 bytes 5 files changed, 31 insertions(+), 9 deletions(-) delete mode 100755 priv/towerops_nif.so diff --git a/.dockerignore b/.dockerignore index 5d2adff0..64d3e9a2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -44,3 +44,8 @@ erl_crash.dump /assets/node_modules/ /priv/static/assets/ /priv/static/cache_manifest.json + +# Compiled NIF binaries - should be built in container for target architecture +/priv/*.so +/priv/*.dylib +/c_src/*.o diff --git a/.gitignore b/.gitignore index 929b42ab..3351579b 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,8 @@ profiles.json # Application MIB files (now committed to git and included in Docker image) # Only ignore the top-level librenms mibs directory (symlink) + +# Compiled NIF binaries (platform-specific, should be built in Docker) +/priv/*.so +/priv/*.dylib +/c_src/*.o diff --git a/Dockerfile b/Dockerfile index 6716d019..0ae14564 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,7 @@ ENV TERM=dumb # install build dependencies RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get upgrade -y \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential git \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential git libsnmp-dev \ && rm -rf /var/lib/apt/lists/* # prepare build dir @@ -63,6 +63,8 @@ RUN --mount=type=cache,target=/root/.mix \ COPY priv priv +COPY c_src c_src + COPY lib lib # Compile the release @@ -84,7 +86,7 @@ RUN mix release FROM ${RUNNER_IMAGE} AS final RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends libstdc++6 openssl libncurses6 locales ca-certificates iputils-ping snmp \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends libstdc++6 openssl libncurses6 locales ca-certificates iputils-ping snmp libsnmp40 \ && rm -rf /var/lib/apt/lists/* # Set the locale diff --git a/lib/towerops/profiles/profile_watcher.ex b/lib/towerops/profiles/profile_watcher.ex index a6a4eb18..3e1ad1ad 100644 --- a/lib/towerops/profiles/profile_watcher.ex +++ b/lib/towerops/profiles/profile_watcher.ex @@ -5,6 +5,8 @@ defmodule Towerops.Profiles.ProfileWatcher do Uses FileSystem to monitor the priv/profiles directory for file changes. When a .yaml or .yml file is created, modified, or deleted, triggers a reload of all profiles via YamlProfiles.reload/0. + + Note: Only available in development mode. FileSystem is a dev-only dependency. """ use GenServer @@ -20,16 +22,24 @@ defmodule Towerops.Profiles.ProfileWatcher do @impl true def init(_opts) do - # Get the absolute path to the profiles directory - profiles_path = Path.join(Application.app_dir(:towerops), @profiles_dir) + # Only start file watcher in development + # FileSystem is a dev-only dependency + if Code.ensure_loaded?(FileSystem) do + # Get the absolute path to the profiles directory + profiles_path = Path.join(Application.app_dir(:towerops), @profiles_dir) - # Start watching the profiles directory for changes - {:ok, watcher_pid} = FileSystem.start_link(dirs: [profiles_path]) - FileSystem.subscribe(watcher_pid) + # Start watching the profiles directory for changes + {:ok, watcher_pid} = FileSystem.start_link(dirs: [profiles_path]) + FileSystem.subscribe(watcher_pid) - Logger.info("ProfileWatcher: Started watching #{profiles_path}") + Logger.info("ProfileWatcher: Started watching #{profiles_path}") - {:ok, %{watcher_pid: watcher_pid, profiles_path: profiles_path}} + {:ok, %{watcher_pid: watcher_pid, profiles_path: profiles_path}} + else + # In production, FileSystem is not available + Logger.debug("ProfileWatcher: FileSystem not available, running in no-op mode") + {:ok, %{}} + end end @impl true diff --git a/priv/towerops_nif.so b/priv/towerops_nif.so deleted file mode 100755 index 1d8d81b68e2aadb40e6758e362c35ae7c12ebc2d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 liter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