Ident samples

This commit is contained in:
nemunaire 2018-10-14 22:58:19 +02:00
commit 02db9cc19c
47 changed files with 2660 additions and 215 deletions

View file

@ -12,10 +12,10 @@ que l'on a réussi à faire précédemment en utilisant le `Dockerfile` suivant
<div lang="en-US">
```
FROM ubuntu:latest
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y nano
RUN apt-get update
RUN apt-get install -y nano
```
</div>
@ -33,7 +33,7 @@ commande `build` :
<div lang="en-US">
```
docker image build --tag=my_editor .
docker image build --tag=my_editor .
```
</div>
@ -42,7 +42,7 @@ constater l'existence de notre éditeur favori :
<div lang="en-US">
```
docker container run -it my_editor /bin/bash
docker container run -it my_editor /bin/bash
```
</div>
@ -56,9 +56,9 @@ Cela signifie que l'exemple suivant **ne fonctionne pas** :
<div lang="en-US">
```
COPY db.sql /db.sql
RUN service mysqld start
RUN mysql -u root -p toor virli < /db.sql
COPY db.sql /db.sql
RUN service mysqld start
RUN mysql -u root -p toor virli < /db.sql
```
</div>
@ -70,8 +70,8 @@ Pour avoir le résultat escompté, il faut exécuter les commandes ensemble :
<div lang="en-US">
```
COPY db.sql /db.sql
RUN service mysqld start && mysql -u root -p toor virli < /db.sql
COPY db.sql /db.sql
RUN service mysqld start && mysql -u root -p toor virli < /db.sql
```
</div>
@ -85,12 +85,12 @@ Construisons maintenant un conteneur avec un serveur web :
<div lang="en-US">
```
FROM my_editor
FROM my_editor
RUN apt-get update
RUN apt-get install -y nginx
RUN apt-get update
RUN apt-get install -y nginx
EXPOSE 80
EXPOSE 80
```
</div>
@ -103,9 +103,9 @@ redirection de port aléatoire sur la machine hôte vers votre conteneur :
<div lang="en-US">
```
docker image build --tag=my_webserver .
docker container run -it -P my_webserver /bin/bash
service nginx start
docker image build --tag=my_webserver .
docker container run -it -P my_webserver /bin/bash
service nginx start
```
</div>
@ -125,14 +125,14 @@ si aucune commande n'est passée lors du `run`, par exemple :
<div lang="en-US">
```
CMD nginx -g "daemon off;"
CMD nginx -g "daemon off;"
```
</div>
<div lang="en-US">
```
docker image build --tag=my_nginx .
docker container run -d -P my_nginx
docker image build --tag=my_nginx .
docker container run -d -P my_nginx
```
</div>

View file

@ -13,8 +13,8 @@ Petit indice, les requêtes SQL sont les suivantes :
<div lang="en-US">
```
DELETE FROM "data_source";
INSERT INTO "data_source" VALUES(1,1,0,'influxdb','influx','direct','http://${}:8086/','user','pass','metrics',0,'','',0,'null','2015-10-29 09:00:00','2015-10-29 09:05:00');
DELETE FROM "data_source";
INSERT INTO "data_source" VALUES(1,1,0,'influxdb','influx','direct','http://${}:8086/','user','pass','metrics',0,'','',0,'null','2015-10-29 09:00:00','2015-10-29 09:05:00');
```
</div>

View file

@ -102,10 +102,10 @@ votre InfluxDB écoute sur le port 8086 local :
<div lang="en-US">
```bash
TELEGRAF_VERSION=1.8.0
wget https://dl.influxdata.com/telegraf/releases/telegraf-${TELEGRAF_VERSION}_linux_amd64.tar.gz
tar xf telegraf-${TELEGRAF_VERSION}_linux_amd64.tar.gz
TELEGRAF_CONFIG_PATH=./telegraf/etc/telegraf/telegraf.conf ./telegraf/usr/bin/telegraf
TELEGRAF_VERSION=1.8.0
wget https://dl.influxdata.com/telegraf/releases/telegraf-${TELEGRAF_VERSION}_linux_amd64.tar.gz
tar xf telegraf-${TELEGRAF_VERSION}_linux_amd64.tar.gz
TELEGRAF_CONFIG_PATH=./telegraf/etc/telegraf/telegraf.conf ./telegraf/usr/bin/telegraf
```
</div>
@ -116,9 +116,9 @@ Dans l'interface sélectionnez la base `telegraf` puis explorez les valeurs :
<div lang="en-US">
```sql
SHOW MEASUREMENTS
SHOW FIELD KEYS
SELECT usage_idle FROM cpu WHERE cpu = 'cpu-total' ORDER BY time DESC LIMIT 5
SHOW MEASUREMENTS
SHOW FIELD KEYS
SELECT usage_idle FROM cpu WHERE cpu = 'cpu-total' ORDER BY time DESC LIMIT 5
```
</div>

View file

@ -56,9 +56,9 @@ Lorsqu'une ligne devient complexe, allez à la ligne :
<div lang="en-US">
```
RUN apt-get update && apt-get install -y \
nginx \
php5-fpm
RUN apt-get update && apt-get install -y \
nginx \
php5-fpm
```
</div>
@ -71,12 +71,12 @@ exemple :
<div lang="en-US">
```
RUN apt-get update && apt-get install -y \
bzr \
cvs \
git \
mercurial \
subversion
RUN apt-get update && apt-get install -y \
bzr \
cvs \
git \
mercurial \
subversion
```
</div>
@ -155,8 +155,8 @@ L'entrypoint peut être utilisé de deux manières différentes :
<div lang="en-US">
```
ENTRYPOINT ["nginx"]
CMD ["-g daemon off;"]
ENTRYPOINT ["nginx"]
CMD ["-g daemon off;"]
```
</div>
@ -167,20 +167,20 @@ CMD ["-g daemon off;"]
<div lang="en-US">
```shell
#!/bin/bash
set -e
#!/bin/bash
set -e
if [ "$1" = 'postgres' ]; then
chown -R postgres "$PGDATA"
if [ "$1" = 'postgres' ]; then
chown -R postgres "$PGDATA"
if [ -z "$(ls -A "$PGDATA")" ]; then
gosu postgres initdb
fi
if [ -z "$(ls -A "$PGDATA")" ]; then
gosu postgres initdb
fi
exec gosu postgres "$@"
fi
exec gosu postgres "$@"
fi
exec "$@"
exec "$@"
```
</div>

View file

@ -7,7 +7,7 @@ Pour créer une image, commençons par entrer dans un nouveau conteneur :
<div lang="en-US">
```
docker container run -it ubuntu /bin/bash
docker container run -it ubuntu /bin/bash
```
</div>
@ -20,7 +20,7 @@ pas incluses dans le conteneur.
<div lang="en-US">
```
apt-get update
apt-get update
```
</div>
@ -34,7 +34,7 @@ Installons maintenant un programme :
<div lang="en-US">
```
apt-get install nano
apt-get install nano
```
</div>
@ -43,7 +43,7 @@ autre terminal :
<div lang="en-US">
```
docker container ls
docker container ls
```
</div>
@ -58,7 +58,7 @@ commencer directement de votre image avec `nano` :
<div lang="en-US">
```
docker container commit CONTAINER my_nano
docker container commit CONTAINER my_nano
```
</div>
@ -68,7 +68,7 @@ d'`ubuntu` :
<div lang="en-US">
```
docker container run -it my_nano /bin/bash
docker container run -it my_nano /bin/bash
```
</div>

View file

@ -25,15 +25,15 @@ cela dépendra de votre avancée dans le projet) :
<div lang="en-US">
```
login_x-TP2/influxdb/Dockerfile
login_x-TP2/influxdb/influxdb.conf
login_x-TP2/chronograf
login_x-TP2/chronograf/Dockerfile
login_x-TP2/chronograf/chronograf.conf
login_x-TP2/mymonitoring
login_x-TP2/mymonitoring/Dockerfile
login_x-TP2/mymonitoring/chronograf.conf
login_x-TP2/mymonitoring/influxdb.conf
login_x-TP2/mymonitoring/supervisor.conf
login_x-TP1_5/influxdb/Dockerfile
login_x-TP1_5/influxdb/influxdb.conf
login_x-TP1_5/chronograf
login_x-TP1_5/chronograf/Dockerfile
login_x-TP1_5/chronograf/chronograf.conf
login_x-TP1_5/mymonitoring
login_x-TP1_5/mymonitoring/Dockerfile
login_x-TP1_5/mymonitoring/chronograf.conf
login_x-TP1_5/mymonitoring/influxdb.conf
login_x-TP1_5/mymonitoring/supervisor.conf
```
</div>

View file

@ -31,7 +31,7 @@ conteneur influxdb de la première partie est toujours lancé).
<div lang="en-US">
```shell
docker run --rm --link YOUR_INFLUX_CNTR_NAME:influxdb chronograf
docker run --rm --link YOUR_INFLUX_CNTR_NAME:influxdb chronograf
```
</div>
@ -52,7 +52,7 @@ suivantes :
<div lang="en-US">
```sql
SELECT used, available, cached FROM mem WHERE tmpltime()
SELECT mean(usage_idle) FROM cpu WHERE tmpltime() GROUP BY time(20s), cpu
SELECT used, available, cached FROM mem WHERE tmpltime()
SELECT mean(usage_idle) FROM cpu WHERE tmpltime() GROUP BY time(20s), cpu
```
</div>

View file

@ -83,9 +83,6 @@ cela. Mais plein de gens ont cette problématique et l'application `supervisor`
répond parfaitement à notre problématique !
## `HEALTHCHECK`
## `supervisor`
Première étape : installer `supervisor`, le paquet se trouve dans les dépôts.