grafana/docs
Daniel Lee d1c9760fa8 Postgres Data Source (#9475)
* add postgresql datasource

* add rest of files for postgres datasource

* fix timeseries query, remove unused code

* consistent naming, refactoring

* s/mysql/postgres/

* s/mysql/postgres/

* couple more tests

* tests for more datatypes

* fix macros for postgres

* add __timeSec macro

* add frontend for postgres datasource

* adjust documentation

* fix formatting

* add proper plugin description

* merge editor changes from mysql

* port changes from mysql datasource

* set proper defaultQuery for postgres

* add time_sec to timeseries query
accept int for value for timeseries query

* revert allowing time_sec and handle int or float values as unix
timestamp for "time" column

* fix tslint error

* handle decimal values in timeseries query

* allow setting sslmode for postgres datasource

* use type switch for handling data types

* fix value for timeseries query

* refactor timeseries queries to make them more flexible

* remove debug statement from inner loop in type conversion

* use plain for loop in getTypedRowData

* fix timeseries queries

* adjust postgres datasource to tsdb refactoring

* adjust postgres datasource to frontend changes

* update lib/pq to latest version

* move type conversion to getTypedRowData

* handle address types cidr, inet and macaddr

* adjust response parser and docs for annotations

* convert unknown types to string

* add documentation for postgres datasource

* add another example query with metric column

* set more helpful default query

* update help text in query editor

* handle NULL in value column of timeseries query

* add __timeGroup macro

* add test for __timeGroup macro

* document __timeGroup and set proper default query for annotations

* fix typos in docs

* add postgres to list of datasources

* add postgres to builtInPlugins

* mysql: refactoring as prep for merging postgres

Refactors out the initialization of the xorm engine and the query logic
for an sql data source.

* mysql: rename refactoring + test update

* postgres:refactor to use SqlEngine(same as mysql)

Refactored to use a common base class with the MySql data source.

Other changes from the original PR:
- Changed time column to be time_sec to allow other time units in the
future and to be the same as MySQL
- Changed integration test to test the main Query method rather than
the private transformToTable method
- Changed the __timeSec macro name to __timeEpoch
- Renamed PostgresExecutor to PostgresQueryEndpoint

Fixes #9209 (the original PR)

* postgres: encrypt password on config page

With some other cosmetic changes to the config page:
- placeholder texts
- reset button for the password after it has been encrypted.
- default value for the sslmode field.

* postgres: change back col name to time from time_sec

* postgres mysql: remove annotation title

Title has been removed from annotations

* postgres: fix images for docs page

* postgres mysql: fix specs
2017-10-10 15:19:14 +02:00
..
sources Postgres Data Source (#9475) 2017-10-10 15:19:14 +02:00
config.toml docs: minor fix 2017-03-17 19:33:31 +01:00
Dockerfile docs: fixed docs title issue 2017-03-14 12:21:22 +01:00
Makefile docs: updated make file for docs to support specifying env and version 2017-04-27 12:17:22 +02:00
publish.sh docs: add publish bash script 2017-05-02 10:20:09 +02:00
README.md docs: improvements to building the docs readme 2017-06-09 14:27:27 +02:00
s3_website.json Added grafana 1.x docs to main repo 2015-03-10 08:56:03 +01:00
VERSION docs: added docs archive for v4.3 2017-09-04 13:38:46 +02:00

Building The Docs

To build the docs locally, you need to have docker installed. The docs are built using Hugo - a static site generator.

Prepare the Docker Image:

Git clone grafana/grafana.org repo. Run these commands in the root of that repo. Note that you may require sudo when running make docs-build depending on how your system's docker service is configured):

git clone https://github.com/grafana/grafana.org
cd grafana.org
make docs-build

Build the Documentation:

Now that the docker image has been prepared we can build the grafana docs and start a docs server.

If you have not cloned the Grafana repository already then:

cd ..
git clone https://github.com/grafana/grafana

Switch your working directory to the directory this file (README.md) is in.

cd grafana/docs

An AWS config file is required to build the docs Docker image and to publish the site to AWS. If you are building locally only and do not have any AWS credentials for docs.grafana.org then create an empty file named awsconfig in the current directory.

touch awsconfig

Then run (possibly with sudo):

make watch

This command will not return control of the shell to the user. Instead the command is now running a new docker container built from the image we created in the previous step.

Open localhost:3004 to view the docs.

Images & Content

All markdown files are located in this repo (main grafana repo). But all images are added to the https://github.com/grafana/grafana.org repo. So the process of adding images is a bit complicated.

First you need create a feature (PR) branch of https://github.com/grafana/grafana.org so you can make change. Then add the image to the /static/img/docs directory. Then make a commit that adds the image.

Then run:

make docs-build

This will rebuild the docs docker container.

To be able to use the image your have to quit (CTRL-C) the make watch command (that you run in the same directory as this README). Then simply rerun make watch, it will restart the docs server but now with access to your image.

Editing content

Changes to the markdown files should automatically cause a docs rebuild and live reload should reload the page in your browser.