-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
139 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
site/ | ||
*html | ||
src/hosts/*png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#+TITLE: Hosts | ||
|
||
- [[file:oddtaxi.org][Odd Taxi]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
#+TITLE: Odd Taxi | ||
#+AUTHOR: Will S. Medrano | ||
|
||
* Overview | ||
:PROPERTIES: | ||
:CUSTOM_ID: Overview-1nni0vb0x7k0 | ||
:END: | ||
|
||
~oddtaxi~ is the main entry point to [[https://www.wmedrano.dev][wmedrano.dev]]. Requests from port | ||
~80~ (http) and ~443~ (https) are intercepted by Caddy to either: | ||
|
||
- Serve a static file. | ||
- Reroute request to another job. | ||
|
||
#+BEGIN_SRC dot :file oddtaxi.png | ||
digraph oddtaxi { | ||
node[shape=record]; | ||
blog -> caddy -> public_internet; | ||
prometheus -> grafana -> caddy; | ||
blog -> prometheus[style=dashed]; | ||
grafana -> prometheus[style=dashed]; | ||
prometheus -> prometheus[style=dashed]; | ||
|
||
blog[label="blog\n(static files)"]; | ||
prometheus[label="prometheus\n(metric collector)"]; | ||
grafana[label="grafana\n(prometheus frontend)"]; | ||
caddy[label="caddy\n(web server)"]; | ||
} | ||
#+END_SRC | ||
|
||
#+RESULTS: | ||
[[file:oddtaxi.png]] | ||
|
||
* Configs | ||
:PROPERTIES: | ||
:CUSTOM_ID: Configs-whg458d0x7k0 | ||
:END: | ||
|
||
Caddy is the main entry point. It serves static files and redirects to | ||
other ports. | ||
|
||
** Caddy | ||
:PROPERTIES: | ||
:CUSTOM_ID: ConfigsCaddy-g8j458d0x7k0 | ||
:END: | ||
|
||
#+BEGIN_SRC caddyfile :file /etc/caddy/Caddyfile :tangle yes | ||
# Static files | ||
wmedrano.dev { | ||
root * /home/hiroshi/wmedrano.dev/src | ||
file_server | ||
} | ||
www.wmedrano.dev { | ||
root * /home/hiroshi/wmedrano.dev/src | ||
file_server | ||
} | ||
|
||
# Grafana | ||
status.wmedrano.dev { | ||
reverse_proxy localhost:21895 | ||
} | ||
|
||
# Serve Caddy prometheus metrics through localhost:21894. | ||
:21894 { | ||
metrics | ||
} | ||
#+END_SRC | ||
|
||
** Prometheus | ||
:PROPERTIES: | ||
:CUSTOM_ID: ConfigsPrometheus-ywk458d0x7k0 | ||
:END: | ||
|
||
Prometheus collects metrics from jobs that export a valid Prometheus | ||
~/metrics~ endpoint. Prometheus itself has a basic UI for querying | ||
time series of these metrics, but that job is better served by Grafana. | ||
|
||
#+BEGIN_SRC yaml :file /etc/prometheus/prometheus.yml :tangle yes | ||
global: | ||
# Set the scrape interval to every 15 seconds. Default is every 1 minute. | ||
scrape_interval: 15s | ||
# Evaluate rules every 15 seconds. The default is every 1 minute. | ||
evaluation_interval: 15s | ||
external_labels: | ||
monitor: 'oddtaxi' | ||
alerting: | ||
alertmanagers: | ||
- static_configs: | ||
- targets: ['localhost:9093'] | ||
scrape_configs: | ||
- job_name: prometheus | ||
static_configs: | ||
- targets: ['localhost:9090'] | ||
- job_name: node | ||
static_configs: | ||
- targets: ['localhost:9100'] | ||
- job_name: caddy | ||
static_configs: | ||
- targets: ['localhost:21894'] | ||
- job_name: grafana | ||
static_configs: | ||
- targets: ['localhost:21895'] | ||
#+END_SRC | ||
|
||
** Grafana | ||
:PROPERTIES: | ||
:CUSTOM_ID: ConfigsGrafana-fwaaqbk0y7k0 | ||
:END: | ||
|
||
Grafana is a GUI for Prometheus. It allows building dashboards based | ||
on metrics collected from Prometheus. | ||
|
||
#+BEGIN_SRC bash | ||
sudo docker run -d -p 21895:3000 --name=grafana --restart unless-stopped grafana/grafana-enterprise | ||
#+END_SRC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,6 @@ body { | |
padding: 1rem; | ||
font-family: verdana, sans; | ||
} | ||
a { | ||
text-decoration: none; | ||
} |