我想我误解了Homestead的工作方式。我想要一个每个项目的安装,但发生了一些奇怪的事情。我的步骤是:
- 运行流浪箱(向上流浪)。创建数据库家园。向上&正在运行
- 停下流浪的箱子
- 从VirtualBox客户端删除框
- 流浪汉又跑上来了。当然,盒子需要下载
-
在"向上"的过程中,我得到了错误:
createdb:数据库创建失败:错误:数据库"家园"已存在
这怎么可能?流浪者会在我的主机中的某个地方创建数据库并将其重复用于不同的安装吗
我的主机是一台Mac OS X机器(El Capitan)。我用生成了Vagrantfile
php vendor/bin/homestead make
我的流浪者档案是:
require 'json'
require 'yaml'
VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))
homesteadYamlPath = "Homestead.yaml"
homesteadJsonPath = "Homestead.json"
afterScriptPath = "after.sh"
aliasesPath = "aliases"
require File.expand_path(confDir + '/scripts/homestead.rb')
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exists? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
end
if File.exists? homesteadYamlPath then
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
elsif File.exists? homesteadJsonPath then
Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath)))
end
if File.exists? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath
end
end
还有我的家园。yaml
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
hostname: laraveltest
name: laraveltest
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: "/Users/jorge/Dev/laraveltest"
to: "/home/vagrant/laraveltest"
sites:
- map: homestead.app
to: "/home/vagrant/laraveltest/public"
databases:
- homestead
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
我发现,如果我以ssh方式进入机器,我必须手动运行以下脚本来运行迁移脚本。
php artisan迁移
不确定为什么宅地安装脚本没有接收到这个迁移脚本。