meaning of incompatible change
- The location of the database IP (127.0.0.1) on the env of the old original Laravel project needs to be changed to the service name (db) of the MySQL container.
DB_HOST=db
- If you have a custom nginx configuration file, you need to adjust the connection method of php-fpm.
fastcgi_pass php:9000;
-If you have a custom docker-compose-custom.yml that needs to be adjusted to the new one.
When you update directly to v1.0.0 with git pull:
You need to modify the .env file on the old Laravel project, change
DB_HOST=127.0.0.1
to DB_HOST=db
If you have a custom docker-compose-custom.yml file,
Please use docker-compose-normal or docker-compose-random as a template for modification.
About this change:
Therefore, in terms of settings, we connect to php-fpm and mysql using the IP address of the local machine connected to the loopback: 127.0.0.1.
The new setting of v1.0.0 is to change the yaml file of docker-compose to use networks . We can think of it as three container services ( web , php and db ) added to the customized network.
So the web container (that is, nginx) service needs to use php-fpm to specify the service name of the php container. (here called php )
Below is the fragment of etc/default.conf, the original fastcgi_pass
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_read_timeout 500;
}
The new version create bash, for example: when using the project ./create test1,The original DB_HOST=127.0.0.1 will be automatically changed to DB_HOST=db in the new version (v1.0.0) .
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=test1
DB_USERNAME=homestead
DB_PASSWORD=secret
Old version (before v1.0.0) updated to new version (v1.0.0)
For a safe update method, we can grab D-Laravel v1.0.0 and test it.Copy the project in the sites/ of the old version to the sites/ of the new version v.1.0.0.
The folder data/ containing the data is copied to the directory of v1.0.0.
( Please confirm that the new version of docker-compose.yml uses the same DB image version as the old version,
A mysql image with too much difference will cause the DB container to fail to start)
And modify the .env file of the laravel project in sites/, change DB_HOST=127.0.0.1 to DB_HOST=db
There must be port overflow, we can stop the old version of D-Laravel,
Restart the v1.0.0 version of d-laravel to confirm whether it works normally.
No Comment
Post your comment