From 697b8484b141e0b762a139fb3fe1baafb753ff30 Mon Sep 17 00:00:00 2001 From: barry Date: Fri, 7 Jun 2019 15:24:15 +0200 Subject: [PATCH] fix docker-compose --- srv/conf/conf.d/portal.conf | 32 ++++++++++++++ srv/conf/dnsmasq.conf | 84 +++++++++++++++++++++++++++++++++++++ srv/conf/nginx.conf | 32 ++++++++++++++ srv/docker-compose.yml | 24 +++++++++-- 4 files changed, 168 insertions(+), 4 deletions(-) create mode 100755 srv/conf/conf.d/portal.conf create mode 100755 srv/conf/nginx.conf diff --git a/srv/conf/conf.d/portal.conf b/srv/conf/conf.d/portal.conf new file mode 100755 index 0000000..f6bf4ef --- /dev/null +++ b/srv/conf/conf.d/portal.conf @@ -0,0 +1,32 @@ +server { + server_name captive.eca.aero + *.apple.com + *.google.com + *.gstatic.com; + + location / { + proxy_pass http://portal_service:8889/; + proxy_set_header Host $host; + proxy_set_header X-Real-Ip $remote_addr; + proxy_buffering off; + } +} + + +server { + listen 80 default_server; + server_name _ eca.aero; + root /data/webapp/default; +} + +#server { +# listen 80 default_server; +# listen 443 default_server; +# server_name _; +# return 302 http://eca.aero$request_uri; +#} + +server { + server_name portal.eca.aero; + root /data/webapp/portal; +} diff --git a/srv/conf/dnsmasq.conf b/srv/conf/dnsmasq.conf index e69de29..432246c 100644 --- a/srv/conf/dnsmasq.conf +++ b/srv/conf/dnsmasq.conf @@ -0,0 +1,84 @@ +# Configuration file for dnsmasq. +# +# Format is one option per line, legal options are the same +# as the long options legal on the command line. See +# "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details. + + + +# Configuration file for dnsmasq. +# +# Format is one option per line, legal options are the same +# as the long options legal on the command line. See +# "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details. + +# If you want dnsmasq to listen for DHCP and DNS requests only on +# specified interfaces (and the loopback) give the name of the +# interface (eg eth0) here. +# Repeat the line for more than one interface. +# interface=ienx9cebe834212c + +except-interface=lo + +#bind-dynamic +bind-interfaces + +######### dns ######## +# Never forward plain names (without a dot or domain part) +domain-needed +# Never forward addresses in the non-routed address spaces +bogus-priv +# dont read resolv.conf use the defined servers instead +no-resolv +server=8.8.8.8 +server=8.8.4.4 +# increase dns cache form 512 to 4096 +cache-size=4096 +# Add domains which you want to force to an IP address here. +address=/ife.aero/192.168.0.2 +address=/.ife.aero/192.168.0.2 +address=/pxcom.aero/192.168.0.2 +address=/.pxcom.aero/192.168.0.2 + +address=/google.com/192.168.0.2 +address=/.google.com/192.168.0.2 +address=/gstatic.com/192.168.0.2 +address=/.gstatic.com/192.168.0.2 +address=/apple.com/192.168.0.2 +address=/.apple.com/192.168.0.2 +address=/eca.aero/192.168.0.2 +address=/.eca.aero/192.168.0.2 + +address=/#/192.168.0.2 + +######### dhcp ########## +# Add local-only domains here, queries in these domains are answered +# from /etc/hosts or DHCP only +local=/aero/ +# Set this (and domain: see below) if you want to have a domain +# automatically added to simple names in a hosts-file. +#expand-hosts +# adds my localdomain to each dhcp host +domain=eca.aero +# my private dhcp range + subnetmask + 14d lease time +dhcp-range=192.168.0.10,192.168.0.200,255.255.255.0,14d +dhcp-option-force=160,"http://portal.eca.aero" +# set route to my local network router +#dhcp-option=option:router,192.168.178.1 +#windows 7 float fix +#http://brielle.sosdg.org/archives/522-Windows-7-flooding-DHCP-server-with-DHCPINFORM-messages.html +dhcp-option=252,"\n" + +###### logging ############ +# own logfile +log-facility=/var/log/dnsmasq.log +log-async +# log dhcp infos +log-dhcp +# debugging dns +log-queries + + + + + diff --git a/srv/conf/nginx.conf b/srv/conf/nginx.conf new file mode 100755 index 0000000..3d11947 --- /dev/null +++ b/srv/conf/nginx.conf @@ -0,0 +1,32 @@ +user nginx; +worker_processes 1; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; +} + diff --git a/srv/docker-compose.yml b/srv/docker-compose.yml index 62c8a17..ffae3a8 100644 --- a/srv/docker-compose.yml +++ b/srv/docker-compose.yml @@ -2,15 +2,21 @@ version: '3' services: nginx: - image: nginx + image: nginx:alpine container_name: pxportal_nginx networks: - pxportal + ports: + - "80:80" volumes: + - ./webapp:/data/webapp - ./conf/nginx.conf:/etc/nginx/nginx.conf + - ./conf/conf.d:/etc/nginx/conf.d/ + command: ['nginx-debug', '-g', 'daemon off;'] dnsmasq: image: andyshinn/dnsmasq + container_name: pxportal_dnsmasq ports: - "53:53/tcp" - "53:53/udp" @@ -18,14 +24,24 @@ services: - NET_ADMIN volumes: - ./conf/dnsmasq.conf:/etc/dnsmasq.conf - - ./conf/dnsmasq.d:/etc/dnsmasq.d - exporter: + pxportal: container_name: pxportal_service image: registry.preprod.pxcom.aero/pxcom-servers/pxportal-srv:latest + volumes: + - ssh:/root/.ssh networks: - pxportal + environment: + - REDIRECT_TO=http://portal.eca.aero/index.html + - ARP_CMD=ssh barry@172.27.0.1 arp -n + ports: + - "8889:8889" + - "9000:9000" + +volumes: + ssh: networks: pxportal: - driver: bridge \ No newline at end of file + driver: bridge