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

Monolithic Docker provider #2632

Merged
merged 72 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
22ad4b4
Merge pull request #2375 from Varying-Vagrant-Vagrants/develop
tomjn Mar 16, 2021
c9ec449
3.6.1 (#2394)
tomjn Mar 16, 2021
62c5796
3.6.2
tomjn Mar 17, 2021
ace8de7
Merge pull request #2494 from Varying-Vagrant-Vagrants/develop
tomjn Jul 21, 2021
92758fd
Merge pull request #2511 from Varying-Vagrant-Vagrants/develop
tomjn Aug 3, 2021
0b6b2ac
Init README
pentatonicfunk Sep 25, 2021
188bcaf
Init provision
pentatonicfunk Sep 25, 2021
a646c93
Removing disksize reference
pentatonicfunk Sep 25, 2021
ce156b6
Explicit noninteractive DEBIAN_FRONTEND
pentatonicfunk Sep 26, 2021
a40ab54
Attempt to fix mailhog start and restart
pentatonicfunk Sep 26, 2021
e78b6f9
Downgrade mariadb to 10.3
pentatonicfunk Sep 26, 2021
d80d105
Disable sync clocks ntpdate
pentatonicfunk Sep 26, 2021
79a57ea
Add apt-utils and add `/run/php` dir manually
pentatonicfunk Sep 26, 2021
48ab479
Update `is_module_enabled_fpm`
pentatonicfunk Sep 26, 2021
23464a6
Fix type
pentatonicfunk Sep 26, 2021
7fd737e
Refactor mailhog restart
pentatonicfunk Sep 26, 2021
76a008b
Fix vagrant up for docker container
pentatonicfunk Sep 26, 2021
b8a0c44
remove unnen
pentatonicfunk Oct 2, 2021
fdade8b
Reinit /etc/hosts on up
pentatonicfunk Oct 3, 2021
d6ed345
Failsafe delete temporary hosts file
pentatonicfunk Oct 3, 2021
a8101df
Cleanup
pentatonicfunk Oct 3, 2021
636a530
Mac OS compatibility
pentatonicfunk Oct 6, 2021
da3b697
Mariadb 10.5 compat
pentatonicfunk Oct 7, 2021
de8c959
Remove text/html from nginx gzip_types
pentatonicfunk Oct 8, 2021
58a2c88
Override debian.cnf
pentatonicfunk Oct 8, 2021
729da51
Add `less` package for wp cli
pentatonicfunk Oct 9, 2021
08c4db5
Rename OS var to VOS to avoid conflict with OS gem
pentatonicfunk Oct 16, 2021
1cda256
Remove debug #6
pentatonicfunk Oct 17, 2021
ff1b71b
Keep vm.box for non docker compat #4
pentatonicfunk Oct 17, 2021
d103405
Move VB box to its own specific section to not break docker #4
pentatonicfunk Oct 17, 2021
4acaa62
Minimize default config changes #5
pentatonicfunk Oct 17, 2021
f0ae39a
Follow vvv function name convention #7
pentatonicfunk Oct 17, 2021
39d794f
Attempt to migrate `cat` and append to `tee`
pentatonicfunk Oct 17, 2021
47057c8
Improve macos detection, and move ifconfig command to Vagrantfile
pentatonicfunk Oct 20, 2021
8252690
Merge pull request #2557 from Varying-Vagrant-Vagrants/develop
tomjn Nov 15, 2021
bb58041
Merge remote-tracking branch 'upstream/stable' into docker-provider-beta
pentatonicfunk Jan 29, 2022
42efd1c
Fix: more new private ip address adjusment
pentatonicfunk Jan 29, 2022
fabccb8
3.9.1 stable release
tomjn Apr 13, 2022
d442355
Merge remote-tracking branch 'upstream/stable' into docker-provider-beta
pentatonicfunk Aug 15, 2022
1da5dd1
Fix / revert default box
pentatonicfunk Aug 15, 2022
00d7499
Update readme, prepare using `develop` as upstream
pentatonicfunk Aug 15, 2022
ef6106b
Merge remote-tracking branch 'upstream/develop' into docker-provider-…
pentatonicfunk Aug 15, 2022
4a5d545
Merge remote-tracking branch 'vvv/develop' into docker-provider
tomjn Sep 11, 2022
a488c4b
remove duplicate apt package listings
tomjn Sep 11, 2022
1a5394a
bring readme closer to original
tomjn Sep 11, 2022
af1209f
mention docker and parallels
tomjn Sep 11, 2022
42f99f1
disable docker provider by default, make it opt in
tomjn Sep 11, 2022
3ee80e4
Merge branch 'develop' into docker-provider
tomjn Sep 13, 2022
a11e359
Merge branch 'develop' into docker-provider
tomjn Oct 31, 2022
c0f4a6c
Merge branch 'develop' into docker-provider
msaggiorato May 9, 2023
22fd603
Fix docker version detection
msaggiorato May 9, 2023
4c7e6bf
Find open ports on the host to do port mapping outside of the defaults
msaggiorato May 9, 2023
206e661
Default to docker on ARM64
msaggiorato May 9, 2023
69a65af
Set up safe.directory for issues with docker WIP
msaggiorato May 9, 2023
60c5532
Map the hosts to be pointed early
msaggiorato May 11, 2023
459e5e2
Remove unnecessary check
msaggiorato May 11, 2023
c67bb0c
Make goodhosts work with docker
msaggiorato May 11, 2023
1f0c981
Fix issue with docker not provisioning as expected
msaggiorato May 11, 2023
c005314
remove docker port testing code
tomjn Jun 26, 2023
bd53f8f
Implement vvv_safe_sed
msaggiorato Jun 28, 2023
6d14048
shellcheck improvements
tomjn Jun 28, 2023
906b15e
added new search replace token functions
tomjn Jun 28, 2023
abea1f5
improvements and docker related fixes for Nginx config handling
tomjn Jun 28, 2023
07f1111
Merge branch 'docker-provider' of github.com:Varying-Vagrant-Vagrants…
tomjn Jun 29, 2023
cd3d1e3
added vvv_search_replace and vvv_search_replace_in_file functions
tomjn Jun 29, 2023
e634188
description for vvv_safe_sed
tomjn Jun 29, 2023
798b6b6
shellcheck improvements for provision helpers
tomjn Jun 29, 2023
9f5f064
removed old site template search replace functions
tomjn Jun 29, 2023
b8f3745
use the renamed functions
tomjn Jun 29, 2023
1000b3e
Merge branch 'develop' into docker-provider
tomjn Jun 29, 2023
f4696ea
Update CHANGELOG.md
tomjn Jun 29, 2023
2dfd0e4
Merge branch 'develop' into docker-provider
tomjn Jul 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 35 additions & 25 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Vagrant.require_version '>= 2.2.4'
require 'yaml'
require 'fileutils'
require 'pathname'
require 'socket'

def sudo_warnings
red = "\033[38;5;9m" # 124m"
Expand Down Expand Up @@ -216,9 +217,9 @@ defaults['memory'] = 2048
defaults['cores'] = 1
defaults['provider'] = 'virtualbox'

# if Arm default to parallels
# if Arm default to docker
if Etc.uname[:version].include? 'ARM64'
defaults['provider'] = 'parallels'
defaults['provider'] = 'docker'
end

# This should rarely be overridden, so it's not included in the config/default-config.yml file.
Expand Down Expand Up @@ -304,6 +305,8 @@ if show_logo
provider_version = '??'
when 'hyperv'
provider_version = 'n/a'
when 'docker'
provider_version = VagrantPlugins::DockerProvider::Driver.new.execute("docker", "-v").gsub("Docker version ", "")
Comment on lines +331 to +332
Copy link
Member Author

Choose a reason for hiding this comment

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

this looks like a nice self contained change

else
provider_version = '??'
end
Expand Down Expand Up @@ -436,17 +439,42 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
override.vm.box = 'bento/ubuntu-20.04'
end

def port_is_open?(*ports)
_port = 0
ports.each do |port|
_port = port
begin
Socket.tcp('127.0.0.1', port, connect_timeout: 5) {}
rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT
return port
end
end

loop do
_port = _port + 1
begin
Socket.tcp('127.0.0.1', _port, connect_timeout: 5) {}
rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT
return _port
end
end
end

http_port = port_is_open?(80, 8080, 8888, 8000)
https_port = port_is_open?(443, 8443, 9999, 9000)
mysql_port = port_is_open?(3306)
mailhog_port = port_is_open?(8025)

# Docker use image.
config.vm.provider :docker do |d|
d.image = 'pentatonicfunk/vagrant-ubuntu-base-images:20.04'
Copy link
Member Author

Choose a reason for hiding this comment

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

we can avoid this by using a dockerfile and layering over a general ubuntu 20 container

Copy link
Member

Choose a reason for hiding this comment

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

That'd be preferrable for me as well

d.has_ssh = true
if Vagrant::Util::Platform.platform == 'darwin19'
# Docker in mac need explicit ports publish to access
d.ports = [ "#{vvv_config['vm_config']['private_network_ip']}:80:80" ]
d.ports += [ "#{vvv_config['vm_config']['private_network_ip']}:443:443" ]
d.ports += [ "#{vvv_config['vm_config']['private_network_ip']}:3306:3306" ]
d.ports += [ "#{vvv_config['vm_config']['private_network_ip']}:8025:8025" ]
d.ports += [ "#{vvv_config['vm_config']['private_network_ip']}:1025:1025" ]
d.ports = [ "#{http_port}:80" ]
d.ports += [ "#{https_port}:443" ]
d.ports += [ "#{mysql_port}:3306" ]
d.ports += [ "#{mailhog_port}:8025" ]
end
end

Expand Down Expand Up @@ -923,24 +951,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
end
end

# specific trigger for mac and docker
if Vagrant::Util::Platform.platform == 'darwin19' && vvv_config['vm_config']['provider'] == 'docker'
config.trigger.before :up do |trigger|
trigger.name = "VVV Setup docker local network before up"
trigger.run = {inline: "bash -c 'sudo ifconfig lo0 alias #{vvv_config['vm_config']['private_network_ip']}/24'"}
end
config.trigger.after :halt do |trigger|
trigger.name = 'VVV delete docker local network after halt'
trigger.run = {inline: "bash -c 'sudo ifconfig lo0 inet delete #{vvv_config['vm_config']['private_network_ip']}'"}
trigger.on_error = :continue
end
config.trigger.after :destroy do |trigger|
trigger.name = 'VVV delete docker local network after destroy'
trigger.run = {inline: "bash -c 'sudo ifconfig lo0 inet delete #{vvv_config['vm_config']['private_network_ip']}'"}
trigger.on_error = :continue
end
end

config.trigger.after :up do |trigger|
trigger.name = 'VVV Post-Up'
trigger.run_remote = { inline: '/srv/config/homebin/vagrant_up' }
Expand Down
2 changes: 2 additions & 0 deletions provision/core/git/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,7 @@ function git_after_packages() {
vvv_info " * Git hasn't been told how to merge branches, setting pull.rebase false for the merge strategy"
noroot git config --global pull.rebase false
fi
git config --global --add safe.directory '*' # Allow git to work well under docker provider
noroot git config --global --add safe.directory '*' # Allow git to work well under docker provider
Comment on lines +61 to +62
Copy link
Member Author

Choose a reason for hiding this comment

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

these might be needed regardless of wether we use docker or not, could these be a separate PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

this should be extracted into a separate PR

}
vvv_add_hook after_packages git_after_packages