This is the Docker abstraction you're looking for
Jimmy Candan /jənˈdən/
Software developer 9 yrs
From L.A., live in Chattanooga
Web App development
Drupal workflow rescues
Technology strategy
You
Want
Docker
Competing Priorities
- Client Budgets and Timelines
- Juggling Multiple Projects
- DevOps Uniformity
What is Lando?
Lando is for developers who want to quickly specify and painlessly spin up the services and tools needed to develop their projects.
With Lando you can . . .
- Easily mimic production environment locally
- Standardize team dev environments on
- OSX
- Windows
- Linux
- Version control environment config
- Easily customize or extend tooling
What We'll Cover
- Lando Basics
- Installing Lando
- Lando-ifying a ____________ repo
- Customizing your Lando App
Lando in CI
Lando Basics
-
Simple, in-repo config file:
-
Recipes: sensibly preconfigured stacks
-
Add services & tools (e.g. Solr, node)
-
Build and automation steps
-
Local dev dependency management
.lando.yml
Prebaked recipes
Configurable & Swappable Services
apache
compose
dotnet
elasticsearch
go
mailhog
mariadb
memcached
mongo
mssql
mysql
nginx
node
php
phpmyadmin
postgres
python
redis
ruby
solr
tomcat
varnish
Installing Lando
MACOS
homebrew or
.dmg via direct download
LINUX
.deb, .pkg.xz or .rpm package via direct download
Lando-ify
# @file .lando.yml
name: bat-crm
recipe: laravel
config:
webroot: public
$ lando init --recipe laravel --webroot public --name Bat\ CRM
$ lando
Usage: lando <command> [args] [options] [-- global options]
Commands:
artisan Run artisan commands
composer Run composer commands
config Display the lando configuration
db-export [file] Export database from a service
db-import [file] Import <file> into database service
destroy [appname] Destroy app in current directory or [appname]
info [appname] Prints info about app in current directory or [appname]
init [method] Initialize a lando app, optional methods: github, pantheon
laravel Run laravel commands
list List all lando apps
logs [appname] Get logs for app in current directory or [appname]
mysql Drop into a MySQL shell on a database service
php Run php commands
poweroff Spin down all lando related containers
rebuild [appname] Rebuilds app in current directory or [appname]
restart [appname] Restarts app in current directory or [appname]
share [appname] Get a publicly available url
ssh [appname] [service] SSH into [service] in current app directory or [appname]
start [appname] Start app in current directory or [appname]
stop [appname] Stops app in current directory or [appname]
version Display the lando version
Global Options:
--help, -h Show help
--verbose, -v, -vv, -vvv, -vvvv Change verbosity of output
You need at least one command before moving on
$ lando init --recipe laravel --webroot public --name Bat\ CRM
"NOW WE'RE COOKING WITH FIRE!!!"
Your app has been initialized!
Go to the directory where your app was initialized and run
"lando start" to get rolling.
Check the LOCATION printed below if you are unsure where to go.
Here are some vitals:
"""
NAME bat-crm
LOCATION /Users/jcandan/Code/sandbox/batman-crm
RECIPE laravel
DOCS https://docs.devwithlando.io/tutorials/laravel.html
"""
$ ls -la
total 8
drwxr-xr-x@ 3 jcandan staff 96B Aug 13 20:56 .
drwxr-xr-x 13 jcandan staff 416B Aug 13 20:56 ..
-rw-r--r--@ 1 jcandan staff 56B Aug 13 20:56 .lando.yml
$ lando start
BOOMSHAKALAKA!!!
Your app has started up correctly.
Here are some vitals:
NAME batcrm
LOCATION /Users/jcandan/Code/sandbox/batman-crm
SERVICES appserver, database
APPSERVER URLS https://localhost:32771
http://localhost:32772
http://batcrm.lndo.site
https://batcrm.lndo.site
$ lando laravel new batman-crm
$ lando laravel new batman-crm
Crafting application...
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
1/66: https://codeload.github.com/sebastianbergmann/php-file-iterator/legacy.zip/cecbc684605bb0cc288828eb5d65d93d5c676d3c
2/66: https://codeload.github.com/sebastianbergmann/code-unit-reverse-lookup/legacy.zip/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18
3/66: https://codeload.github.com/theseer/tokenizer/legacy.zip/cb2f008f3f05af2893a87208fe6a6c4985483f8b
4/66: https://codeload.github.com/sebastianbergmann/php-text-template/legacy.zip/31f8b717e51d9a2afca6c9f046f5d69fc27c8686
5/66: https://codeload.github.com/phar-io/version/legacy.zip/45a2ec53a73c70ce41d55cedef9063630abaf1b6
6/66: https://codeload.github.com/sebastianbergmann/php-timer/legacy.zip/8b8454ea6958c3dee38453d3bd571e023108c91f
7/66: https://codeload.github.com/phpspec/prophecy/legacy.zip/4ba436b55987b4bf311cb7c6ba82aa528aac0a06
8/66: https://codeload.github.com/phar-io/manifest/legacy.zip/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4
9/66: https://codeload.github.com/myclabs/DeepCopy/legacy.zip/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8
. . .
Generating optimized autoload files
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
> @php artisan key:generate
Application key [base64:ccpYW9tAiUXAYs/eYxFlafchos8y9VZwcUd2OtMVAdI=] set successfully.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: nunomaduro/collision
Package manifest generated successfully.
Application ready! Build something amazing.
$
$ ls -la
total 8
drwxr-xr-x@ 4 jcandan staff 128B Aug 13 21:11 .
drwxr-xr-x 13 jcandan staff 416B Aug 13 20:56 ..
-rw-r--r--@ 1 jcandan staff 56B Aug 13 20:56 .lando.yml
drwxr-xr-x 25 jcandan staff 800B Aug 13 21:12 batman-crm
$
$ ls -la
total 8
drwxr-xr-x@ 4 jcandan staff 128B Aug 13 21:11 .
drwxr-xr-x 13 jcandan staff 416B Aug 13 20:56 ..
-rw-r--r--@ 1 jcandan staff 56B Aug 13 20:56 .lando.yml
drwxr-xr-x 25 jcandan staff 800B Aug 13 21:12 batman-crm
$ mv .lando.yml batman-crm/
$
$ ls -la
total 8
drwxr-xr-x@ 4 jcandan staff 128B Aug 13 21:11 .
drwxr-xr-x 13 jcandan staff 416B Aug 13 20:56 ..
-rw-r--r--@ 1 jcandan staff 56B Aug 13 20:56 .lando.yml
drwxr-xr-x 25 jcandan staff 800B Aug 13 21:12 batman-crm
$ mv .lando.yml batman-crm/
$ cd batman-crm
$
$ ls -la
total 8
drwxr-xr-x@ 4 jcandan staff 128B Aug 13 21:11 .
drwxr-xr-x 13 jcandan staff 416B Aug 13 20:56 ..
-rw-r--r--@ 1 jcandan staff 56B Aug 13 20:56 .lando.yml
drwxr-xr-x 25 jcandan staff 800B Aug 13 21:12 batman-crm
$ mv .lando.yml batman-crm/
$ cd batman-crm
$ lando restart
$ ls -la
total 8
drwxr-xr-x@ 4 jcandan staff 128B Aug 13 21:11 .
drwxr-xr-x 13 jcandan staff 416B Aug 13 20:56 ..
-rw-r--r--@ 1 jcandan staff 56B Aug 13 20:56 .lando.yml
drwxr-xr-x 25 jcandan staff 800B Aug 13 21:12 batman-crm
$ mv .lando.yml batman-crm/
$ cd batman-crm
$ lando restart
Killing batcrm_appserver_1 ... done
Killing batcrm_database_1 ... done
landoproxyhyperion5000gandalfedition_proxy_1 is up-to-date
Recreating batcrm_appserver_1 ... done
Recreating batcrm_database_1 ... done
Waiting until appserver service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
BOOMSHAKALAKA!!!
Your app has started up correctly.
Here are some vitals:
NAME batcrm
LOCATION /Users/jcandan/Code/sandbox/batman-crm
SERVICES appserver, database
APPSERVER URLS https://localhost:32785
http://localhost:32786
http://batcrm.lndo.site
https://batcrm.lndo.site
$
$ ls -la
# @file .env
APP_URL=http://batcrm.lndo.site
DB_HOST=database
DB_DATABASE=laravel
DB_USERNAME=laravel
DB_PASSWORD=laravel
# @file .env
APP_URL=http://localhost
DB_HOST=127.0.0.1
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
$ lando artisan migrate
$ lando info
$ lando info
{
"appserver": {
"type": "php",
"version": "7.1",
"hostnames": [
"appserver",
"appserver.batcrm.internal"
],
"via": "apache",
"webroot": "public",
"config": {
"conf": "/Users/jcandan/.lando/services/config/laravel/php.ini"
},
"urls": [
"https://localhost:32785",
"http://localhost:32786",
"http://batcrm.lndo.site",
"https://batcrm.lndo.site"
]
},
"database": {
"type": "mysql",
"version": "5.7",
"hostnames": [
"database",
"database.batcrm.internal"
],
"creds": {
"user": "laravel",
"password": "laravel",
"database": "laravel"
},
"internal_connection": {
"host": "database",
"port": 3306
},
"external_connection": {
"host": "localhost",
"port": "32787"
},
"config": {
"confd": "/Users/jcandan/.lando/services/config/laravel/mysql"
},
"urls": []
}
}
$
Customize it
-
Front end tooling (node, npm, grunt)
-
Build steps (auto composer install)
-
Additional commands (phplint)
-
Additional services (phpmyadmin/mailhog)
-
Automation (do X after Y)
# @file .lando.yml
name: bat-crm
recipe: laravel
config:
webroot: public
# @file .lando.yml
name: bat-crm
recipe: laravel
config:
webroot: public
database: postgres # defaults to mariadb
# @file .lando.yml
name: bat-crm
recipe: laravel
config:
webroot: public
database: postgres
xdebug: true
# @file .lando.yml
name: bat-crm
recipe: laravel
config:
webroot: public
database: postgres
xdebug: true
services:
appserver:
run:
- "echo 'running composer install'"
- "cd $LANDO_MOUNT && composer install"
# @file .lando.yml
name: bat-crm
recipe: laravel
config:
webroot: public
database: postgres
xdebug: true
services:
appserver:
run:
- "echo 'running composer install'"
- "cd $LANDO_MOUNT && composer install"
node:
type: node:9
run:
- "echo 'running npm install and laravel mix'"
- "cd $LANDO_MOUNT && npm install && npm run dev"
# @file .lando.yml
name: bat-newsroom
recipe: drupal8
config:
webroot: web
# @file .lando.yml
name: bat-newsroom
recipe: drupal8
config:
webroot: web
database: postgres
xdebug: true
services:
appserver:
run:
- "echo 'running composer install'"
- "cd $LANDO_MOUNT && composer install"
# @file .lando.yml
name: bat-newsroom
recipe: drupal8
config:
webroot: web
database: postgres
xdebug: true
services:
appserver:
run:
- "echo 'running composer install'"
- "cd $LANDO_MOUNT && composer install"
node:
type: node:9
run:
- "echo 'running npm install and gulp'"
- "cd $LANDO_MOUNT/themes/custom/bat-theme && npm install"
- "cd $LANDO_MOUNT/themes/custom/bat-theme && ./node_modules/gulp/bin/gulp.js"
# @file .lando.yml
name: bat-newsroom
recipe: drupal8
config:
webroot: web
database: postgres
xdebug: true
services:
appserver:
run:
- "echo 'running composer install'"
- "cd $LANDO_MOUNT && composer install"
node:
type: node:9
run:
- "echo 'running npm install and gulp'"
- "cd $LANDO_MOUNT/themes/custom/bat-theme && npm install"
- "cd $LANDO_MOUNT/themes/custom/bat-theme && ./node_modules/gulp/bin/gulp.js"
globals:
gulp-cli: "latest"
# @file .lando.yml
name: bat-newsroom
recipe: drupal8
config:
webroot: web
database: postgres
xdebug: true
services:
appserver:
run:
- "echo 'running composer install'"
- "cd $LANDO_MOUNT && composer install"
node:
type: node:9
run:
- "echo 'running npm install and gulp'"
- "cd $LANDO_MOUNT/themes/custom/bat-theme && npm install"
- "cd $LANDO_MOUNT/themes/custom/bat-theme && ./node_modules/gulp/bin/gulp.js"
globals:
gulp-cli: "latest"
events:
post-db-import:
- appserver: cd $LANDO_WEBROOT && drush cr -y
Resources
-
Website: devwithlando.io
-
Docs: docs.devwithlando.io
-
Github: github.com/lando/lando
-
Slack Channel: slackpass.io/kalabox
Q & A
This is the Docker abstraction you're looking for
By James Candan
This is the Docker abstraction you're looking for
- 1,271