I'm testing "b" for the first time in preparation for our Virtual User Group next week (Command Line Tools for BackdropCMS). 

It seems to be working on a high level. I was able to download a copy of Backdrop with b. 

However, I'm not sure how to use it with Lando. Any commands that require access to the database seem to generate "The required bootstrap level is not ready" errors. 

I assume this is because I am not using "b" from with Lando and it doesn't know how to access to the Lando based database container. But, I could be wrong. 

Here a sample message I get:

 [-] Backdrop has not yet been installed.                    
 [-] 'Debug' mode enabled.                                   
 [✘] The required bootstrap level for 'enable' is not ready.

For those who are not aware of "b", it is a command line tool similar to drush that has been written specifically for BackdropCMS. https://backdropcms.org/project/b


BWPanda's picture

Are you running commands using lando b? Do you run them from the normal command line where you started lando from, or do you SSH into the lando service first? What version of 'b' are you using?


Can I ask a naive question from someone who is not a developer: why do you need such a tool? What is the added value?


@philippeg - This is a great question. We are very much building Backdrop CMS for users that don't necessarily need tools like "b" or "drush." If you are working on a single site a tool like "b" or "drush" might not be worth the time to learn and is definitely not required. 

But, for core developers and developers that work on lots of Backdrop CMS sites, command line tools offer quicker ways of accomplishing what can become very repetitive tasks. These tools also provide opportunities to write scripts that perform these repetitive tasks for us. 

I sometimes create 3-4 new Backdrop CMS installations per day on my local laptop, sometimes even more. Once, I've created these sites I need to install certain modules and quickly generate a new user account with a password. This is all MUCH faster using a quick command on the command line than it is to work through the user interface. 

When I first started working with Drupal, I was very reluctant to learn Drush. However, once I did start using it, I really loved it. But, again these tools are intended for developers that do lots of repetitive tasks and are not necessarily for everyone. You shouldn't feel any pressure to learn them. But, if you do spend a lot of time developing Backdrop sites, I really encourage you to at least learn about command line tools and maybe give them a try.

@BWPanda - No, I'm not ssh'ing into Lando. I'm using the regular command line. I tried running `lando b` and got no reponse, but I assume that is because I have not included `b` as part of my Lando recipe.

I'm not sure how to add `b` as part of my Lando recipe. 

Should I be ssh'ing into Lando?

BWPanda's picture

I'm not sure how to add `b` as part of my Lando recipe.

Ah, right. Of course. I've just been working on adding a default Lando config file to `b` (to help with `b`s development), so I'd forgotten that people will want to use `b` with their existing Lando setups. I've made an issue to add these instructions to the repo (somewhere) to help in future, but I'll put some info here too.

It should just be a matter of making sure your Lando file has these sections:

      # Install Backdrop Console (`b`).
      - wget -qO b.zip https://github.com/backdrop-contrib/b/archive/1.x-1.x.zip
      - unzip -q b.zip && rm b.zip
      - mv b-1.x-1.x /usr/local/bin/b
    service: appserver
    cmd: /usr/local/bin/b/b.php

The 'services' part downloads the latest (dev) version of `b` and extracts it to /usr/local/bin/b.

The 'tooling' part is what allows you to simply write lando b in the console in order to use `b` (i.e. instead of calling /usr/local/bin/b/b.php).

Please do let me know if these instructions work, or if they can be tweaked/clarified.

@BWPanda - I think your instructions would have worked fine, if I hadn't tried to outsmart them. I thought for a second that the services part of the file was going to install `b` in the /user/local/bin directory of my local computer and I had already done that, so I left that part out. That did not work.

What should have been clear to me was that it was installing `b` in the /user/local/bin directory of the container. 

So, once I used all of the code you provided, it worked and I now have `b` running in Lando.

Thanks you very much for your work on `b`.

klonos's picture

I have been using only drush + the Backdrop extension for drush with lando, and it's been working fine for what I need it (automating the repetitive creation and tear-down of my many local sandboxes). But I do plan to start including that b recipe in my local build tools, and start comparing drush vs b, so thank you @BWPanda 🙏

My plan is to eventually learn more about b, why there is need for it to exist when drush is already available, and also whether it offers more/less or the same command coverage as drush. So really looking forward for that upcoming Virtual User Group meeting 🙂

It's my assumption that "b" will be better than drush, just because it will get more support for Backdrop in the future. Isn't the backdrop extension of drush pretty much limited to deprecated versions of drush that no longer get support?

I am looking forward to the Virtual User Group next week, to ask questions like that one.