如何创建正确的.lando.yml自定义文件?

时间:2018-07-24 14:05:52

标签: docker lando

有什么方法可以创建一个正确的,真正自定义的.lando.yml文件,以便它不使用任何配方?如何在Lando中指定“只给我Apache,MariaDB,PHP”?

我尝试过

    # The name of the app
    name: mariadb

    # Give me http://mariadb.lndo.site and https://mariadb.lndo.site
    proxy:
      html:
        - mariadb.lndo.site

    # Set up my services
   services:

  # Set up a basic webserver running the latest nginx with ssl turned on
  html:
    type: nginx
    ssl: true
    webroot: www

  # Spin up a mariadb container called "database"
  # NOTE: "database" is arbitrary, you could just as well call this "db" or "kanye"
  database:

    # Use mariadb version 10.1
    type: mariadb:10.1

    # Optionally allow access to the database at localhost:3307
    # You will need to make sure port 3307 is open on your machine
    #
    # You can also set `portforward: true` to have Lando dynamically assign
    # a port. Unlike specifying an actual port setting this to true will give you
    # a different port every time you restart your app
    portforward: 3307

    # Optionally set the default db credentials
    #
    # Note: You will need to `lando destroy && lando start` to change these if you've
    # already started your app
    # See: https://docs.devwithlando.io/tutorials/lando-info.html
    creds:
      user: mariadb
      password: mariadb
      database: mariadb

    # Optionally load in all the mariadb config files in the config directory
    # This is relative to the app root
    # NOTE: these files need to end in .cnf
    config:
      confd: config

但是在lando start之后,我遇到了ERROR: No such service: appserver错误,并且此文档非常混乱。

谢谢。

1 个答案:

答案 0 :(得分:1)

您需要查看Lando定制项目页面的Building a Custom Stack部分。

我不会完成您的整个项目,但基础知识如下:

# LAMP stack example
name: lamp

proxy:
  appserver:
    - lamp.lndo.site  # Allows you to access the site at http[s]://lamp.lndo.site
                      # This may actually get done automatically

services: # Define your services
  appserver:  # Create a web server container
    type: php:5.3 # Specify what version of php to use
    via: apache   # This could be nginx, should you choose so
    webroot: www  # Specify webroot
    config:  # If you want to add/edit
      server: config/apache/lamp.conf  # Use an alternate apache config file
      conf: path/from/app/root/php.ini # Alter php configuration with a custom file
  database:  # Create a database server container
    type: mysql
    portforward: 3308
    creds:  # Specify what creds/db to use
      user: lamp
      password: lamp
      database: lamp

tooling:  # These toolings allow you to connect land <command> to the appropriate containers
  composer: # Call with "lando composer..."
    service: appserver
    description: Run composer commands
    cmd: composer --ansi
  php:      # Call with "lando php..."
    service: appserver
  mysql:    # Call with "lando mysql..."
    user: root
    service: database
    description: Drop into a MySQL shell