question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'HTTP_PROXIES' not working for Git repository sync

See original GitHub issue

Environment

  • Python version: 3.8.10
  • Nautobot version: 1.3.4
  • OS: Ubuntu 20.04
  • ‘HTTP_PROXIES’ for usage of proxy server configured

Steps to Reproduce

Follow the standard installation process for an Ubuntu 20.04 server:

  1. https://nautobot.readthedocs.io/en/stable/installation/ubuntu/
  2. https://nautobot.readthedocs.io/en/stable/installation/nautobot/
  3. https://nautobot.readthedocs.io/en/stable/installation/services/
  4. https://nautobot.readthedocs.io/en/stable/installation/http-server/
  5. Open the browser and check that Nautobot is working --> Yes, works!
  6. Install the ‘nautobot-welcome-wizard’ --> Has been loaded
  7. Click ‘Plugins’ --> ‘Welcome Wizard’ --> Action ‘Import’ for ‘Device Types’ --> Site loaded correctly, but after refreshing the ‘Import Device Types’ table is still empty
  8. Click ‘Extensibility’ --> ‘Git Repositories’ --> ‘Devicetype-library’ --> ‘Synchronization Status’
  9. After some time I will get the following two (timeout) errors. I did manual line breaks for easier reading:
Cmd('git') failed due to: exit code(128)
cmdline: git clone -v https://github.com/netbox-community/devicetype-library.git /opt/nautobot/git/devicetype_library
stderr: 'Cloning into '/opt/nautobot/git/devicetype_library'...
fatal: unable to access 'https://github.com/netbox-community/devicetype-library.git/':
Failed to connect to github.com port 443: Connection timed out '
Error while refreshing Devicetype-library:
Cmd('git') failed due to: exit code(128)
cmdline: git clone -v https://github.com/netbox-community/devicetype-library.git /opt/nautobot/git/devicetype_library
stderr: 'Cloning into '/opt/nautobot/git/devicetype_library'...
fatal: unable to access 'https://github.com/netbox-community/devicetype-library.git/':
Failed to connect to github.com port 443: Connection timed out '

Configuration

I configured my HTTP proxy in the file nautobot_config.py as follows, but replaced the real IP addresses:

# HTTP proxies Nautobot should use when sending outbound HTTP requests (e.g. for webhooks).
HTTP_PROXIES = {
     'http': 'http://192.0.2.1:3128',
     'https': 'http://192.0.2.1:3128',
}

Expected Behavior

I can see traffic flowing over the proxy server.

Observed Behavior

I used TCP dump on the proxy server and there we’re no packets incoming from the Nautobot server. I also checked with tcpdump on the Nautobot server and can say, that it’s sending it’s HTTP(S) traffic to the default gateway, so no proxy has been used.

I also checked directly on the Linux console and I can clone repositories from Github. I also saw the traffic on the proxy server. --> Proy configuration in Linux is working

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
TheRealBeckscommented, May 23, 2022

@glennmatthews I created a pull request 😃

1reaction
TheRealBeckscommented, May 20, 2022

Thanks a lot, it’s working now! 😃 Run these commands as user nautobot:

git config --global http.proxy http://192.0.2.1:3128
git config --global https.proxy http://192.0.2.1:3128

It would be good if the git proxy configuration for Nautobot gets documented. That’s the current HTTP_PROXIES documentation, but no word about the git commands. Do you think it’s a good idea to do that?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source Sync Issues
Difficulties syncing the source code (proxy issues). Symptom: repo init or repo sync fails with HTTP errors, typically 403 or 500. Cause: There ......
Read more >
1993917 – Syncing repositories with https proxy set ends with ...
Description of problem: Syncing repositories with https proxy set ends with warning Katello::Errors::Pulp3 Error Only http proxies are supported ...
Read more >
Working with HTTP Proxies | OpenShift Container Platform 3.11
If your Git repository can only be accessed using a proxy, you can define the proxy to use in the source section of...
Read more >
How do I pull from a Git repository through an HTTP proxy?
CleverCoder, on Windows, you need to specify %HTTP_PROXY%, not $HTTP_PROXY (unless you're running Cygwin, of course). I will edit my answer to work...
Read more >
Syncing code from GitHub - Checkly
Check our checklyhq.com repository to see this approach in practice. Working with external NPM package dependencies. The Checkly runtime does not support ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found