sitespeedio / sitespeed.io

sitespeed.io is an open-source tool for comprehensive web performance analysis, enabling you to test, monitor, and optimize your website’s speed using real browsers in various environments.
https://www.sitespeed.io/
MIT License
4.76k stars 603 forks source link

config json file not found when using full path #1616

Closed jamiegood closed 7 years ago

jamiegood commented 7 years ago

Hi,

When I run the following command using the full path to the config json file:

docker run  --privileged --shm-size=1g --rm -v "$(pwd)":/sitespeed.io -v "$(pwd)"/result:/result sitespeedio/sitespeed.io --browsertime.chrome.dumpTraceCategoriesLog --browsertime.chrome.collectTracingEvents --browsertime.cacheClearRaw --video --speedIndex http://www.guardian.co.uk -n 1 --browsertime.speedIndex true --config /Users/me/sandbox/test3.json 

Sitespeed.io fails to run and the output is:

Invalid JSON config file: /Users/jamie/sandbox/test3.json

However when I run the command above with the .json file relatively.

docker run  --privileged --shm-size=1g --rm -v "$(pwd)":/sitespeed.io -v "$(pwd)"/result:/result sitespeedio/sitespeed.io --browsertime.chrome.dumpTraceCategoriesLog --browsertime.chrome.collectTracingEvents --browsertime.cacheClearRaw --video --speedIndex http://www.guardian.co.uk -n 1 --browsertime.speedIndex true --config test3.json 

Sitespeed.io runs normally.

beenanner commented 7 years ago

Thanks @jamiegood for the report this is the correct behavior as sitespeed will be relative to what's inside of the docker filesystem. -v "$(pwd)":/sitespeed.io is the magic that causes the full path to not work as you expect it.

When using docker you will need to specify the full path like so if you are in /Users/me/sandbox/:

docker run --privileged --shm-size=1g --rm -v "$(pwd)":/sitespeed.io -v "$(pwd)"/result:/result sitespeedio/sitespeed.io --browsertime.chrome.dumpTraceCategoriesLog --browsertime.chrome.collectTracingEvents --browsertime.cacheClearRaw --video --speedIndex http://www.guardian.co.uk -n 1 --browsertime.speedIndex true --config /sitespeed.io/test3.json

Note that /sitespeed.io becomes the base of whatever directory you are currently in. Let us know if you have any other questions. If you have any thoughts on how we could make this more clear in the documentation for "Getting Started" that would help out a lot! Thanks again.

jamiegood commented 7 years ago

Thank you @beenanner

Yup it's working great now.

I've was working through the instructions on setting up the Performance Dashboard. I'd have some ideas from that experience on how to make the instructions clear. I'll send them on :)

Thanks again!