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

Rebuild single service runs all build steps for the appserver #596

Closed
dmsmidt opened this issue Dec 21, 2017 · 8 comments

Comments

Projects
None yet
3 participants
@dmsmidt
Copy link

commented Dec 21, 2017

Bug Report

  • Lando v3.0.0-beta.31 - Docker for Mac 17.12.0-ce-rc3-mac43 (21270) - macOS High Sierra*

When rebuilding a single service all build steps of the appserver are executed. This makes rebuilding a single service slow and sometimes problematic.

name: projectx

# https://docs.devwithlando.io/recipes/drupal7.html
recipe: drupal7

# These are the url's to use for your project. The key, such as nginx, solr, etc,
# are the services that are defined below.
# https://docs.devwithlando.io/config/proxy.html
proxy:
  solr:
    - solr.projectx.localhost:8983

# Add some default configuration for the recipe here. Which will be passed to all the services within the recipe.
# https://docs.devwithlando.io/recipes/drupal7.html
config:
  webroot: web

  # Choose whether to use apache or nginx.
  via: nginx

  php: '7.1'

  # Add custom php.ini for development configuration.
  conf:
    php: config/develop/php/php.ini

services:
  appserver:
    overrides:
       services:
         volumes:
           - /app/documentation/
              - public_files:/app/web/sites/default/files
           - private_files:/app/files/private
    build:
      - "mkdir -p ~/.drush/alias"
      - "ln -sf /app/drush/alias/projectx.aliases.drushrc.php ~/.drush/alias/projectx.aliases.drushrc.php"
      - "drush dl registry_rebuild-7.x drush_language-7.x"

  # https://docs.devwithlando.io/services/solr.html
  solr:
    type: solr:5.5
    portforward: true
    core: projectx
    config:
      conf: config/shared/solr

compose:
 - compose.yml

Example rebuild single service command:

lando rebuild -s solr

Example build output:

Pulling solr (solr:5.5)...
solr uses an image, skipping
landoproxyhyperion5000gandalfedition_proxy_1 is up-to-date
Creating volume "projectx_data_solr" with default driver
Creating projectx_solr_1 ... done
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   599    0   599    0     0   1154      0 --:--:-- --:--:-- --:--:--  1156
100 5912k  100 5912k    0     0  1737k      0  0:00:03  0:00:03 --:--:-- 2675k
 PHP configuration      :                                                
 PHP OS                 :  Linux                                         
 Drush script           :  /tmp/drush.phar                               
 Drush version          :  8.1.15                                        
 Drush temp directory   :  /tmp                                          
 Drush configuration    :                                                

Install location /var/www/.drush/registry_rebuild already exists. Do you want to overwrite it? (y/n): n
Skip installation of registry_rebuild to /var/www/.drush/registry_rebuild.                                                                                                                                                                           [warning]
Install location /var/www/.drush/drush_language already exists. Do you want to overwrite it? (y/n): n
Skip installation of drush_language to /var/www/.drush/drush_language.                                                                                                                                                                               [warning]

As you can see Drush is installed every time (Drupal recipe) and my custom build steps are called.

@davisshaver

This comment has been minimized.

Copy link

commented Dec 22, 2017

This does seem to be the case. I think maybe the CLI was built out before the internals. Relevant guts seem to be in https://github.com/lando/lando/blob/master/lib/app.js.

@pirog pirog self-assigned this Jan 4, 2018

@pirog pirog added the improvement label Jan 4, 2018

@pirog pirog added this to the 3.0.0 milestone Jan 4, 2018

@pirog

This comment has been minimized.

Copy link
Member

commented Jan 6, 2018

@davisshaver yeah that is mostly right. rebuilding individual services wasn't a thing till pretty recently (eg most of the code is written assuming that entire apps will be rebuilt, not their component services) so its very possible that doing something like this is non-trivial.

@pirog

This comment has been minimized.

Copy link
Member

commented Jan 7, 2018

@dmsmidt @davisshaver looks like with some clever use of landos events you can get this working! going to make that change and get it slotted for beta34

pirog added a commit that referenced this issue Jan 7, 2018

@pirog pirog added bug and removed improvement labels Jan 7, 2018

@pirog pirog closed this Jan 7, 2018

@dmsmidt

This comment has been minimized.

Copy link
Author

commented Jan 7, 2018

@pirog, sounds good, gonna test this monday!

@pirog

This comment has been minimized.

Copy link
Member

commented Jan 7, 2018

@davisshaver

This comment has been minimized.

Copy link

commented Jan 7, 2018

sweet! Will do the same.

@davisshaver

This comment has been minimized.

Copy link

commented Jan 11, 2018

Gave this a whirl..

Works well to filter which service gets stopped, but I noticed that appserver:build still gets run even if we do something like lando rebuild -s edge_ssl -y. Would it make sense to scope event calls to the declared service?

@pirog

This comment has been minimized.

Copy link
Member

commented Jan 12, 2018

@davisshaver hmmm, appserver builds/extras should definitely not get run on a rebuild unless you are doing a total rebuild lando rebuild or a rebuild that specifically flags -s appserver. Are you sure you are running the latest code/version?

I think the exception here would be if you are using the post-rebuild event to do other things. In this case we actually don't recommend you use the post-rebuild event since its more or less the same thing as specifying build/extras. I also think we probably don't want to filter out services on events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.