2

I'm working on a Magento Cloud project after a other developers left it and I'm having a hard time figuring out the development cycle. I can change files on a branch and commit the changes, causing a build/deploy on the cloud environment, but every branch is on production mode with the filesystems being readonly and I don't know how to revert this, even on a new branch.

I tried changing the mode in app/etc/env.php, but that causes an error during the deploy: [2022-10-03 15:07:49] ERROR: [11] The command "php ./bin/magento module:enable --all --ansi --no-interaction" failed. In Abstract.php line 144:

  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name o  
  r service not known                                                          
                                                                               

In Abstract.php line 128:
                                                                               
  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name o  
  r service not known                                                          
                                                                               

In Abstract.php line 128:
                                                                               
  PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Name or s  
  ervice not known                                                             
                                                                               
W: 
W: In Processor.php line 129:
W:                                                                                
W:   The command "php ./bin/magento module:enable --all --ansi --no-interaction"  
W:    failed. In Abstract.php line 144:                                 
W:                                                                        
W:                                                                        
W:     SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo fail  
W:   ed: Name o                                                           
W:     r service not known                                                
W:                                                                        
W:                                                                        
W:                                                                        
W:                                                                                
W:   In Abstract.php line 128:                                          
W:                                                                        
W:                                                                        
W:     SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo fail  
W:   ed: Name o                                                           
W:     r service not known                                                
W:                                                                        
W:                                                                        
W:                                                                        
W:                                                                                
W:   In Abstract.php line 128:                                          
W:                                                                        
W:                                                                        
W:     PDO::__construct(): php_network_getaddresses: getaddrinfo failed:  
W:    Name or s                                                           
W:     ervice not known                                                   
W:                                                                        
W:                                                                        
W:                                                                        
W:                                                                                
W: 
W: In RefreshModules.php line 63:
W:                                                                                
W:   The command "php ./bin/magento module:enable --all --ansi --no-interaction"  
W:    failed. In Abstract.php line 144:                                 
W:                                                                        
W:                                                                        
W:     SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo fail  
W:   ed: Name o                                                           
W:     r service not known                                                
W:                                                                        
W:                                                                        
W:                                                                        
W:                                                                                
W:   In Abstract.php line 128:                                          
W:                                                                        
W:                                                                        
W:     SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo fail  
W:   ed: Name o                                                           
W:     r service not known                                                
W:                                                                        
W:                                                                        
W:                                                                        
W:                                                                                
W:   In Abstract.php line 128:                                          
W:                                                                        
W:                                                                        
W:     PDO::__construct(): php_network_getaddresses: getaddrinfo failed:  
W:    Name or s                                                           
W:     ervice not known                                                   
W:                                                                        
W:                                                                        
W:                                                                        
W:                                                                                
W: 
W: In Shell.php line 86:
W:                                                                                
W:   The command "php ./bin/magento module:enable --all --ansi --no-interaction"  
W:    failed. In Abstract.php line 144:                                 
W:                                                                        
W:                                                                        
W:     SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo fail  
W:   ed: Name o                                                           
W:     r service not known                                                
W:                                                                        
W:                                                                        
W:                                                                        
W:                                                                                
W:   In Abstract.php line 128:                                          
W:                                                                        
W:                                                                        
W:     SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo fail  
W:   ed: Name o                                                           
W:     r service not known                                                
W:                                                                        
W:                                                                        
W:                                                                        
W:                                                                                
W:   In Abstract.php line 128:                                          
W:                                                                        
W:                                                                        
W:     PDO::__construct(): php_network_getaddresses: getaddrinfo failed:  
W:    Name or s                                                           
W:     ervice not known                                                   
W:                                                                      

How can I create a new branch in developer mode? And can I enable a module in this readonly filesystem? Setting the module status to 1 in app/etc/config.php didn't work.

2 Answers 2

1

With Magento Cloud there should not really be any need to touch your env.php file except in rare cases. Additionally you should not be changing the mode of your cloud environments, they should remain in production mode.

I don't think I have seen the php_network_getaddresses errors in a cloud deployment before. It looks like there is an issue connecting to the database server, are all the connection fields correct?

To answer your questions:

How can I create a new branch in developer mode

You are not able to run branches in developer mode, any development work should be done on your local machine.

Can I enable a module in this readonly filesystem

Enabling a module should be done on your local development system, then you should commit your changes to your config.php file to git and trigger a deploy. It can't be done directly on cloud as Magento needs to build generated code such as interceptors, extension attribute classes, etc and this requires a writeable filesystem.

You can create a writeable directory if needed by adding an entry under mounts: in .magento.app.yaml but the default configuration should be fine for 99% of use cases.

I would recommend you take a look at the Magento Cloud Developer Documentation. If you have not worked with Cloud before it is a lot to take on at first. My #1 suggestion would be to make sure you have access to create support tickets by the project owner as there are some tasks that only support can do. Secondly if the site has not launched yet I would strongly recommend you configure Fastly and make sure it's working ASAP.

0

How can I create a new branch in developer mode?

You cannot create a branch in developer mode on a cloud env. But you can use MCD (Magento Cloud Docker) on your local machine. MCD emulates a cloud environment and supports production and developer modes.

https://github.com/magento/magento-cloud-docker

https://devdocs.magento.com/cloud/docker/docker-development.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.