Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offline/air-gapped reflex init #4780

Open
mskarbek opened this issue Feb 8, 2025 · 4 comments
Open

Offline/air-gapped reflex init #4780

mskarbek opened this issue Feb 8, 2025 · 4 comments
Labels
feature request A feature you wanted added to reflex workaround available

Comments

@mskarbek
Copy link

mskarbek commented Feb 8, 2025

Describe the Features
Reflex should work in a completely offline environment or be able to use private pypi/npm repositories.

Additional context
My current work environment doesn't allow direct internet connection. We have only access to the internal proxy repositories based on Sonatype Nexus, so I'm able to install Reflex but can't init new project because Reflex tries to connect to the Internet.
Edit: I can recreate ~/.local/share/reflex directory structure with bun/fnm/nodejs in correct versions manually. What is needed is a parametrized init that allows to specify internal npm repository for the web directory initialization.

@mskarbek mskarbek added the feature request A feature you wanted added to reflex label Feb 8, 2025
Copy link

linear bot commented Feb 8, 2025

@mskarbek
Copy link
Author

mskarbek commented Feb 8, 2025

Workaround:

  1. Install Refelx on an online computer and initialize temporary project. This will create a ~/.local/share/reflex directory with required dependencies installed. Move that directory to the offline computer using a USB stick, for example.
  2. Install Rerflex on your offline computer using an internal pypi proxy.
  3. Initialize new project with REFLEX_CHECK_LATEST_VERSION=False reflex init and blank template. That will skip version check and dependencies installation but will fail web directory initialization.
  4. Create <project_dir>/.web/.npmrc file with registry configuration pointing at your internal npm registry proxy.
  5. Run Reflex project with reflex run. This will install frontend dependencies using registry configured in .npmrc and properly build the web interface.

@adhami3310
Copy link
Member

You can use NPM_CONFIG_REGISTRY to set a specific NPM registry. As for PyPi, as you said, REFLEX_CHECK_LATEST_VERSION works. Otherwise, you can use REFLEX_USE_SYSTEM_BUN and REFLEX_USE_SYSTEM_NODE to avoid network connections. Lastly, if it causes issues, you can disable telemetry through TELEMETRY_ENABLED. I believe that's basically all of the network stuff that we call on init and run.

@adhami3310
Copy link
Member

@mskarbek is there some actionable on this ticket? or is the solution above fine?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A feature you wanted added to reflex workaround available
Projects
None yet
Development

No branches or pull requests

3 participants