Skip to content

Commit ee6dd70

Browse files
committed
Add blackfire configuration to Homestead.yaml file
1 parent 9affb72 commit ee6dd70

File tree

3 files changed

+68
-18
lines changed

3 files changed

+68
-18
lines changed

scripts/blackfire.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
xdebug="/etc/php5/fpm/conf.d/20-xdebug.ini"
4+
5+
agent="[blackfire]
6+
ca-cert=
7+
collector=https://blackfire.io
8+
log-file=stderr
9+
log-level=1
10+
server-id="$1"
11+
server-token="$2"
12+
socket=unix:///var/run/blackfire/agent.sock
13+
spec=
14+
"
15+
16+
client="[blackfire]
17+
ca-cert=
18+
client-id="$3"
19+
client-token="$4"
20+
endpoint=https://blackfire.io
21+
timeout=15s
22+
"
23+
24+
echo "$agent" > "/etc/blackfire/agent"
25+
echo "$client" > "/home/vagrant/.blackfire.ini"
26+
27+
# Disable xdebug
28+
if [ -f $xdebug ]; then
29+
rm $xdebug
30+
service hhvm restart
31+
service php5-fpm restart
32+
fi
33+
34+
service blackfire-agent restart

scripts/homestead.rb

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,46 +46,54 @@ def Homestead.configure(config, settings)
4646
# Install All The Configured Nginx Sites
4747
settings["sites"].each do |site|
4848
config.vm.provision "shell" do |s|
49-
if (site.has_key?("hhvm") && site["hhvm"])
50-
s.inline = "bash /vagrant/scripts/serve-hhvm.sh $1 $2"
51-
s.args = [site["map"], site["to"]]
52-
else
53-
s.inline = "bash /vagrant/scripts/serve.sh $1 $2"
54-
s.args = [site["map"], site["to"]]
55-
end
49+
if (site.has_key?("hhvm") && site["hhvm"])
50+
s.inline = "bash /vagrant/scripts/serve-hhvm.sh $1 $2"
51+
s.args = [site["map"], site["to"]]
52+
else
53+
s.inline = "bash /vagrant/scripts/serve.sh $1 $2"
54+
s.args = [site["map"], site["to"]]
55+
end
5656
end
5757
end
5858

5959
# Configure All Of The Configured Databases
6060
settings["databases"].each do |db|
61-
config.vm.provision "shell" do |s|
62-
s.path = "./scripts/create-mysql.sh"
63-
s.args = [db]
64-
end
61+
config.vm.provision "shell" do |s|
62+
s.path = "./scripts/create-mysql.sh"
63+
s.args = [db]
64+
end
6565

66-
config.vm.provision "shell" do |s|
67-
s.path = "./scripts/create-postgres.sh"
68-
s.args = [db]
69-
end
66+
config.vm.provision "shell" do |s|
67+
s.path = "./scripts/create-postgres.sh"
68+
s.args = [db]
69+
end
7070
end
7171

7272
# Configure All Of The Server Environment Variables
7373
if settings.has_key?("variables")
7474
settings["variables"].each do |var|
7575
config.vm.provision "shell" do |s|
76-
s.inline = "echo \"\nenv[$1] = '$2'\" >> /etc/php5/fpm/php-fpm.conf"
77-
s.args = [var["key"], var["value"]]
76+
s.inline = "echo \"\nenv[$1] = '$2'\" >> /etc/php5/fpm/php-fpm.conf"
77+
s.args = [var["key"], var["value"]]
7878
end
7979
end
8080

8181
config.vm.provision "shell" do |s|
82-
s.inline = "service php5-fpm restart"
82+
s.inline = "service php5-fpm restart"
8383
end
8484
end
8585

8686
# Update Composer On Every Provision
8787
config.vm.provision "shell" do |s|
8888
s.inline = "/usr/local/bin/composer self-update"
8989
end
90+
91+
# Configure Blackfire.io
92+
if settings.has_key?("blackfire")
93+
config.vm.provision "shell" do |s|
94+
s.path = "./scripts/blackfire.sh"
95+
s.args = [settings["blackfire"]["server"]["id"], settings["blackfire"]["server"]["token"], settings["blackfire"]["client"]["id"], settings["blackfire"]["client"]["token"]]
96+
end
97+
end
9098
end
9199
end

src/stubs/Homestead.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,11 @@ databases:
2222
variables:
2323
- key: APP_ENV
2424
value: local
25+
26+
# blackfire:
27+
# server:
28+
# id: id
29+
# token: token
30+
# client:
31+
# id: id
32+
# token: token

0 commit comments

Comments
 (0)