ByteInternet / hypernode-docker

Fast and easy Docker for Magento development
https://community.hypernode.io/hypernode-docker
35 stars 9 forks source link

Upgrade or switch to mySQL 5.7 with buster latest #49

Open Aquive opened 3 years ago

Aquive commented 3 years ago

Hi,

I am using docker.hypernode.com/byteinternet/hypernode-buster-docker:latest image. How would I switch or upgrade to mySQL 5.7?

I know there are specific images for specific php and mysql version. But I need to work with the generic one since I am working on an upgrade of a Magento store which needs php 7.0 to run in the first place.

vdloo commented 3 years ago

Hey, we have a specific one that's both PHP 7.0 and MySQL 5.7: docker pull docker.hypernode.com/byteinternet/hypernode-buster-docker-php70-mysql57:latest. Won't that address your issue? Otherwise you could try doing something like # apt-get install percona-server-server-5.7 from either SSH or the Dockerfile. If you install it manually you might need to mess a bit with /etc/mysql/conf.d/mysql-master.cnf to get it to run because for example the innodb_additional_mem_pool_size setting was deprecated in MySQL 5.6 and removed in 5.7. But I'd go with the hypernode-buster-docker-php70-mysql57 image.

Aquive commented 3 years ago

Thank you for your reply. Since I am upgrading from M2.1 to 2.4 switching of PHP and mySQL would have been more than welcome. I managed to bypass it to do the composer upgrade in one docker. And proceed with database stuff in another one. As you can imagine it is far from ideal.

Are there plans to be able to switch versions in one docker container?

vdloo commented 3 years ago

In the old hypernode-vagrant we had a command like hypernode-switch-php with which you could switch to a different PHP version and back easily. But in the Docker we decided that that wasn't a good approach because we need the images somewhat lightweight. If we install too much in one version of the container it's going to take too long for people to download, systems like Kubernetes will start to get confused, etc. Docker isn't really meant to be used as a VM or a fat container like we do. It's super convenient but there's some limits to how wise it is to put a lot of things in one container. That's why we came up with the idea of instead just building a lot of different images based on different configurations (php versions / mysql versions).

You could always of course inside the container apt-get install whatever PHP or MySQL version you need and switch that back and forth, but on real Hypenodes we do some additional tweaking with the config files if the version is switched so your testing might not be 100% representative then for the production environment.

Have you considered just running 2 Docker containers? One with an older PHP / MySQL version and one with the newer version? I don't use Docker every day for development but I imagine you can mount 1 storage volume on multiple containers (maybe something like this: https://www.digitalocean.com/community/tutorials/how-to-share-data-between-docker-containers).

You could even go so far as to run multiple hypernode-buster-docker instances and expose the database port of the one Docker to the other so that you can from inside the Docker in which you run the Magento application in PHP connect to the database on the other container. Then for testing it's just a matter of editing your app/etc/env.php for the database connection host.

Aquive commented 3 years ago

Thanks for the suggestions. In the Ubuntu docker we used to switch Magento versions by editing /etc/my_init.d/60_restart_services.sh that worked great. Something similar for mySQL would be awesome. Or maybe an automatic installer script (for us as developers).

My issue is resolved. So this can be closed.