Last active
March 6, 2020 07:49
-
-
Save ysugimoto/10a758451726aba1fbba to your computer and use it in GitHub Desktop.
set up docker-compose.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
YOU=`whoami` | |
CWD=$(cd $(dirname $0);pwd) | |
# Create mout storage directory if not exists | |
if [ ! -d "$HOME/perfstore/graphite" ]; then | |
echo "creating directory: $HOME/perfstore/graphite..." | |
mkdir -p $HOME/perfstore/graphite | |
fi | |
if [ ! -d "$HOME/perfstore/grafana" ]; then | |
echo "creating directory: $HOME/perfstore/grafana..." | |
mkdir -p $HOME/perfstore/grafana | |
fi | |
if [ ! -d "$HOME/perfstore/sitespeed.io" ]; then | |
echo "creating directory: $HOME/perfstore/sitespeed.io..." | |
mkdir -p $HOME/perfstore/sitespeed.io | |
fi | |
if [ ! -d "$CWD/composer" ]; then | |
echo "creating directory: $CWD/composer..." | |
mkdir -p $CWD/composer | |
fi | |
# Generate docker-composer.yml on your env | |
cat << EOS > ${CWD}/composer/docker-compose.yml | |
graphite: | |
image: sitespeedio/graphite | |
name: graphite | |
ports: | |
- "8080:80" | |
- "2003:2003" | |
restart: always | |
volumes: | |
- /home/${YOU}/perfstore/graphite:/opt/graphite/storage/whisper | |
grafana: | |
image: grafana/grafana | |
name: grafana | |
restart: always | |
links: | |
- graphite | |
ports: | |
- "3000:3000" | |
volumes: | |
- /home/${YOU}/perfstore/grafana:/var/lib/grafana | |
environment: | |
- GF_SECURITY_ADMIN_USER=admin | |
- GF_SECURITY_ADMIN_PASSWORD=admin | |
sitespeedio: | |
image: sitespeedio/sitespeed.io | |
privileged: true | |
links: | |
- graphite | |
volumes: | |
- /home/${YOU}/perfstore/sitespeed.io:/sitespeed.io | |
sitespeedio-chrome: | |
image: sitespeedio/sitespeed.io-chrome | |
privileged: true | |
links: | |
- graphite | |
volumes: | |
- /home/${YOU}/perfstore/sitespeed.io:/sitespeed.io | |
EOS | |
echo "${CWD}/composer/docker-compose.yml file generated!" | |
echo "To run the docker containers:" | |
echo "cd ${CWD}/composer" | |
echo "docker-compose up -d" | |
exit $? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
YOU=`whoami` | |
HELP= | |
BROWSER="firefox" | |
IMAGE="sitespeed.io" | |
while getopts d: OPT; do | |
case $OPT in | |
d) BROWSER=$OPTARG | |
;; | |
esac | |
done | |
usage_exit() { | |
echo "Measurement URL must be supplied!" | |
echo "Usage: " | |
echo " ./sitespeedio.sh [-b browser] [URL]" | |
exit 1 | |
} | |
if [ "$1" = "" ];then | |
usage_exit | |
fi | |
if [ ! "$BROWSER" = "chrome" -a ! "$BROWSER" = "firefox" ]; then | |
echo "[ERROR] Invalid target browser." | |
usage_exit | |
fi | |
if [ "$BROWSER" = "chrome" ]; then | |
IMAGE="sitespeed.io-chrome" | |
fi | |
echo "===================================================" | |
echo "sitespeed.io performance tracking" | |
echo "===================================================" | |
docker run \ | |
--privileged \ | |
--rm \ | |
--link composer_graphite_1:graphite \ | |
-v /home/${YOU}/perfstore/sitespeed.io:/sitespeed.io \ | |
sitespeedio/${IMAGE} \ | |
${IMAGE} \ | |
-u $1 \ | |
-b ${BROWSER} \ | |
-n 5 \ | |
-d 0 \ | |
-r /tmp \ | |
--graphiteHost graphite \ | |
--graphiteNamespace sitespeed \ | |
--graphiteDate summary,rules,pagemetrics,timings \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment