teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

タグ変更

2019/08/05 12:15

投稿

Ms.yy
Ms.yy

スコア83

title CHANGED
File without changes
body CHANGED
File without changes

2

homestead.yaml追加

2019/08/05 12:15

投稿

Ms.yy
Ms.yy

スコア83

title CHANGED
File without changes
body CHANGED
@@ -99,8 +99,159 @@
99
99
  ### 試したこと
100
100
  vagrantのアンインストール後の再インストール
101
101
 
102
+ エラー部分であるhomestead.yaml3行目の見直し
103
+
104
+ ###app/Homestead/resoureces/Homestead.yaml
105
+ ```ここに言語を入力
106
+ ---
107
+ ip: "192.168.10.10"
108
+ memory: 2048
109
+ cpus: 2
110
+ provider: virtualbox
111
+
112
+ authorize: ~/.ssh/id_rsa.pub
113
+
114
+ keys:
115
+ - ~/.ssh/id_rsa
116
+
117
+ folders:
118
+ - map: ~/code
119
+ to: /home/vagrant/code
120
+
121
+ sites:
122
+ - map: homestead.test
123
+ to: /home/vagrant/code/public
124
+
125
+ databases:
126
+ - homestead
127
+
128
+ features:
129
+ - mariadb: false
130
+ - ohmyzsh: false
131
+ - webdriver: false
132
+
133
+ # ports:
134
+ # - send: 50000
135
+ # to: 5000
136
+ # - send: 7777
137
+ # to: 777
138
+ # protocol: udp
139
+
140
+ ```
141
+
142
+
143
+
144
+ ###app/Homestead/Homestead.yaml
145
+
146
+ ```ここに言語を入力
147
+
148
+ --
149
+ ip: "192.168.10.10"
150
+ memory: 2048
151
+ cpus: 1
152
+ provider: virtualbox
153
+
154
+ authorize: ~/.ssh/id_rsa.pub
155
+
156
+ keys:
157
+ - ~/.ssh/id_rsa
158
+
159
+ folders:
160
+ - map: ~/app
161
+ to: /home/vagrant/Code
162
+
163
+ sites:
164
+ - map: homestead.test
165
+ to: /home/vagrant/Code/Laravel/public
166
+
167
+ databases:
168
+ - homestead
169
+
170
+ # blackfire:
171
+ # - id: foo
172
+ # token: bar
173
+ # client-id: foo
174
+ # client-token: bar
175
+
176
+ # ports:
177
+ # - send: 50000
178
+ # to: 5000
179
+ # - send: 7777
180
+ # to: 777
181
+ # protocol: udp
182
+ ~
183
+ ~
184
+ ~
185
+ ~ memory: 2048
186
+ cpus: 2
187
+ provider: virtualbox
188
+
189
+ authorize: ~/.ssh/id_rsa.pub
190
+
191
+ keys:
192
+ - ~/.ssh/id_rsa
193
+
194
+ folders:
195
+ - map: ~/code
196
+ to: /home/vagrant/code
197
+
198
+ sites:
199
+ - map: homestead.test
200
+ to: /home/vagrant/code/public
201
+
202
+ databases:
203
+ - homestead
204
+
205
+ features:
206
+ - mariadb: false
207
+ - ohmyzsh: false
208
+ - webdriver: false
209
+
210
+ # ports:
211
+ # - send: 50000
212
+ # to: 5000
213
+ # - send: 7777
214
+ # to: 777
215
+ ip: "192.168.10.10"
216
+ memory: 2048
217
+ cpus: 1
218
+ provider: virtualbox
219
+
220
+ authorize: ~/.ssh/id_rsa.pub
221
+
222
+ keys:
223
+ - ~/.ssh/id_rsa
224
+
225
+ folders:
226
+ - map: ~/app
227
+ to: /home/vagrant/Code
228
+
229
+ sites:
230
+ - map: homestead.test
231
+ to: /home/vagrant/Code/Laravel/public
232
+
233
+ databases:
234
+ - homestead
235
+
236
+ # blackfire:
237
+ # - id: foo
238
+ # token: bar
239
+ # client-id: foo
240
+ # client-token: bar
241
+
242
+ # ports:
243
+ # - send: 50000
244
+ # to: 5000
245
+ # - send: 7777
246
+ # to: 777
247
+ # protocol: udp# protocol: udp
248
+
249
+ ```
250
+
251
+
102
252
  ### 補足情報(FW/ツールのバージョンなど)
103
253
 
254
+
104
255
  mac os
105
256
 
106
257
  先ほどまでvagrantは実行できてましたが、laravelの新規プロジェクトを一から生成しようと違うディレクトリに移動した際にvagrantが実行できないことに気づきました。

1

内容追記 vagrantfile

2019/08/05 12:02

投稿

Ms.yy
Ms.yy

スコア83

title CHANGED
File without changes
body CHANGED
@@ -33,7 +33,69 @@
33
33
 
34
34
  ```
35
35
 
36
+ ###vagrantfile
37
+ ```ここに言語を入力
38
+ # -*- mode: ruby -*-
39
+ # vi: set ft=ruby :
36
40
 
41
+ require 'json'
42
+ require 'yaml'
43
+
44
+ VAGRANTFILE_API_VERSION ||= "2"
45
+ confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))
46
+
47
+ homesteadYamlPath = confDir + "/Homestead.yaml"
48
+ homesteadJsonPath = confDir + "/Homestead.json"
49
+ afterScriptPath = confDir + "/after.sh"
50
+ customizationScriptPath = confDir + "/user-customizations.sh"
51
+ aliasesPath = confDir + "/aliases"
52
+
53
+ require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')
54
+
55
+ Vagrant.require_version '>= 2.2.4'
56
+
57
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
58
+ if File.exist? aliasesPath then
59
+ config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
60
+ config.vm.provision "shell" do |s|
61
+ s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases && chown vagrant:vagrant /home/vagrant/.bash_aliases"
62
+ end
63
+ end
64
+
65
+ if File.exist? homesteadYamlPath then
66
+ settings = YAML::load(File.read(homesteadYamlPath))
67
+ elsif File.exist? homesteadJsonPath then
68
+ settings = JSON::parse(File.read(homesteadJsonPath))
69
+ else
70
+ abort "Homestead settings file not found in #{confDir}"
71
+ end
72
+
73
+ Homestead.configure(config, settings)
74
+
75
+ if File.exist? afterScriptPath then
76
+ config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
77
+ end
78
+
79
+ if File.exist? customizationScriptPath then
80
+ config.vm.provision "shell", path: customizationScriptPath, privileged: false, keep_color: true
81
+ end
82
+
83
+ if Vagrant.has_plugin?('vagrant-hostsupdater')
84
+ config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
85
+ elsif Vagrant.has_plugin?('vagrant-hostmanager')
86
+ config.hostmanager.enabled = true
87
+ config.hostmanager.manage_host = true
88
+ config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
89
+ end
90
+
91
+ if Vagrant.has_plugin?('vagrant-notify-forwarder')
92
+ config.notify_forwarder.enable = true
93
+ end
94
+ end
95
+
96
+ ```
97
+
98
+
37
99
  ### 試したこと
38
100
  vagrantのアンインストール後の再インストール
39
101