Package mongosync_insights as offline RPM#181
Merged
Conversation
- Replace python-magic (libmagic) with pure-Python magic-byte MIME detection so no system library (libmagic1 / file-libs) is needed - Add text/plain and application/json to ALLOWED_MIME_TYPES (fixes uncompressed .log/.json file validation) - Patch Flask app to resolve templates/images via sys._MEIPASS when running as a PyInstaller bundle - Add PyInstaller spec file (mongosync_insights.spec) for one-dir builds - Add build_rpm.sh script: creates venv, runs PyInstaller, packages as RPM via fpm — output is a single .rpm with embedded Python and all deps - Add systemd service file with env-file support (/etc/mongosync-insights/env) - Add PACKAGING.md with build, install, configure, and run instructions - Update README.md: remove libmagic install steps, add RPM install option - Remove python-magic from requirements.txt
…m packages PyInstaller bundles system .so files (libz, libssl, libncurses, etc.) whose .build-id symlinks conflict with RHEL packages like zlib, openssl-libs, and ncurses-libs. Remove .build-id directories from the staging area and add --exclude '**/.build-id' to the fpm invocation.
The previous find+exclude approach was insufficient — rpmbuild itself auto-generates .build-id symlinks for every ELF binary it encounters. Add --rpm-rpmbuild-define '_build_id_links none' to tell rpmbuild to skip .build-id generation entirely, preventing conflicts with system packages like zlib, openssl-libs, ncurses-libs, etc.
BigMarcio
approved these changes
Mar 27, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR packages mongosync_insights for offline/air-gapped deployment as a self-contained RPM (PyInstaller bundle + fpm), while removing the python-magic/libmagic dependency by switching to pure-Python MIME/type detection.
Changes:
- Removed
python-magicand introduced pure-Python MIME detection + updated allowed MIME types. - Added an RPM build flow (
build_rpm.sh+ PyInstaller spec), systemd unit, and packaging documentation for offline installs. - Updated Flask template/static asset resolution to work correctly when frozen via PyInstaller.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| migration/mongosync_insights/requirements.txt | Drops python-magic dependency. |
| migration/mongosync_insights/README.md | Adds offline RPM install path and links to packaging docs. |
| migration/mongosync_insights/PACKAGING.md | New end-to-end RPM build/install/run documentation. |
| migration/mongosync_insights/mongosync-insights.service | New systemd unit for running the packaged binary. |
| migration/mongosync_insights/mongosync_plot_logs.py | Replaces libmagic MIME detection with pure-Python detection. |
| migration/mongosync_insights/mongosync_insights.spec | New PyInstaller spec describing the frozen bundle contents. |
| migration/mongosync_insights/mongosync_insights.py | Adjusts Flask template/static paths for PyInstaller (sys._MEIPASS). |
| migration/mongosync_insights/build_rpm.sh | New RPM build script using PyInstaller + fpm, removes .build-id links. |
| migration/mongosync_insights/app_config.py | Expands allowed MIME types to include text/plain and application/json. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
python-magic/libmagicdependency.build-idgeneration to avoid conflicts with RHEL system packagesTesting
.build-idinstall conflicts