Deploying Prometheus on Northflank
Prometheus is available as an official Docker image on Docker Hub. We can use it as a base image and layer in our configuration before deploying it on Northflank. You find the resources for the Deployment here (opens in a new tab).
Create a GitHub repository and a Prometheus configuration file
We will use Northflank's ability to deploy from a repository using a Dockerfile (opens in a new tab) to set up our Prometheus instance.
Create a file called prometheus.yml
with the following contents:
scrape_configs:
- job_name: my-app-name
metrics_path: /metrics
static_configs:
# Replace the port with the port your /metrics endpoint is running on
- targets: ["your-app-on-northflank:3000"]
scrape_interval: 15s
See the Prometheus configuration reference (opens in a new tab) for full details. You can find an example config.yaml here (opens in a new tab).
Add a Dockerfile in the root of the repository
The below Dockerfile uses the base Prometheus image, loads our configuration, makes the 9090 port available, and runs the container as a root
user in Docker to make sure it can access the persistent volume properly.
FROM prom/prometheus:latest
ADD prometheus.yml /etc/prometheus/
EXPOSE 9090
USER root
Create a Northflank service from a GitHub repo
Create a Northflank (opens in a new tab) service from our newly created GitHub repo, it should pick up the configuration from the Dockerfile
Add Network configurations
In order to make Prometheus accessible to other services in your Northflank network or externally configure the PORT & DNS settings under the service network section in the Northflank UI. Northflank picks automatically up the port number that is specified in the Dockerfile.
Ensure in the settings that the Port
is set to 9090 and choose TCP as Protocol
.