importation initiale
This commit is contained in:
commit
1fcedfa03f
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.~lock*#
|
||||
.*.swp
|
4
docker-compose/p1/Dockerfile
Normal file
4
docker-compose/p1/Dockerfile
Normal file
@ -0,0 +1,4 @@
|
||||
FROM php:8.2-apache
|
||||
|
||||
RUN docker-php-ext-install pdo pdo_mysql && \
|
||||
docker-php-ext-enable pdo_mysql
|
33
docker-compose/p1/docker-compose.yml
Normal file
33
docker-compose/p1/docker-compose.yml
Normal file
@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 mode: yaml -*- vim:sw=2:sts=2:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
services:
|
||||
db:
|
||||
image: mariadb:10
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: admin
|
||||
MARIADB_DATABASE: mydb
|
||||
MARIADB_USER: myuser
|
||||
MARIADB_PASSWORD: pass
|
||||
volumes:
|
||||
- data:/var/lib/mysql
|
||||
- ./initdb:/docker-entrypoint-initdb.d
|
||||
restart: always
|
||||
|
||||
adminer:
|
||||
image: adminer
|
||||
ports:
|
||||
- 8082:8080
|
||||
restart: always
|
||||
|
||||
web:
|
||||
build: .
|
||||
volumes:
|
||||
- logs:/var/log/apache2
|
||||
- ./public:/var/www/html
|
||||
ports:
|
||||
- 8081:80
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
data:
|
||||
logs:
|
7
docker-compose/p1/initdb/visit.sql
Normal file
7
docker-compose/p1/initdb/visit.sql
Normal file
@ -0,0 +1,7 @@
|
||||
-- -*- coding: utf-8 mode: sql -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=
|
||||
|
||||
create table visit (
|
||||
id integer primary key auto_increment,
|
||||
ts timestamp,
|
||||
url varchar(256)
|
||||
);
|
30
docker-compose/p1/public/index.php
Normal file
30
docker-compose/p1/public/index.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
$pdo = new PDO("mysql:host=db;dbname=mydb", "myuser", "pass");
|
||||
$st = $pdo->prepare("insert into visit(ts, url) values (now(), :url)");
|
||||
$st->execute([
|
||||
"url" => $_SERVER["SCRIPT_NAME"],
|
||||
]);
|
||||
|
||||
$st = $pdo->query("select count(*) count from visit");
|
||||
$count = $st->fetch()["count"];
|
||||
|
||||
?><html>
|
||||
<head>
|
||||
<title>prout</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>prout</h1>
|
||||
<p>Nombre de visites: <?=$count?></p>
|
||||
<ul>
|
||||
<?php
|
||||
|
||||
foreach ($_SERVER as $key => $value) {
|
||||
if (is_array($value)) $value = var_export($value, true);
|
||||
echo "<li>$key = $value</li>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
1
docker-compose/p1/public/info.php
Normal file
1
docker-compose/p1/public/info.php
Normal file
@ -0,0 +1 @@
|
||||
<?php phpinfo();
|
7
docker-compose/p2/Dockerfile
Normal file
7
docker-compose/p2/Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
FROM php:8.2-apache
|
||||
|
||||
RUN docker-php-ext-install pdo pdo_mysql && \
|
||||
docker-php-ext-enable pdo_mysql
|
||||
|
||||
COPY config/000-default.conf /etc/apache2/sites-available/000-default.conf
|
||||
RUN a2enmod proxy_http headers
|
35
docker-compose/p2/config/000-default.conf
Normal file
35
docker-compose/p2/config/000-default.conf
Normal file
@ -0,0 +1,35 @@
|
||||
<VirtualHost *:80>
|
||||
# The ServerName directive sets the request scheme, hostname and port that
|
||||
# the server uses to identify itself. This is used when creating
|
||||
# redirection URLs. In the context of virtual hosts, the ServerName
|
||||
# specifies what hostname must appear in the request's Host: header to
|
||||
# match this virtual host. For the default virtual host (this file) this
|
||||
# value is not decisive as it is used as a last resort host regardless.
|
||||
# However, you must set it for any further virtual host explicitly.
|
||||
#ServerName www.example.com
|
||||
|
||||
ServerAdmin webmaster@localhost
|
||||
DocumentRoot /var/www/html
|
||||
|
||||
<Location /adminer/>
|
||||
ProxyPass http://adminer:8080/
|
||||
ProxyPassReverse http://adminer:8080/
|
||||
RequestHeader add X-Forwarded-Prefix /adminer
|
||||
</Location>
|
||||
|
||||
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
|
||||
# error, crit, alert, emerg.
|
||||
# It is also possible to configure the loglevel for particular
|
||||
# modules, e.g.
|
||||
#LogLevel info ssl:warn
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
|
||||
# For most configuration files from conf-available/, which are
|
||||
# enabled or disabled at a global level, it is possible to
|
||||
# include a line for only one particular virtual host. For example the
|
||||
# following line enables the CGI configuration for this host only
|
||||
# after it has been globally disabled with "a2disconf".
|
||||
#Include conf-available/serve-cgi-bin.conf
|
||||
</VirtualHost>
|
41
docker-compose/p2/docker-compose.yml
Normal file
41
docker-compose/p2/docker-compose.yml
Normal file
@ -0,0 +1,41 @@
|
||||
# -*- coding: utf-8 mode: yaml -*- vim:sw=2:sts=2:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
services:
|
||||
db:
|
||||
image: mariadb:10
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: admin
|
||||
MARIADB_DATABASE: mydb
|
||||
MARIADB_USER: myuser
|
||||
MARIADB_PASSWORD: pass
|
||||
volumes:
|
||||
- data:/var/lib/mysql
|
||||
- ./initdb:/docker-entrypoint-initdb.d
|
||||
networks:
|
||||
- int
|
||||
restart: always
|
||||
|
||||
adminer:
|
||||
image: adminer
|
||||
networks:
|
||||
- int
|
||||
restart: always
|
||||
|
||||
web:
|
||||
build: .
|
||||
volumes:
|
||||
- logs:/var/log/apache2
|
||||
- ./public:/var/www/html
|
||||
networks:
|
||||
- default
|
||||
- int
|
||||
ports:
|
||||
- 8083:80
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
data:
|
||||
logs:
|
||||
|
||||
networks:
|
||||
int:
|
7
docker-compose/p2/initdb/visit.sql
Normal file
7
docker-compose/p2/initdb/visit.sql
Normal file
@ -0,0 +1,7 @@
|
||||
-- -*- coding: utf-8 mode: sql -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=
|
||||
|
||||
create table visit (
|
||||
id integer primary key auto_increment,
|
||||
ts timestamp,
|
||||
url varchar(256)
|
||||
);
|
30
docker-compose/p2/public/index.php
Normal file
30
docker-compose/p2/public/index.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
$pdo = new PDO("mysql:host=db;dbname=mydb", "myuser", "pass");
|
||||
$st = $pdo->prepare("insert into visit(ts, url) values (now(), :url)");
|
||||
$st->execute([
|
||||
"url" => $_SERVER["SCRIPT_NAME"],
|
||||
]);
|
||||
|
||||
$st = $pdo->query("select count(*) count from visit");
|
||||
$count = $st->fetch()["count"];
|
||||
|
||||
?><html>
|
||||
<head>
|
||||
<title>prout</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>prout</h1>
|
||||
<p>Nombre de visites: <?=$count?></p>
|
||||
<ul>
|
||||
<?php
|
||||
|
||||
foreach ($_SERVER as $key => $value) {
|
||||
if (is_array($value)) $value = var_export($value, true);
|
||||
echo "<li>$key = $value</li>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
1
docker-compose/p2/public/info.php
Normal file
1
docker-compose/p2/public/info.php
Normal file
@ -0,0 +1 @@
|
||||
<?php phpinfo();
|
3
docker-simple/php/Dockerfile
Normal file
3
docker-simple/php/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM php:8.2-apache
|
||||
|
||||
COPY public/ /var/www/html/
|
18
docker-simple/php/public/index.php
Normal file
18
docker-simple/php/public/index.php
Normal file
@ -0,0 +1,18 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>prout</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>prout</h1>
|
||||
<ul>
|
||||
<?php
|
||||
|
||||
foreach ($_SERVER as $key => $value) {
|
||||
if (is_array($value)) $value = var_export($value, true);
|
||||
echo "<li>$key = $value</li>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
7
docker-swarm/app/Dockerfile
Normal file
7
docker-swarm/app/Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
FROM php:8.2-apache
|
||||
|
||||
RUN docker-php-ext-install pdo pdo_mysql && \
|
||||
docker-php-ext-enable pdo_mysql
|
||||
|
||||
COPY config/000-default.conf /etc/apache2/sites-available/000-default.conf
|
||||
RUN a2enmod proxy_http headers
|
35
docker-swarm/app/config/000-default.conf
Normal file
35
docker-swarm/app/config/000-default.conf
Normal file
@ -0,0 +1,35 @@
|
||||
<VirtualHost *:80>
|
||||
# The ServerName directive sets the request scheme, hostname and port that
|
||||
# the server uses to identify itself. This is used when creating
|
||||
# redirection URLs. In the context of virtual hosts, the ServerName
|
||||
# specifies what hostname must appear in the request's Host: header to
|
||||
# match this virtual host. For the default virtual host (this file) this
|
||||
# value is not decisive as it is used as a last resort host regardless.
|
||||
# However, you must set it for any further virtual host explicitly.
|
||||
#ServerName www.example.com
|
||||
|
||||
ServerAdmin webmaster@localhost
|
||||
DocumentRoot /var/www/html
|
||||
|
||||
<Location /adminer/>
|
||||
ProxyPass http://adminer:8080/
|
||||
ProxyPassReverse http://adminer:8080/
|
||||
RequestHeader add X-Forwarded-Prefix /adminer
|
||||
</Location>
|
||||
|
||||
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
|
||||
# error, crit, alert, emerg.
|
||||
# It is also possible to configure the loglevel for particular
|
||||
# modules, e.g.
|
||||
#LogLevel info ssl:warn
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
|
||||
# For most configuration files from conf-available/, which are
|
||||
# enabled or disabled at a global level, it is possible to
|
||||
# include a line for only one particular virtual host. For example the
|
||||
# following line enables the CGI configuration for this host only
|
||||
# after it has been globally disabled with "a2disconf".
|
||||
#Include conf-available/serve-cgi-bin.conf
|
||||
</VirtualHost>
|
47
docker-swarm/app/docker-compose.yml
Normal file
47
docker-swarm/app/docker-compose.yml
Normal file
@ -0,0 +1,47 @@
|
||||
# -*- coding: utf-8 mode: yaml -*- vim:sw=2:sts=2:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
services:
|
||||
db:
|
||||
image: mariadb:10
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: admin
|
||||
MARIADB_DATABASE: mydb
|
||||
MARIADB_USER: myuser
|
||||
MARIADB_PASSWORD: pass
|
||||
volumes:
|
||||
- data:/var/lib/mysql
|
||||
- ./initdb:/docker-entrypoint-initdb.d
|
||||
networks:
|
||||
- int
|
||||
deploy:
|
||||
update_config:
|
||||
order: stop-first
|
||||
placement:
|
||||
constraints:
|
||||
- node.hostname == sw1
|
||||
|
||||
adminer:
|
||||
image: adminer
|
||||
networks:
|
||||
- int
|
||||
|
||||
web:
|
||||
build: .
|
||||
image: sw1.self:5000/app-web
|
||||
volumes:
|
||||
- logs:/var/log/apache2
|
||||
- ./public:/var/www/html
|
||||
networks:
|
||||
- int
|
||||
- proxy
|
||||
deploy:
|
||||
replicas: 3
|
||||
|
||||
volumes:
|
||||
data:
|
||||
logs:
|
||||
|
||||
networks:
|
||||
int:
|
||||
proxy:
|
||||
external: true
|
7
docker-swarm/app/initdb/visit.sql
Normal file
7
docker-swarm/app/initdb/visit.sql
Normal file
@ -0,0 +1,7 @@
|
||||
-- -*- coding: utf-8 mode: sql -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=
|
||||
|
||||
create table visit (
|
||||
id integer primary key auto_increment,
|
||||
ts timestamp,
|
||||
url varchar(256)
|
||||
);
|
30
docker-swarm/app/public/index.php
Normal file
30
docker-swarm/app/public/index.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
$pdo = new PDO("mysql:host=db;dbname=mydb", "myuser", "pass");
|
||||
$st = $pdo->prepare("insert into visit(ts, url) values (now(), :url)");
|
||||
$st->execute([
|
||||
"url" => $_SERVER["SCRIPT_NAME"],
|
||||
]);
|
||||
|
||||
$st = $pdo->query("select count(*) count from visit");
|
||||
$count = $st->fetch()["count"];
|
||||
|
||||
?><html>
|
||||
<head>
|
||||
<title>prout</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>prout</h1>
|
||||
<p>Nombre de visites: <?=$count?></p>
|
||||
<ul>
|
||||
<?php
|
||||
|
||||
foreach ($_SERVER as $key => $value) {
|
||||
if (is_array($value)) $value = var_export($value, true);
|
||||
echo "<li>$key = $value</li>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
1
docker-swarm/app/public/info.php
Normal file
1
docker-swarm/app/public/info.php
Normal file
@ -0,0 +1 @@
|
||||
<?php phpinfo();
|
15
docker-swarm/proxy/docker-compose.yml
Normal file
15
docker-swarm/proxy/docker-compose.yml
Normal file
@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 mode: yaml -*- vim:sw=2:sts=2:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
services:
|
||||
main:
|
||||
image: nginxproxy/nginx-proxy
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
network:
|
||||
- proxy
|
||||
ports:
|
||||
- 80:80
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
external: true
|
13
docker-swarm/registry/docker-compose.yml
Normal file
13
docker-swarm/registry/docker-compose.yml
Normal file
@ -0,0 +1,13 @@
|
||||
# -*- coding: utf-8 mode: yaml -*- vim:sw=2:sts=2:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
services:
|
||||
main:
|
||||
image: registry:2
|
||||
volumes:
|
||||
- data:/var/lib/registry
|
||||
ports:
|
||||
- 5000:5000
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
data:
|
15
docker-swarm/visu/docker-compose.yml
Normal file
15
docker-swarm/visu/docker-compose.yml
Normal file
@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 mode: yaml -*- vim:sw=2:sts=2:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
services:
|
||||
main:
|
||||
image: dockersamples/visualizer:stable
|
||||
ports:
|
||||
- 9000:8080
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
#deploy:
|
||||
# placement:
|
||||
# constraints:
|
||||
# - node.hostname == sw1
|
||||
# #- node.platform.os == linux
|
||||
# #- node.role == manager
|
Loading…
Reference in New Issue
Block a user