-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #286 from threefoldtech/development_mariadb-demo
add mariadb demo images
- Loading branch information
Showing
30 changed files
with
24,084 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
MYSQL_ROOT_PASSWORD=rootpassword | ||
MYSQL_DATABASE=mydb | ||
MYSQL_USER=mysql | ||
MYSQL_PASSWORD=password |
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,18 @@ | ||
FROM mariadb | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt update && apt -y install wget openssh-server | ||
|
||
RUN wget https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz && \ | ||
tar xvfz node_exporter-1.8.2.linux-amd64.tar.gz && \ | ||
mv node_exporter-1.8.2.linux-amd64/node_exporter /usr/local/bin | ||
|
||
RUN wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.15.1/mysqld_exporter-0.15.1.linux-amd64.tar.gz && \ | ||
tar xvfz mysqld_exporter-0.15.1.linux-amd64.tar.gz && \ | ||
mv mysqld_exporter-0.15.1.linux-amd64/mysqld_exporter /usr/local/bin | ||
|
||
RUN wget -O /sbin/zinit https://github.com/threefoldtech/zinit/releases/download/v0.2.5/zinit && chmod +x /sbin/zinit | ||
COPY rootfs / | ||
|
||
EXPOSE 9500 9501 | ||
ENTRYPOINT [ "/sbin/zinit", "init" ] |
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,17 @@ | ||
# MariaDB | ||
|
||
the image contains: | ||
|
||
- mariadb server | ||
- node exporter | ||
- mysqld exporter | ||
|
||
## ports | ||
|
||
- `9500` for mysqld exporter | ||
- `9501` for node exporter | ||
|
||
## image | ||
|
||
- docker: omarabdul3ziz/mariadb | ||
- [flist](https://hub.grid.tf/omarabdulaziz.3bot/omarabdul3ziz-mariadb-latest.flist) |
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,6 @@ | ||
exec: | | ||
bash -c ' | ||
mariadb-install-db --user=mysql | ||
' | ||
oneshot: true |
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,7 @@ | ||
exec: | | ||
bash -c ' | ||
mariadbd --user=mysql | ||
' | ||
after: | ||
- mariadb-setup |
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,7 @@ | ||
exec: | | ||
bash -c ' | ||
mysqld_exporter \ | ||
--web.listen-address=:9500 \ | ||
--mysqld.username=${MYSQL_USER}:${MYSQL_PASSWORD} \ | ||
--mysqld.address=localhost:3306 | ||
' |
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 @@ | ||
exec: node_exporter --web.listen-address=:9501 |
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 @@ | ||
exec: /usr/sbin/sshd -D |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,14 @@ | ||
exec: | | ||
bash -c ' | ||
if [ ! -z "$SSH_KEY" ]; then | ||
mkdir -p /var/run/sshd | ||
mkdir -p /root/.ssh | ||
touch /root/.ssh/authorized_keys | ||
chmod 700 /root/.ssh | ||
chmod 600 /root/.ssh/authorized_keys | ||
echo "$SSH_KEY" >> /root/.ssh/authorized_keys | ||
fi | ||
' | ||
oneshot: true |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,24 @@ | ||
FROM ubuntu | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt update && apt -y install wget openssh-server | ||
|
||
RUN wget https://github.com/prometheus/prometheus/releases/download/v2.33.5/prometheus-2.33.5.linux-amd64.tar.gz && \ | ||
tar xvf /prometheus-2.33.5.linux-amd64.tar.gz && \ | ||
useradd --no-create-home --shell /bin/false prometheus && \ | ||
mv /prometheus-2.33.5.linux-amd64/prometheus /usr/local/bin/ && \ | ||
chown prometheus:prometheus /usr/local/bin/prometheus && \ | ||
mkdir /var/lib/prometheus && \ | ||
chown prometheus:prometheus /var/lib/prometheus | ||
|
||
RUN apt -y install adduser libfontconfig1 musl && \ | ||
wget https://dl.grafana.com/enterprise/release/grafana-enterprise_11.1.3_amd64.deb && \ | ||
dpkg -i grafana-enterprise_11.1.3_amd64.deb | ||
|
||
RUN wget -O /sbin/zinit https://github.com/threefoldtech/zinit/releases/download/v0.2.5/zinit && \ | ||
chmod +x /sbin/zinit | ||
|
||
COPY rootfs . | ||
|
||
ENTRYPOINT [ "/sbin/zinit", "init" ] |
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,18 @@ | ||
# Monitor | ||
|
||
this image include prometheus and grafana that visualize a monitor with a full node dashboard. | ||
|
||
## Envvars | ||
|
||
- `PROM_TARGETS`: comma-separated string of hosts for prometheus to scrap | ||
- `SSH_KEY` | ||
|
||
## Ports | ||
|
||
- `3000` for grafana dashboard | ||
- `9090` for prometheus web ui | ||
|
||
## image | ||
|
||
- docker: omarabdul3ziz/monitor | ||
- [flist](https://hub.grid.tf/omarabdulaziz.3bot/omarabdul3ziz-monitor-latest.flist) |
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,26 @@ | ||
#!/bin/bash | ||
|
||
# Check if the PROM_TARGETS environment variable is set | ||
if [ -z "$PROM_TARGETS" ]; then | ||
echo "PROM_TARGETS environment variable is not set." | ||
exit 1 | ||
fi | ||
|
||
# Split the PROM_TARGETS string into an array | ||
IFS=',' read -ra TARGETS <<< "$PROM_TARGETS" | ||
|
||
mkdir -p /etc/prometheus | ||
touch /etc/prometheus/prometheus.yml | ||
|
||
# Generate the Prometheus config with dynamic targets | ||
cat <<EOF > /etc/prometheus/prometheus.yml | ||
global: | ||
scrape_interval: 15s | ||
scrape_configs: | ||
- job_name: 'mariadb-exporter' | ||
static_configs: | ||
- targets: [$(printf "'%s'," "${TARGETS[@]}" | sed 's/,$//')] | ||
EOF | ||
|
||
echo "Prometheus configuration generated successfully." |
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 @@ | ||
exec: grafana-server --homepath /usr/share/grafana | ||
after: | ||
- prom |
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,2 @@ | ||
exec: bash /etc/scripts/config-prom.sh | ||
oneshot: true |
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 @@ | ||
exec: prometheus --config.file=/etc/prometheus/prometheus.yml | ||
after: | ||
- prom-setup |
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 @@ | ||
exec: /usr/sbin/sshd -D |
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,14 @@ | ||
exec: | | ||
bash -c ' | ||
if [ ! -z "$SSH_KEY" ]; then | ||
mkdir -p /var/run/sshd | ||
mkdir -p /root/.ssh | ||
touch /root/.ssh/authorized_keys | ||
chmod 700 /root/.ssh | ||
chmod 600 /root/.ssh/authorized_keys | ||
echo "$SSH_KEY" >> /root/.ssh/authorized_keys | ||
fi | ||
' | ||
oneshot: true |
8 changes: 8 additions & 0 deletions
8
tfgrid3/monitor/rootfs/usr/share/grafana/conf/provisioning/dashboards/default.yaml
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,8 @@ | ||
apiVersion: 1 | ||
|
||
providers: | ||
- name: Default | ||
folder: Services | ||
type: file | ||
options: | ||
path: /var/lib/grafana/dashboards |
9 changes: 9 additions & 0 deletions
9
tfgrid3/monitor/rootfs/usr/share/grafana/conf/provisioning/datasources/default.yml
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,9 @@ | ||
apiVersion: 1 | ||
|
||
datasources: | ||
- name: Prometheus | ||
type: prometheus | ||
url: http://localhost:9090 | ||
isDefault: true | ||
access: proxy | ||
editable: true |
Oops, something went wrong.