docker-compose

This commit is contained in:
Flinner Yuu 2022-12-11 07:07:55 +03:00
parent b590561c0d
commit d56dd8dce0
Signed by: flinner
GPG Key ID: 95CE0DA7F0E58CA6
7 changed files with 219 additions and 0 deletions

View File

@ -0,0 +1,71 @@
version: "3.3"
services:
nginx:
image: nginx:1.23.2
networks:
- iot
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/mime.types:/etc/nginx/conf/mime.types:ro
- ./nginx/proxy.conf:/etc/nginx/proxy.conf:ro
- ./nginx/fastcgi.conf:/etc/nginx/fastcgi.conf:ro
- ./nginx/logs/:/etc/nginx/logs/
ports:
- "80:80"
mosquitto:
image: eclipse-mosquitto:latest
restart: always
ports:
- "1883:1883"
- "9001:9001"
networks:
- iot
volumes:
- ./mosquitto.conf:/mosquitto/config/mosquitto.conf
influxdb:
image: influxdb:1.8
restart: always
ports:
- "8086:8086"
networks:
- iot
volumes:
- influxdb-data:/var/lib/influxdb
telegraf:
user: root
image: telegraf
restart: always
volumes:
- ./telegraf.conf:/etc/telegraf/telegraf.conf
depends_on:
- mosquitto
- influxdb
networks:
- iot
grafana:
image: grafana/grafana
restart: always
ports:
- "3000:3000"
networks:
- iot
volumes:
- grafana-data:/var/lib/grafana
depends_on:
- influxdb
environment:
- GF_INSTALL_PLUGINS=volkovlabs-image-panel
- GF_PANELS_DISABLE_SANITIZE_HTML=true
- GF_AUTH_ANONYMOUS_ENABLED=true
networks:
iot:
volumes:
influxdb-data:
grafana-data:

View File

@ -0,0 +1,5 @@
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
listener 1883
allow_anonymous true

View File

@ -0,0 +1,22 @@
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_index index.php;
fastcgi_param REDIRECT_STATUS 200;

View File

@ -0,0 +1,48 @@
types {
text/html html htm shtml;
text/css css;
text/xml xml rss;
image/gif gif;
image/jpeg jpeg jpg;
application/x-javascript js;
text/plain txt;
text/x-component htc;
text/mathml mml;
image/png png;
image/x-icon ico;
image/x-jng jng;
image/vnd.wap.wbmp wbmp;
application/java-archive jar war ear;
application/mac-binhex40 hqx;
application/pdf pdf;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/zip zip;
application/octet-stream deb;
application/octet-stream bin exe dll;
application/octet-stream dmg;
application/octet-stream eot;
application/octet-stream iso img;
application/octet-stream msi msp msm;
audio/mpeg mp3;
audio/x-realaudio ra;
video/mpeg mpeg mpg;
video/quicktime mov;
video/x-flv flv;
video/x-msvideo avi;
video/x-ms-wmv wmv;
video/x-ms-asf asx asf;
video/x-mng mng;
}

View File

@ -0,0 +1,52 @@
error_log logs/error.log;
pid logs/nginx.pid;
worker_rlimit_nofile 8192;
events {
worker_connections 4096; ## Default: 1024
}
http {
include conf/mime.types;
include /etc/nginx/proxy.conf;
include /etc/nginx/fastcgi.conf;
index index.html index.htm index.php;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
server_names_hash_bucket_size 128; # this seems to be required for some vhosts
server { # php/fastcgi
listen 80;
server_name domain1.com www.domain1.com;
access_log logs/domain1.access.log main;
root html;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:1025;
}
}
server { # simple reverse-proxy
listen 80;
server_name mqtt.ammar.engineer;
access_log logs/mqtt.ammar.engineer.access.log main;
# serve static files
#location ~ ^/(images|javascript|js|css|flash|media|static)/ {
# root /var/www/virtual/big.server.com/htdocs;
# expires 30d;
#}
# pass requests for dynamic content to rails/turbogears/zope, et al
location / {
proxy_pass http://grafana:3000;
}
}
}

View File

@ -0,0 +1,11 @@
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffers 32 4k;

View File

@ -0,0 +1,10 @@
[[outputs.influxdb]]
urls = ["http://influxdb:8086"]
database = "pipe_system"
skip_database_creation = false
[[inputs.mqtt_consumer]]
servers = ["tcp://mosquitto:1883"]
topics = [
"pipe_system/#"
]