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

Feature Request: Add Snap Proxy Support #216

Open
AjkayAlan opened this issue Mar 16, 2020 · 3 comments
Open

Feature Request: Add Snap Proxy Support #216

AjkayAlan opened this issue Mar 16, 2020 · 3 comments

Comments

@AjkayAlan
Copy link

The Problem

I am behind a corporate authenticated proxy which requires me to utilize this plugin (which works wonderfully by the way!). I am creating a vagrant based development environment, so installing things such as development IDEs, etc. One small gap I have - when using Ubuntu 18.04 with Snap, I get timeouts.

The Solution

Snap doesn't honor /etc/environment settings - we have to explicitly set them. What about doing something equivalent to the following?:

if [ -x "$(command -v snap)" ]; then
  sudo snap set system proxy.http=$http_proxy
  sudo snap set system proxy.https=$https_proxy
fi

$http_proxy and $https_proxy would be replaced by the value provided in the Vagrantfile, or through the defaults set.

@codylane
Copy link
Collaborator

Hi @AjkayAlan,

Thank you for your kind words and for attempting to address this problem with a solution.

However, I'm afraid it's not that simple to just implement a new feature given the current nature of this plugin. We would have to address quiet a few different edge cases for different operating systems and attempt to keep them up to date.

As I'm not familiar with Snap and how Snap is used in the community and or if the community has actually adopted it as a main deployment tool I'm not so sure that implementing this feature (given the current state of this plugin) would be beneficial. That said, it's not that we won't implement something, I'm just hesitant to implement new features outside the scope of what is already currently implemented. It's a fairly large undertaking as it stands now to maintain the current state of this plugin without worry that we might accidentally introduce a breaking change for others. You would also have to take care to ensure that this plugin is configured in the right place either before or after other services.

We do however, rely on the community for help and we will accept pull requests for new features as long as the feature has documentation, implementation and tests. We will do a small code review for each pull request as well to ensure that code is maintainable for others as we evolve in this ecosystem. Also TravisCI is used to test pull requests and code commits. If the Travis job is not successful, we won't merge this into master until the code passes all tests.

If you would like to help support this feature we will work with you to ensure that you have all the resources necessary to implement this behavior.

Here is a high level of what I think it would take in order to implement this. There may be additional steps needed to get this to work properly but this is a stab of what it would take.

  • - Create add a new file here under lib/vagrant-proxyconf/action/configure_snapd.rb and have it conform to the base.rb implementation including all required methods. You could take a peek at the existing implementations for reference.

  • - Create a implementation capability for each OS that supports this intregration here: lib/vagrant-proxyconf/cap

  • - Create a new config implementation here: lib/vagrant-proxyconf/config then add this implmentation here: https://github.com/tmatilai/vagrant-proxyconf/blob/master/lib/vagrant-proxyconf/config.rb

  • - And finally if all is well, you would define the use of this new feature here which is the heart of the plugin to make use of this new feature for "pre-provisioning" and "post-provisioning"

I would also highly recommend that this feature can be both "configured" and "un-configured" and documented in the README of how to use and consume this feature.

@AjkayAlan
Copy link
Author

Thanks for the well laid out response @codylane!

Snap is Canonical's next-gen package management system, meant to allow package authors a way to create one package which can be used on every version of Ubuntu, along with other distro's. For my specific use case, I am using vagrant to create a small developer environment with a GUI, which includes Microsoft's Visual Studio Code. VSCode is a snap package distributed by Microsoft.

Digging more into the problem, I believe snap should be honoring /etc/environment (which this plugin already sets), but for me specifically it wasn't.

Ultimately I believe the issue should be addressed with snap and not here, and as such we should probably close this for now unless the landscape changes. Thanks again for being receptive of the idea!

@codylane
Copy link
Collaborator

Thank you for the high level of what Snap is and will be used for. For what it's worth I've done a little micro deep dive of what Snap is and is used for and it seems to be pretty promising for the community especially since it's not locked down to a particular OS or package management tool.

That said, I do think this would be a useful feature to implement and the community would benefit from it so I'm going to re-open this request in hopes that someone with the time will help make this into our plugin ecosystem.

Also, to validate what you are saying about configuring environment variables behind a corprate proxy I've seen plenty of tools that say they support environment variables like HTTP_PROXY and http_proxy example (curl, git, vagrant, wget, docker) that don't always work when using the environment variables (even though the tool claims env vars work) and sometimes I've found I have to use a special config file either global or per use basis in order for that particular tool to use the corporate proxy.

Hopefully one day we will be in a world that has a micro service that "auto" configures all services we use in development when behind a proxy.

@codylane codylane reopened this Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants