github.com/uber/kraken@v0.1.4/nginx/config/tracker.go (about)

     1  // Copyright (c) 2016-2019 Uber Technologies, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  package config
    15  
    16  // TrackerTemplate is the default tracker nginx tmpl.
    17  const TrackerTemplate = `
    18  proxy_cache_path {{.cache_dir}}/metainfo levels=1:2 keys_zone=metainfo:10m max_size=256g;
    19  
    20  upstream tracker {
    21    server {{.server}};
    22  }
    23  
    24  server {
    25    listen {{.port}};
    26  
    27    {{.client_verification}}
    28  
    29    access_log {{.log_dir}}/nginx-access.log;
    30    error_log {{.log_dir}}/nginx-error.log;
    31  
    32    location / {
    33      proxy_pass http://tracker;
    34    }
    35  
    36    location ~* ^/namespace/.*/blobs/.*/metainfo$ {
    37      proxy_pass http://tracker;
    38  
    39      proxy_cache         metainfo;
    40      proxy_cache_methods GET;
    41      proxy_cache_valid   200 5m;
    42      proxy_cache_valid   any 1s;
    43      proxy_cache_lock    on;
    44    }
    45  }
    46  `