-
Notifications
You must be signed in to change notification settings - Fork 848
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
WIP Docker PR #2537
WIP Docker PR #2537
Conversation
…-Vagrants/develop Prepare v3.6 release
…-Vagrants/develop 3.7.1 release
…-Vagrants/develop 3.7.2
- use direct binary call
- docker use same clock as host
- Docker doesn't support persistent /etc/hosts
- By default its always compressed
- I guess backward compat ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some notes
README.md
Outdated
vagrant plugin install --local | ||
|
||
# MAC Only ( see: https://docs.docker.com/desktop/mac/networking/#per-container-ip-addressing-is-not-possible ) | ||
sudo ifconfig lo0 alias 192.168.50.4/24 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect this could be done from the vagrant file, though is the IP always the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was thinking to add it to Vagrantfile, but not quite sure in which part and how to add it properly, basically we can sub 192.168.50.4/24
with vvv_config['vm_config']['private_network_ip']
to make it auto adjust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link in the comment doesn't mention the command here, I'm unsure how this is meant to work or where it comes from.
It's also not how I've seen other docker set ups work, how do other docker environments get around this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docker in linux have network bridge accessible in host, so we can assign an IP address to a container, and ping or connect to that IP address from host. Meanwhile in Mac, this network bridge is not accessible by the host, so we can't ping or connect to that IP address ( 192.168.50.4 ) and basically the custom domain we added *.test is inaccessible, because goodhosts mapped it to 192.168.50.4
@@ -432,6 +451,21 @@ Vagrant.configure('2') do |config| | |||
override.vm.box = 'bento/ubuntu-20.04' | |||
end | |||
|
|||
# Docker use image. | |||
config.vm.provider :docker do |d| | |||
d.image = 'pentatonicfunk/vagrant-ubuntu-base-images:20.04' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing this image gets built as a part of provisioning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this image is "built" image already. provisioning only pulling it in.
https://github.com/pentatonicfunk/docker-vagrant-ubuntu-base-images
https://hub.docker.com/repository/docker/pentatonicfunk/vagrant-ubuntu-base-images
what do you think about these ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to completely remove Ubuntu 18 as an option, it's only there for longterm compatibility at the moment, and at some point Ondrej packages for 18 will disappear. As for prebuilt images I'm not sure
# not included in docker images by default, lets add | ||
iputils-ping | ||
net-tools | ||
nano | ||
less |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these needed or are they just useful for developing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
less is the most required ( for wp cli ) and its not included in my docker image yet.
i will add these packages to docker image pentatonicfunk/docker-vagrant-ubuntu-base-images#1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather we were explicit about these things for portability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pentatonicfunk I added most of these a while back, just added nano
in a draft PR seeing if I can take any more of this PR back into VVV core. At least less
/net-tools
/etc are all listed twice here
provision/provision-helpers.sh
Outdated
function get_vvv_sites() { | ||
local sites=$(shyaml -q keys "sites" <${VVV_CONFIG}) | ||
echo "${sites}" | ||
} | ||
|
||
function re_init_etc_hosts() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vvv_get_sites
and vvv_update_guest_hosts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems it's already disabled Taken from #2537: ``` # text/html Responses with the “text/html” type are always compressed. https://nginx.org/en/docs/http/ngx_http_gzip_module.html#gzip_types ``` https://nginx.org/en/docs/http/ngx_http_gzip_module.html#gzip_types
@tomjn totally agree with you, this fork and PR merely a PoC and reference for the future when we actually start to fully support docker -- that if we really want to, and won't be a pain point to maintain. And if there are any stuff here that can improve VVV in general, we can can just cherry pick it and make mini separate PRs like you already did. I don't even expect this to be merged at all, my main intention was to experiment, see how VVV will behave ( especially the provision part ) if i do use it with docker in certain way ( monolithic way ), and push my self to make it somewhat usable, and hopefully some good things get picked up after that. As for services based containers ( docker-compose kind of ? ), that seems like the standard / ideal way in docker world. Although for development, based on my own personal experience, i can't say that i am comfortable with multi containers, having to interact with different container for different task is tedious. e.g. when i need to interact with mysql i need to go to mysql container, but if i wanna quick modify nginx config i need to interact with nginx container and so on. Meanwhile in development phase, these kind of tasks are often needed to be done and done quickly. Again, its just me. I am not familiar and not get used to it. One of the nice thing i love about VVV / vagrant, is that PS: i really got great input and insights from here, thanks a lot for doing it! |
…-Vagrants/develop Release 3.8.1
# Conflicts: # config/homebin/vagrant_provision # config/homebin/vagrant_up # provision/core/env/provision.sh # provision/core/mailhog/provision.sh # provision/core/mariadb/provision.sh # provision/core/nginx/config/nginx.conf # provision/provision-helpers.sh # provision/provision.sh
# Conflicts: # Vagrantfile
…beta # Conflicts: # README.md # provision/provision-helpers.sh
if [ "${VVV_DOCKER}" != 1 ]; then | ||
check_mysql_root_password | ||
fi | ||
|
||
# MySQL gives us an error if we restart a non running service, which | ||
# happens after a `vagrant halt`. Check to see if it's running before | ||
# deciding whether to start or restart. | ||
if [ $(service mariadb status|grep 'mysql start/running' | wc -l) -ne 1 ]; then | ||
if [ $(service mariadb status|grep 'Uptime' | wc -l) -ne 1 ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't work on Parallels based VMs and maybe others, would it not be better to check for running
or active
?
if [ "${VVV_DOCKER}" != 1 ]; then | ||
service mailhog restart | ||
fi | ||
killall mailhog; /usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if you run sudo service mailhog restart
on the docker VM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at the moment it saysmailhog: unrecognized service
vagrant@vvv:~$ sudo service mailhog restart
mailhog: unrecognized service
vagrant@vvv:~$
@@ -1,7 +1,7 @@ | |||
# Create the unit tests DB. | |||
CREATE DATABASE IF NOT EXISTS `wordpress_unit_tests`; | |||
GRANT ALL PRIVILEGES ON `wordpress_unit_tests`.* TO 'wp'@'localhost' IDENTIFIED BY 'wp'; | |||
GRANT ALL PRIVILEGES ON `wordpress_unit_tests`.* TO 'wp'@'192.168.50.1' IDENTIFIED BY 'wp'; | |||
GRANT ALL PRIVILEGES ON `wordpress_unit_tests`.* TO 'wp'@'192.168.56.1' IDENTIFIED BY 'wp'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could these lines co-exist rather than requiring an IP change? Is there a specific reason the IP is needed? E.g. for external use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be honest i dont know what should be the correct one here, i think the only reason i changed it is we changed the default private ip network here: 39ee551
adding both / co-exists also fine
GRANT ALL PRIVILEGES ON `wordpress_unit_tests`.* TO 'wp'@'192.168.50.1' IDENTIFIED BY 'wp';
GRANT ALL PRIVILEGES ON `wordpress_unit_tests`.* TO 'wp'@'192.168.56.1' IDENTIFIED BY 'wp';
not sure if thats the correct thing though.
external use, no. and its not required by / related with docker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah in that case lets kill the 50.1
line, but I wouldn't expect local loopback to go over that network inside the container
vvv_info " * Restarting PHP-FPM" | ||
find /etc/init.d/ -name "php*-fpm" -exec bash -c 'sudo service "$(basename "$0")" restart' {} \; | ||
|
||
vvv_info " * Restarting Memcache" | ||
sudo service memcached restart | ||
|
||
vvv_info " * Restarting Mailhog" | ||
/usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 & | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these could be separate functions so that we don't have to introduce docker specifics in these files, and can put them all in one place without duplication
@pentatonicfunk I've started a PR to see what more I can merge into VVV core, and left some more comments to try and clarify or suggest some things, I'm a little strapped for time today but intend to give this a proper run test sometime this week |
thanks @tomjn, i'll try to update my repo as per your suggestions |
@pentatonicfunk I've started #2632 as I couldn't modify this branch, and merged some changes and made others compatible with non-docker. Would you like to continue there if I add you as a repo member? We're not far from getting this in and it's a big milestone |
yes for sure |
closing this as we have #2632 |
I don't expect to merge this PR as we'll create new PRs that take subsets of it out, or implement it differently. This will be similar to when we had M1 support, eventually this PR will have little to nothing in it and we can declare success!
Checks
develop
branch not thestable
branch.