github.com/uber/kraken@v0.1.4/nginx/config/build-index.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  // BuildIndexTemplate is the default build-index nginx tmpl.
    17  const BuildIndexTemplate = `
    18  proxy_cache_path {{.cache_dir}}/tags keys_zone=tags:20m;
    19  proxy_cache_path {{.cache_dir}}/repositories keys_zone=repositories:20m;
    20  proxy_cache_path {{.cache_dir}}/list keys_zone=list:20m;
    21  
    22  upstream build-index {
    23    server {{.server}};
    24  }
    25  
    26  server {
    27    listen {{.port}};
    28  
    29    {{.client_verification}}
    30  
    31    access_log {{.log_dir}}/nginx-access.log;
    32    error_log {{.log_dir}}/nginx-error.log;
    33  
    34    location / {
    35      proxy_pass http://build-index;
    36    }
    37  
    38    location /tags {
    39      proxy_pass http://build-index;
    40  
    41      proxy_cache         tags;
    42      proxy_cache_methods GET;
    43      proxy_cache_valid   200 5m;
    44      proxy_cache_valid   any 1s;
    45      proxy_cache_lock    on;
    46    }
    47  
    48    location ~* ^/repositories/.*/tags$ {
    49      proxy_pass http://build-index;
    50  
    51      proxy_cache         repositories;
    52      proxy_cache_methods GET;
    53      proxy_cache_valid   any 1s;
    54      proxy_cache_lock    on;
    55    }
    56  
    57    location /list {
    58      proxy_pass http://build-index;
    59  
    60      proxy_cache         list;
    61      proxy_cache_methods GET;
    62      proxy_cache_valid   200 30s;
    63      proxy_cache_valid   any 1s;
    64      proxy_cache_lock    on;
    65  
    66      proxy_read_timeout 2m;
    67    }
    68  }
    69  `