{"id":916,"date":"2020-01-22T17:33:08","date_gmt":"2020-01-22T15:33:08","guid":{"rendered":"https:\/\/www.rocworks.at\/wordpress\/?p=916"},"modified":"2020-01-22T17:33:54","modified_gmt":"2020-01-22T15:33:54","slug":"kibana-and-pgadmin4-with-nginx-reverse-proxy-on-docker","status":"publish","type":"post","link":"https:\/\/www.rocworks.at\/wordpress\/?p=916","title":{"rendered":"Kibana and PgAdmin4 with NGINX Reverse Proxy on Docker&#8230;"},"content":{"rendered":"\n<p>If you have multiple services running on Docker with different ports, you have to open ports in your firewall and you have to access the services via different ports in the browser. To have one access port (port 80 or 443) you can use a reverse proxy. <\/p>\n\n\n\n<p>In our case we used NGINX to redirect the access to Kibana (Elasticsearch Dashboard Tool) and PgAdmin4 (PostgreSQL Admin Tool) so that we can access both services on the same port (80) in the browser with different base paths: http:\/\/localhost\/kibana and http:\/\/localhost\/pgadmin.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">docker-compose.yml:<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>version: '3.0'\nservices:\n  elasticsearch:\n    hostname: elasticsearch\n    image: elasticsearch:7.5.0\n    ports:\n      - 9200:9200\n      - 9300:9300\n    volumes:\n      - esdata:\/usr\/share\/elasticsearch\/data\n    environment:\n      - discovery.type=single-node\n      - \"ES_JAVA_OPTS=-Xms512m -Xmx512m\"  \n\n  kibana: \n    hostname: kibana\n    image: kibana:7.5.0\n    depends_on:\n      - elasticsearch        \n    environment:\n      - XPACK_MONITORING_ENABLED=false\n      - LOGGING_QUIET=true\n      - SERVER_BASEPATH=\/kibana\n      - SERVER_REWRITEBASEPATH=true    \n\n  postgres:\n    hostname: postgres\n    image: postgres:12.1\n    ports:\n      - 5432:5432\n    volumes:\n      - postgresdb:\/var\/lib\/postgresql\/data\n    environment:\n      - POSTGRES_PASSWORD=manager\n\n  pgadmin: \n    hostname: pgadmin\n    image: dpage\/pgadmin4\n    volumes:\n      - pgadmin:\/var\/lib\/pgadmin\n    environment:\n      - PGADMIN_DEFAULT_EMAIL=postgres\n      - PGADMIN_DEFAULT_PASSWORD=manager\n      - GUNICORN_ACCESS_LOGFILE=\/dev\/null\n\n  proxy:\n    hostname: proxy\n    image: nginx:1.17.8\n    ports:\n      - 80:80\n    volumes:\n      - .\/nginx.conf:\/etc\/nginx\/nginx.conf\n    depends_on:\n      - kibana \n      - pgadmin  \n\nvolumes:  \n  esdata:\n  postgresdb:\n  pgadmin:<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">nginx.conf<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>\nuser  nginx;\nworker_processes  auto;\n\nerror_log  \/var\/log\/nginx\/error.log warn;\npid        \/var\/run\/nginx.pid;\n\n\nevents {\n    worker_connections  1024;\n}\n\n\nhttp {\n    include       \/etc\/nginx\/mime.types;\n    default_type  application\/octet-stream;\n\n    log_format  main  '$remote_addr - $remote_user [$time_local] \"$request\" '\n                      '$status $body_bytes_sent \"$http_referer\" '\n                      '\"$http_user_agent\" \"$http_x_forwarded_for\"';\n\n    access_log  \/dev\/null;\n\n    sendfile        on;\n    #tcp_nopush     on;\n\n    keepalive_timeout  65;\n\n    #gzip  on;\n\n    server {\n        listen 80;\n\n        root \/var\/www;\n        index index.html;\n\n        location \/ {\n            try_files $uri $uri\/ =404;\n        }\n        \n        location \/pgadmin {\n            proxy_pass http:\/\/pgadmin\/;\n            proxy_http_version 1.1;\n            proxy_set_header X-Script-Name \/pgadmin;\n            proxy_set_header Upgrade $http_upgrade;\n            proxy_set_header Connection 'upgrade';\n            proxy_set_header Host $host;\n            proxy_cache_bypass $http_upgrade;\n        }\n\n        location \/kibana {\n            proxy_pass http:\/\/kibana:5601\/kibana;\n            proxy_http_version 1.1;\n            proxy_set_header Upgrade $http_upgrade;\n            proxy_set_header Connection 'upgrade';\n            proxy_set_header Host $host;\n            proxy_cache_bypass $http_upgrade;\n        }                    \n    }\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If you have multiple services running on Docker with different ports, you have to open ports in your firewall and you have to access the services via different ports in the browser. To have one access port (port 80 or 443) you can use a reverse proxy. In our case we used NGINX to redirect &hellip; <a href=\"https:\/\/www.rocworks.at\/wordpress\/?p=916\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Kibana and PgAdmin4 with NGINX Reverse Proxy on Docker&#8230;<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,34,12],"tags":[],"class_list":["post-916","post","type-post","status-publish","format-standard","hentry","category-allgemein","category-docker","category-linux"],"_links":{"self":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/916","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=916"}],"version-history":[{"count":3,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/916\/revisions"}],"predecessor-version":[{"id":919,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/916\/revisions\/919"}],"wp:attachment":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=916"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}