We recommend four methods to setup and install Promscale:
- TOBS - The Observability Stack for Kubernetes (recommended for kubernetes deployments)
- Docker (instructions detailed below)
- Helm
- Bare Metal
:TIP: See the Promscale github installation guide for more information on installation options.
For demonstration purposes, we will use Docker to get up and running with Promscale.
The easiest way to get started is by using Docker images. Make sure you have Docker installed on your local machine (Docker installation instructions).
The instructions below have 4 steps:
Alternatively, you can skip to the bonus section which contains a docker-compose
file for four components above: Skip to docker-compose file
:WARNING: The instructions below are local testing purposes only and should not be used to set up a production environment.
First, let's create a network specific to Promscale and TimescaleDB:
docker network create --driver bridge promscale-timescaledb
Secondly, let's install and spin up an instance of TimescaleDB in a docker container. This is where Promscale will store all metrics data scraped from Prometheus targets.
We will use a docker image which has thepromscale
PostgreSQL extension already pre-installed:
docker run --name timescaledb \
--network promscale-timescaledb \
-e POSTGRES_PASSWORD=<password> -d -p 5432:5432 \
timescaledev/timescaledb-ha:pg12-latest
The above commands create a TimescaleDB instanced named timescaledb
(via the --name
flag), on the network named promscale-timescale
(via the --network
flag), whose container will run in the background with the container ID printed after created (via the -d
flag), with port-forwarding it to port 5432
on your machine (via the -p
flag).
:WARNING: We set the
POSTGRES_PASSWORD
environment variable (using the-e
flag) in the command above. Please ensure to replace<password>
with the password of your choice for thepostgres
superuser.For production deployments, you will want to fix the docker tag to a particular version instead of
pg12-latest
Since we have TimescaleDB up and running, let’s spin up a Promscale instance, using the Promscale docker image available on Docker Hub:
docker run --name promscale -d -p 9201:9201 \
--network promscale-timescaledb \
timescale/promscale:latest
-db-uri postgres://postgres:<password>@timescaledb:5432/postgres?sslmode=allow
In the -db-uri
flag above, the second mention of postgres
after the double backslash refers to the the user we're logging into the database as, <password>
is the password for user postgres
, and timescaledb
is the name of the TimescaleDB container, installed in step 3.1. We can use the name timescaledb
to refer to the database, rather than using its host address, as both containers are on the same docker network promscale-timescaledb
.
Furthermore, note that the value <password>
should be replaced with the password you set up for TimescaleDB in step 3.1 above.
:WARNING: The setting
ssl-mode=allow
is for testing purposes only. For production deployments, we advise you to usessl-mode=require
for security purposes.
node_exporter
is a Prometheus exporter for hardware and OS metrics exposed by *NIX kernels, written in Go with pluggable metric collectors. To learn more about it, refer to the Node Exporter Github.
For the purposes of this tutorial, we need a service that will expose metrics to Prometheus. We will use the node_exporter
for this purpose.
Install the the node_exporter
on your machine by running the docker command below:
docker run --name node_exporter -d -p 9100:9100 \
--network promscale-timescaledb \
quay.io/prometheus/node-exporter
The command above creates a node exporter instanced named node_exporter
, which port-forwards its output to port 9100
and runs on the promscale-timescaledb
network created in Step 3.1.
Once the Node Exporter is running, you can verify that system metrics are being exported by visiting its /metrics
endpoint at the following URL: http://localhost:9100/metrics
. Prometheus will scrape this /metrics
endpoint to get metrics.
All that's left is to spin up Prometheus.
First we need to ensure that our Prometheus configuration file prometheus.yml
is pointing to Promscale and that we’ve properly set the scrape configuration target to point to our node_exporter
instance, created in Step 3.3.
Here is a basic prometheus.yml
configuration file that we'll use for this tutorial. (More information on Prometheus configuration)
A basic prometheus.yml
file for Promscale:
global:
scrape_interval: 10s
evaluation_interval: 10s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
- job_name: node-exporter
static_configs:
- targets: ['node_exporter:9100']
remote_write:
- url: "http://promscale:9201/write"
remote_read:
- url: "http://promscale:9201/read"
read_recent: true
In the file above, we configure Prometheus to use Promscale as its remote storage endpoint by pointing both its remote_read
and remote_write
to Promscale URLs. Moreover, we set node-exporter as our target to scrape every 10s.
Next, let's spin up a Prometheus instance using the configuration file above (assuming it's called prometheus.yml
and is in the current working directory), using the following command:
docker run \
--network promscale-timescaledb \
-p 9090:9090 \
-v ${PWD}/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus
To save time spinning up and running each docker container separately, here is a sampledocker-compose.yml
file that will spin up docker containers for TimescaleDB, Promscale, node_exporter and Prometheus using the configurations mentioned in Steps 1-4 above.
:WARNING: Ensure you have the Prometheus configuration file
prometheus.yml
in the same directory asdocker-compose.yml
)
A sample docker-compose.yml
file to spin up and connect TimescaleDB, Promscale, node_exporter and Prometheus: is available in the Promscale Github repo.
To use the docker-compose file above method, follow these steps:
- In
docker-compose.yml
, set<PASSWORD>
, the password for superuserpostgres
in TimescaleDB, to a password of your choice. - Run the command
docker-compose up
in the same directory as thedocker-compose.yml
file . - That's it! TimescaleDB, Promscale, Prometheus, and node-exporter should now be up and running.
- Step 4: Up and Running with Promscale: Now that you've installed Promscale, let's query Promscale in SQL and PromQL