Skip to content

fix(pelican): resolve listen port from SERVER_PORT env var#357

Merged
fank merged 4 commits intomainfrom
fix/pelican-startup-crash
Mar 23, 2026
Merged

fix(pelican): resolve listen port from SERVER_PORT env var#357
fank merged 4 commits intomainfrom
fix/pelican-startup-crash

Conversation

@fank
Copy link
Member

@fank fank commented Mar 23, 2026

Summary

  • Pelican's {{server.allocations.default.port}} template in env var defaults isn't resolved by all versions, causing unknown port crash on startup
  • Entrypoint now sets OCAP_LISTEN from Pelican's injected SERVER_PORT env var
  • Egg default changed to static 0.0.0.0:5000 as safe fallback (entrypoint overrides it with the actual allocated port)

Test plan

  • Import updated egg into Pelican, verify server starts on the allocated port
  • Verify standalone Docker still works (OCAP_LISTEN env var or default)

fank added 3 commits March 23, 2026 21:38
The app only auto-created the data directory, so when the Pelican
install script's directories didn't persist, the server crashed on
startup with "unable to open database file: no such file or directory".

- Auto-create parent directory for DB file and maps directory on startup
- Add full image variant (with map tools) to Pelican egg, default to it
- Use human-readable names in docker_images dropdown
Pelican's {{server.allocations.default.port}} template in env var
defaults is not resolved by all Pelican versions, causing the app to
crash with "unknown port". The entrypoint now sets OCAP_LISTEN from
Pelican's injected SERVER_PORT variable, and the egg default falls
back to a safe static value.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness and compatibility of the OCAP2 Web Server deployment, particularly within Pelican/Wings environments. It resolves a critical startup failure caused by inconsistent environment variable template resolution for allocated ports and improves the server's ability to manage its required data directories. These changes ensure more reliable server operation and simplify deployment.

Highlights

  • Pelican Port Resolution Fix: Addressed an issue where Pelican's {{server.allocations.default.port}} template in environment variable defaults was not reliably resolved across all versions, leading to startup crashes.
  • Dynamic OCAP_LISTEN Configuration: The entrypoint script now explicitly sets the OCAP_LISTEN environment variable using the SERVER_PORT injected by Pelican/Wings, ensuring the application listens on the correct allocated port.
  • Egg Configuration Update: The egg-ocap2-web.json configuration was updated to use a static 0.0.0.0:5000 as the default OCAP_LISTEN value, serving as a safe fallback that is overridden by the entrypoint script.
  • Directory Creation Robustness: Improved server initialization by ensuring that the database and maps directories are created if they do not already exist, preventing potential startup errors.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly resolves an issue with Pelican port allocation by updating the entrypoint script to use the SERVER_PORT environment variable. The corresponding change to the Pelican egg provides a safe fallback port, which is a solid approach. The additional changes to ensure necessary directories are created on startup improve the application's robustness, especially for standalone Docker usage. The test updates are also well-implemented. Overall, the changes are sound and well-executed.

@fank fank merged commit 2affa14 into main Mar 23, 2026
1 check passed
@fank fank deleted the fix/pelican-startup-crash branch March 23, 2026 20:58
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.

1 participant