Skip to content

Package mongosync_insights as offline RPM#181

Merged
dsdlt merged 5 commits intomasterfrom
dsanchez/rpm-packaging
Apr 2, 2026
Merged

Package mongosync_insights as offline RPM#181
dsdlt merged 5 commits intomasterfrom
dsanchez/rpm-packaging

Conversation

@dsdlt
Copy link
Copy Markdown
Collaborator

@dsdlt dsdlt commented Mar 24, 2026

Summary

  • remove python-magic / libmagic dependency
  • add pure-Python file type detection
  • add PyInstaller + RPM packaging flow for air-gapped customers
  • add systemd service and packaging docs
  • disable RPM .build-id generation to avoid conflicts with RHEL system packages

Testing

  • built RPM on RHEL 9
  • validated/fixed .build-id install conflicts
  • ready for review

dsdlt added 3 commits March 24, 2026 13:32
- 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.
@dsdlt dsdlt requested a review from BigMarcio March 24, 2026 15:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-magic and 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.

Comment thread migration/mongosync_insights/mongosync_plot_logs.py Outdated
Comment thread migration/mongosync_insights/build_rpm.sh
Comment thread migration/mongosync_insights/mongosync-insights.service
Comment thread migration/mongosync_insights/README.md
dsdlt and others added 2 commits April 2, 2026 13:27
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@dsdlt dsdlt merged commit a5f8a9e into master Apr 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants