← Back to Blog

Setting Up a Proof of Concept Project with Prometheus and Thanos in GitHub Codespaces ๐Ÿš€

Setting Up a Proof of Concept Project with Prometheus and Thanos in GitHub Codespaces ๐Ÿš€ In the world of cloud-based development environments, GitHub Codespaces offers a powerful platform for setting up and testing various projects.

Setting Up a Proof of Concept Project with Prometheus and Thanos in GitHub Codespaces ๐Ÿš€

In the world of cloud-based development environments, GitHub Codespaces offers a powerful platform for setting up and testing various projects. Today, weโ€™ll walk through creating a proof of concept (PoC) project with Prometheus and Thanos, complete with emojis to make the process more engaging! ๐ŸŒŸ

Step 1: Set Up GitHub Codespaces

  • Create a Repository:

Start by creating a new repository on GitHub for your PoC project. ๐Ÿ“‚

  • Open in Codespaces:

Navigate to your repository on GitHub.

  • Click on the Code button and select Open with Codespaces.

  • Create a new Codespace or open an existing one. ๐Ÿš€

Step 2: Prepare the Environment

  • Install Docker:

Ensure Docker is installed and running in your Codespace. ๐Ÿณ

  • Create a Docker Compose File:

Create a docker-compose.yml file to define the services for Prometheus and Thanos.

version: '3.7'

services:
prometheus:
image: prom/prometheus:latest
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"

thanos-sidecar:
image: quay.io/thanos/thanos:latest
command:
- sidecar
- --tsdb.path=/var/prometheus
- --prometheus.url=http://prometheus:9090
- --grpc-address=0.0.0.0:10901
- --http-address=0.0.0.0:10902
volumes:
- ./prometheus-data:/var/prometheus
depends_on:
- prometheus
ports:
- "10901:10901"
- "10902:10902"

thanos-query:
image: quay.io/thanos/thanos:latest
command:
- query
- --http-address=0.0.0.0:9091
- --store=thanos-sidecar:10901
depends_on:
- thanos-sidecar
ports:
- "9091:9091"

  • Create Prometheus Configuration:

Create a prometheus.yml file to configure Prometheus.

global:
scrape_interval: 15s

scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']

Step 3: Run the Services

  • Start Docker Compose:
    Run the following command to start the services:
    docker-compose up -d

  • Verify the Setup:

Access Prometheus at http://localhost:9090. ๐ŸŒ

  • Access Thanos Query at http://localhost:9091. ๐ŸŒ

Step 4: Test the Setup

  • Add Metrics:

Add some sample metrics to Prometheus and verify they are being scraped. ๐Ÿ“Š

  • Query Metrics:

Use Thanos Query to query the metrics stored in Prometheus. ๐Ÿ”

Step 5: Clean Up

  • Stop the Services:
    Run the following command to stop the services:
    docker-compose down

Conclusion

By following these steps, you can set up a proof of concept project with Prometheus and Thanos in GitHub Codespaces. This setup allows you to explore the integration and capabilities of these tools in a cloud-based development environment. Happy coding! ๐ŸŽ‰

If you have any questions or need further assistance, feel free to ask! ๐Ÿ˜Š


Feel free to copy and paste this blog post into your WordPress site. If you need any more help, just let me know!


Imported from rifaterdemsahin.com ยท 2025