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

Revamp the Vagrantfile #2640

Open
aldavigdis opened this issue Nov 5, 2022 · 7 comments
Open

Revamp the Vagrantfile #2640

aldavigdis opened this issue Nov 5, 2022 · 7 comments

Comments

@aldavigdis
Copy link
Contributor

For the ease of maintenance and further development, doing a rewrite of the Vagrantfile may be a good idea.

  • Introducing a more object oriented style, as opposed to using globals everwhere
  • Splitting the main Vagrantfile into included file, located in .vagrant/
  • Setting up and configuring rubocop so that any Ruby code follows the Ruby Style Guide
  • Configuring a Github action for running rubocop against any Ruby code

Describe alternatives you've considered

Maintaining the Vagrantfile as-is is an option, but with things like plugin checks being broken and the code quality having gone down over time, I think this is more sustainable.

Additional context

This was discussed in #2638 and I think that while challenging, this may be the best way for myself to start getting acquainted with the structure of this project.

@tomjn
Copy link
Member

tomjn commented Nov 5, 2022

I'd like us to keep to a .vvv folder, this is already supported in site provisioners and it avoids us having issues if we do things without vagrant or if vagrant changes the folder layout. Same if someone tries to debug by nuking the VM and removing the .vagrant folder

@tomjn
Copy link
Member

tomjn commented Nov 5, 2022

An example of OO or at least abstracting away duplication is the shared/mapped folders. All our mappings have the same settings yet we define them for every single provider, so a wrapper function or class representing each folder might be a more optimal way of doing it. I know other Vagrant projects have done this.

Chassis does this via configuration and an array:

https://github.com/Chassis/Chassis/blob/main/Vagrantfile#L104-L109

https://github.com/Chassis/Chassis/blob/main/Vagrantfile#L225-L232

GitHub
📦 Chassis is a virtual server for your WordPress site, built using Vagrant. - Chassis/Vagrantfile at main · Chassis/Chassis
GitHub
📦 Chassis is a virtual server for your WordPress site, built using Vagrant. - Chassis/Vagrantfile at main · Chassis/Chassis

@tomjn
Copy link
Member

tomjn commented Nov 5, 2022

Likewise, data collection and splash screens could be a function in a file, as could all the various big warning screens

@aldavigdis
Copy link
Contributor Author

I'm with you. I also think that starting off by creating a Ruby module called ``VVV` as a root namespace and then use that to namespace classes that we use, with each class in a separate file to make it easy to deal with.

I guess something like .vvv/lib/[class_name].rb would be a good idea that keeps us within needs and conventions.

I also think that scoping this so that we keep the current intended functionality and then branch into adding further functionality. I.e. starting off with some sort of MVP and going from there.

@Mte90
Copy link
Member

Mte90 commented Nov 7, 2022

Looking on how we are looking to evolve the project for pure docker support and not just Vagrant a path can be .vvv/vagrant/lib[class_name].rb in this way we can use that folder for the internals things.

About the rest I agree about everything.

@aldavigdis
Copy link
Contributor Author

@Mte90 - That's exactly how I'm doing this currently. Maintainability and portability are the two biggest concerns that I've been having.

@aldavigdis
Copy link
Contributor Author

The first PR for this is ready at #2641.

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

3 participants