homestead.yaml 文件中的 features 选项 mysql:flase 没效果

homestead.yaml 文件中的 features 选项 mysql:flase 没效果

homestead.yaml 文件中的 features 选项 mysql:flase 没效果

无论是true还是false,改完后也重启了虚拟机,都能访问到数据库

homestead.yaml 文件中的 features 选项 mysql:flase 没效果

mysql 改成 scripts/features/ 目录下的 muysql8 也仍然是这样。

《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
讨论数量: 4

被关闭的 feature 在启动时会提示

homestead: Ignoring feature: xxx because it is set to false

这句话在 homestead.rb 中(省略部分代码)

...
feature_name = feature.keys[0]
feature_variables = feature[feature_name]
feature_path = script_dir + "/features/" + feature_name + ".sh"
...
if feature_variables == false
    config.vm.provision "shell", inline: "echo Ignoring feature: #{feature_name} because it is set to false \n"
...

由此可见 feature 的名字取决于 scripts/features/xxx.sh 的文件名

而我使用的较新的 homesteadmysqlscripts/features/mysql8.sh 管理

我并没有尝试使用 - mysql8: false 来关闭我的 mysql 服务

你可以看下你的目录有没有类似的文件,试一下!

3年前 评论
long0 (楼主) 3年前

@long0 冒号后边好像要空一格,还不行的话试试禁用服务 Homestead《Laravel 8 中文文档》

services:
    - enabled:
        - "postgresql@12-main"
    - disabled:
        - "mysql"
3年前 评论
long0 (楼主) 3年前

@long0

features 主要控制可选服务是否安装,我不知道已安装服务设为 false 会不会被卸载。

features:
    - mysql8: false # 不知道你昨天是不是这么写的

services 主要控制已安装服务是否启动,可选值为服务的实际名称。

所以 mysql8 的服务名称还是 mysqlpostgresql@12-main 是文档中给出的,

好像是由 scripts/features/timescaledb.sh 安装的服务,具体俺也没用过,俺也不知道。


服务控制相关代码也在 homestead.rb

# Enable Services
if settings.has_key?('services')
    settings['services'].each do |service|
    service['enabled'].each do |enable_service|
        config.vm.provision "shell", inline: "sudo systemctl enable #{enable_service}"
        config.vm.provision "shell", inline: "sudo systemctl start #{enable_service}"
    end if service.include?('enabled')

    service['disabled'].each do |disable_service|
        config.vm.provision "shell", inline: "sudo systemctl disable #{disable_service}"
        config.vm.provision "shell", inline: "sudo systemctl stop #{disable_service}"
    end if service.include?('disabled')
    end
end

我的配置文件

features:
    - mariadb: false
    - ohmyzsh: true

services:
    - disabled:
          - "memcached"
          - "postgresql@9.6-main"
          - "postgresql@10-main"
          - "postgresql@11-main"
          - "postgresql@12-main"
3年前 评论
自由与温暖是遥不可及的梦想
$ vagrant reload --provision
3年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!