소스 검색

service-map doesn't try to setup nginx any more. It expects now a configured nginx and creates an includable config for the servers default domain

Till Klocke 7 년 전
부모
커밋
a63b7b8d6b

+ 3 - 0
roles/service-map/tasks/main.yml

@@ -1 +1,4 @@
 ---
+- include: gluon-collector.yml
+- include: meshviewer.yml
+- include: nginx.yml

+ 3 - 45
roles/service-map/tasks/nginx.yml

@@ -4,51 +4,9 @@
 - name: Ensure nginx is installed
   apt: name=nginx state=present update_cache=yes cache_valid_time=3600
 
-- name: Install openssl to generate DH params
-  apt: name=openssl state=present
-
-- name: Ensure nginx ssl directory exists
-  file: dest=/etc/nginx/ssl/ state=directory
-
-- name: Create private ssl key from secret var
-  copy: content="{{ mapserver_ssl_private_key }}" dest="{{mapserver_ssl_key_path}}"
-  notify:
-  - Restart nginx
-
-- name: Create nginx server certificate from secret var
-  copy: content="{{ mapserver_ssl_server_cert }}" dest="{{mapserver_ssl_cert_path}}"
-  notify:
-  - Restart nginx
-
-- name: Deploy pregenerated DH params
-  when: mapserver_use_pregenerated_dh_params
-  copy: content="{{mapserver_dh_params}}" dest=/etc/nginx/dhparams.pem
-  notify:
-  - Restart nginx
-
-- name: Generate strong dhparams
-  when: not mapserver_use_pregenerated_dh_params
-  shell: openssl dhparam -out /etc/nginx/dhparams.pem 4096 
-  args:
-    creates: /etc/nginx/dhparams.pem
-  notify:
-  - Restart nginx
-
 - name: Install nginx configs
   template:
-    src: "{{item.src}}"
-    dest: "{{item.dest}}"
-  with_items:
-  - src: nginx-default.conf.j2
-    dest: /etc/nginx/sites-available/default
+    src: meshviewer.conf.j2
+    dest: /etc/nginx/site-include/{{ ansible_fqdn }}/meshviewer.conf
   notify:
-  - Restart nginx
-
-- name: Activate nginx configurations
-  file:
-    src: /etc/nginx/sites-available/default
-    dest: /etc/nginx/sites-enabled/default
-    state: link
-
-- name: Ensure nginx is started and enabled
-  service: name=nginx state=started enabled=yes
+  - Reload nginx

+ 34 - 0
roles/service-map/templates/meshviewer.conf.j2

@@ -0,0 +1,34 @@
+location = / {
+  return 302 /meshviewer/;
+}
+
+rewrite ^/meshviewer-neu(.*)$ /meshviewer$1 permanent;
+
+location /meshviewer {
+  alias /srv/meshviewer;
+  index index.html;
+  try_files $uri $uri/ =404;
+  gzip on;
+  gzip_comp_level 2;
+  gzip_types application/json application/javascript text/css;
+  gzip_vary on;
+}
+
+location /data/ {
+  include proxy_params;
+  proxy_pass http://[::1]:8079/;
+  gzip on;
+  gzip_comp_level 2;
+  gzip_types application/json;
+  gzip_vary on;
+}
+
+location /meshviewer-alt {
+  proxy_pass https://[2001:4ba0:ffff:15::22];
+  proxy_set_header Host map.ffdo.de;
+}
+
+location /data-alt {
+  proxy_pass https://[2001:4ba0:ffff:15::22];
+  proxy_set_header Host map.ffdo.de;
+}

+ 0 - 72
roles/service-map/templates/nginx-default.conf.j2

@@ -1,72 +0,0 @@
-server {
-  listen 80 default_server;
-  listen [::]:80 default_server;
-
-
-  # ssl
-  listen 443 ssl;
-        listen [::]:443 ssl;
-  ssl_certificate {{mapserver_ssl_cert_path}};
-  ssl_certificate_key {{mapserver_ssl_key_path}};
-  ssl_dhparam /etc/nginx/dhparams.pem;
-
-  server_name _;
-  root /var/www;
-  index index.html;
-
-  location = / {
-    return 302 /meshviewer/;
-  }
-
-  location /meshviewer {
-    alias {{meshviewer_install_directory}};
-    try_files $uri $uri/ =404;
-    gzip on;
-    gzip_comp_level 2;
-    gzip_types application/json application/javascript text/css;
-    gzip_vary on;
-  }
-
-  location /meshviewer-test {
-    alias /srv/meshviewer-test;
-    try_files $uri $uri/ =404;
-                gzip on;
-                gzip_comp_level 2;
-                gzip_types application/json application/javascript text/css;
-                gzip_vary on;
-  }
-
-  location /grafana {
-    if ($scheme != "https") {
-      rewrite ^ https://map.ffdo.de$request_uri permanent;
-    }
-                include proxy_params;
-                proxy_pass http://127.0.0.1:3000/;
-                rewrite  ^/grafana/(.*)  /$1 break;
-                proxy_set_header Host $host;
-
-  }
-
-  location /data {
-    alias /srv/ffmap-data;
-    gzip on;
-    gzip_comp_level 2;
-    gzip_types application/json;
-    gzip_vary on;
-  }
-
-  location /data-announced {
-    proxy_pass  http://127.0.0.1:{{gluon_collector_http_port}};
-    proxy_redirect  off;
-  }
-
-# location /wiki {
-#   if ($scheme = http){
-#                 rewrite ^ https://map.do.freifunk.ruhr$request_uri? permanent;
-#         }
-#   proxy_pass        http://127.0.0.1:5001/;
-#         proxy_set_header  X-Real-IP  $remote_addr;
-#         proxy_redirect off;
-# }
-
-}