Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing files with startup problems in /monitoring/prometheus #247

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions monitoring/prometheus/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3"
services:
go-application:
build:
Expand Down Expand Up @@ -37,7 +36,7 @@ services:
volumes:
- ./prometheus.yaml:/etc/prometheus/prometheus.yaml
grafana:
image: grafana/grafana:5.0.4
image: grafana/grafana:9.0.0
ports:
- "3000:3000"
environment:
Expand All @@ -57,4 +56,4 @@ services:
sleep 5s
cd /grafana
curl --request POST http://grafana:3000/api/datasources --header 'Content-Type: application/json' -d @datasources.json
curl --request POST http://grafana:3000/api/dashboards/db --header 'Content-Type: application/json' -d @dashboard.json"
curl --request POST http://grafana:3000/api/dashboards/db --header 'Content-Type: application/json' -d @dashboard.json"
36 changes: 19 additions & 17 deletions monitoring/prometheus/dotnet-application/dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch as debug
FROM mcr.microsoft.com/dotnet/core/sdk:2.2.105 AS debug

#install debugger for NET Core
RUN apt-get update
RUN apt-get install -y unzip
RUN curl -sSL https://aka.ms/getvsdbgsh | /bin/sh /dev/stdin -v latest -l ~/vsdbg
RUN sed -i 's|http://deb.debian.org/debian|http://archive.debian.org/debian|g' /etc/apt/sources.list && \
sed -i '/stretch-updates/d' /etc/apt/sources.list && \
sed -i '/security.debian.org/d' /etc/apt/sources.list && \
apt-get update -o Acquire::Check-Valid-Until=false && \
apt-get install -y --no-install-recommends unzip curl && \
curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/vsdbg && \
rm -rf /var/lib/apt/lists/*

RUN mkdir /work/
WORKDIR /work/

COPY ./src/work.csproj /work/work.csproj
WORKDIR /work

COPY ./src/work.csproj .
RUN dotnet restore

COPY ./src/ /work/
RUN mkdir /out/
COPY ./src/ .
RUN dotnet publish --no-restore --output /out/ --configuration Release

ENTRYPOINT ["dotnet", "run"]

###########START NEW IMAGE###########################################
########### START NEW IMAGE ###########################################

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2.3 AS prod

WORKDIR /app

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim as prod
COPY --from=debug /out/ .

RUN mkdir /app/
WORKDIR /app/
COPY --from=debug /out/ /app/
RUN chmod +x /app/
CMD dotnet work.dll
CMD ["dotnet", "work.dll"]
7 changes: 3 additions & 4 deletions monitoring/prometheus/dotnet-application/src/work.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<RuntimeIdentifiers>linux-x64</RuntimeIdentifiers>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>



<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App"/>
<PackageReference Include="prometheus-net.AspNetCore" Version="3.1.4"/>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="prometheus-net.AspNetCore" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
</ItemGroup>

Expand Down
16 changes: 8 additions & 8 deletions monitoring/prometheus/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ To run any of the commands, please ensure you open a terminal and navigate to th
## Start Prometheus, Grafana & Dashboards

```
docker-compose up -d prometheus
docker-compose up -d grafana
docker-compose up -d grafana-dashboards
docker compose up -d prometheus
docker compose up -d grafana
docker compose up -d grafana-dashboards
```


## Start the example app you prefer

```
docker-compose up -d --build go-application
docker-compose up -d --build python-application
docker-compose up -d --build dotnet-application
docker-compose up -d --build nodejs-application
docker compose up -d --build go-application
docker compose up -d --build python-application
docker compose up -d --build dotnet-application
docker compose up -d --build nodejs-application
```

## Generate some requests by opening the application in the browser
Expand Down Expand Up @@ -49,4 +49,4 @@ rate(go_request_duration_seconds_sum[2m]) / rate(go_request_duration_seconds_tot

# Prometheus Guide on Kubernetes

Checkout the prometheus guide [here](./kubernetes/readme.md)
Checkout the prometheus guide [here](./kubernetes/readme.md)