0

有什么方法可以创建一个正确的、真正自定义的 .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错误并且此文档非常混乱之后。

谢谢。

4

1 回答 1

7

您需要查看lando 自定义项目页面的构建自定义堆栈部分。

我不会做你的整个项目,但基本情况如下:

# 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
于 2018-11-01T19:13:12.170 回答