Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
1.10 MyBB CLI Tools
#1
This has been on my radar for some time now. There are many reasons why some kind of CLI system (mybbctl) would be useful for board administrators if it included installation, upgrade and maintenance tools. Personally I'm interested in the ability to rapidly automate the deployment of MyBB instances using Docker, which is something we've more or less accomplished already with the recently released Dockerfile and Docker Compose recipe for MyBB 1.8. The only issue is that automating version upgrades (or the entire install procedure) in the current form would be difficult or be a hacky solution at best.

I proposed something a little bit like this to Euan a few weeks back as a POC. Here's an example of how a fresh installation could work. I have not included all of the possible variables or command flag parameters:

mybbctl install --destination /var/www/html \
--database-host localhost \
--database-user mybb \
--database-password p4ssw0rd \
--database mybb --database-prefix mybb_ \
--admin-user administrator --admin-password p4ssw0rd

I couldn't think of a good syntax for version upgrades, but you get the idea:

mybbctl upgrade --update-from 1812 --update-to 1813 --destination /var/www/html

The question of whether mybbctl is a PHP script (which you would execute using the PHP CLI i.e. /usr/bin/php mybbctl) or an actual binary is not something I've yet considered. Feedback from other board owners with relevant sysadmin experience or anyone interested in automation in general would be greatly appreciated, thanks. Big Grin
Reply
#2
IMO it would have to be a PHP script similar to Laravel’s Artisan. This would allow plugins to add functionality to the CLI app.
Reply
#3
(12-01-2017, 08:26 PM)Euan T Wrote: IMO it would have to be a PHP script similar to Laravel’s Artisan. This would allow plugins to add functionality to the CLI app.

Speaking of plugins, I wonder if plugin authors could optionally include some kind of manifest file within their projects and mybbctl could potentially install plugins from the mods site automatically? Blush

mybbctl plugin --install --pid 29 --destination /var/www/html
Reply
#4
Support. Could also be a method to automated upgrades especially for diff and important security upgrades.
Reply
#5
(12-01-2017, 08:38 PM)kawaii Wrote:
(12-01-2017, 08:26 PM)Euan T Wrote: IMO it would have to be a PHP script similar to Laravel’s Artisan. This would allow plugins to add functionality to the CLI app.

Speaking of plugins, I wonder if plugin authors could optionally include some kind of manifest file within their projects and mybbctl could potentially install plugins from the mods site automatically? Blush

mybbctl plugin --install --pid 29 --destination /var/www/html

I believe theme author should also get some type of CLI so that they can do upgrades to theme using a simple script.
Reply
#6
(12-01-2017, 08:38 PM)kawaii Wrote:
(12-01-2017, 08:26 PM)Euan T Wrote: IMO it would have to be a PHP script similar to Laravel’s Artisan. This would allow plugins to add functionality to the CLI app.

Speaking of plugins, I wonder if plugin authors could optionally include some kind of manifest file within their projects and mybbctl could potentially install plugins from the mods site automatically? Blush

mybbctl plugin --install --pid 29 --destination /var/www/html

In the glorious future, plugins could be distributed as Composer packages, so the CLI could add them to the composer file, fetch them and run the install/activate actions.

Other potentially useful features I can think of off the top of my head:
  • Put the board into maintenance mode manually
  • Refresh/reload caches
  • File verification
  • Running tasks (already possible to run tasks as cron jobs, but wrapping it into the CLI would be nice)
  • Importing/exporting theme
  • Creating skeleton templates for plugins/themes (eg: can scaffold hooks and such)
Reply
#7
Quote:Put the board into maintenance mode manually

I'd like this because for the 10 minutes my forum does a daily DB backup the site acts funny. It would be nice to have a simple CLI command to add to the cron script that closed the site then opened it when it was done.
Reply
#8
(12-01-2017, 10:50 PM)labrocca Wrote:
Quote:Put the board into maintenance mode manually

I'd like this because for the 10 minutes my forum does a daily DB backup the site acts funny. It would be nice to have a simple CLI command to add to the cron script that closed the site then opened it when it was done.

Extremely valid use-case, I am fairly certain you could script this by snipping code and the relevant SQL query into a standalone PHP script but having this feature built into a single Swiss Army knife-like tool would be ideal. Some of the features that Euan mentioned are also excellent suggestions - there are a lot of possibilities I hadn't even thought of myself.
Reply
#9
Why call it mybbctl? Just have a mybb command.
Reply
#10
(12-01-2017, 11:17 PM)Azah Wrote: Why call it mybbctl? Just have a mybb command.

Named after tools such as systemctl and journalctl, which is the basically the new naming scheme in Linux distributions for controlling different aspects of the operating system.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)