Impress Your Boss With Automated Reporting Displays

Get a proof of concept up in 15 minutes using Docker, MySQL and Grafana Visualization

I Sun
I Sun
Dec 2, 2020 · 7 min read
Image for post
Image for post
Source: Author

Motivation

Install Docker

$ docker --version

Get Running with MySQL

$ docker run --name mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:latest
$ docker run --name mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:latestUnable to find image 'mysql:latest' locallylatest: Pulling from library/mysqlbb79b6b2107f: Pull complete49e22f6fb9f7: Pull complete...Status: Downloaded newer image for mysql:latestcb1661a2c070c5e4326e470c5311d5194c16c7948e7a2fa7522c5921b0baa004
$ docker ps -a
$ docker exec -it mysql mysql -uroot -p
Welcome to the MySQL monitor.  Commands end with ; or \g.Server version: 8.0.22 MySQL Community Server - GPLCopyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>

Create Source Data

mysql> use mysql;
myqsl> create table test_results(    id INT NOT NULL AUTO_INCREMENT,    tester VARCHAR(100) NOT NULL,    test_name VARCHAR(100) NOT NULL,    test_date DATE,    steps_passed INT,    steps_failed INT,    steps_skipped INT,    PRIMARY KEY ( id ));
CREATE USER 'reportuser' IDENTIFIED BY 'password';
GRANT SELECT ON mysql.test_results TO 'reportuser';
FLUSH PRIVILEGES;
mysql> INSERT INTO test_results(tester, test_name, test_date, steps_passed, steps_failed, steps_skipped)VALUES(’Tester1’, ‘procedure1’, ’2020-11-15’, 8, 1, 1);mysql> INSERT INTO test_results(tester, test_name, test_date, steps_passed, steps_failed, steps_skipped)VALUES(’Tester2’, ‘procedure1’, ’2020-11-16’, 9, 1, 0);

Setting up Grafana

docker run -d -p 3000:3000 grafana/grafana
$ docker ps -a
Image for post
Image for post
Source: Author
$ docker ps -a
docker inspect f1fb2f8887b4 | grep "IPAddress"
Image for post
Image for post
Source: Author

Create a Report Dashboard

Image for post
Image for post
Source: Author
Image for post
Image for post
Source: Author
Image for post
Image for post
Source: Author

Takeaway

The Startup

Medium's largest active publication, followed by +755K people. Follow to join our community.

I Sun

Written by

I Sun

Engineer, restaurant owner, dabbler in the written arts. Proud to call JHU, USC, and UIUC my alma mater. Find me on Twitter @kaistreetfare

The Startup

Medium's largest active publication, followed by +755K people. Follow to join our community.

I Sun

Written by

I Sun

Engineer, restaurant owner, dabbler in the written arts. Proud to call JHU, USC, and UIUC my alma mater. Find me on Twitter @kaistreetfare

The Startup

Medium's largest active publication, followed by +755K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store