doc/system_repository.txt
changeset 2677 7f1c7dd5254f
parent 2448 2a649d8c190d
equal deleted inserted replaced
2676:4ea2dbd3337e 2677:7f1c7dd5254f
    44 
    44 
    45 The syspub/0 response is a p5s file.  The p5s file contains publisher
    45 The syspub/0 response is a p5s file.  The p5s file contains publisher
    46 configuration and image configuration.  Currently, the only image configuration
    46 configuration and image configuration.  Currently, the only image configuration
    47 it contains is the publisher search order for the provided publishers, but other
    47 it contains is the publisher search order for the provided publishers, but other
    48 information may be added to the response as needed.  In addition to the basic
    48 information may be added to the response as needed.  In addition to the basic
    49 collection of publisher information, the p5s file also contains a list of urls
    49 collection of publisher information, the p5s file also contains a list of URIs
    50 which the pkg client should proxy to via the system depot instead of contacting
    50 which the pkg client should proxy to via the system depot instead of contacting
    51 them directly.  When creating a p5s file, the urls for origins and mirrors can
    51 them directly.  When creating a p5s file, the URI for origins and mirrors can
    52 be transformed.  HTTPS urls are transformed to HTTP urls since the system depot
    52 be transformed.  HTTPS URIs are transformed to HTTP URIs since the system depot
    53 will be doing the SSL communication, not the pkg client.  File urls are
    53 will be doing the SSL communication, not the pkg client.  File URIs are
    54 transformed into HTTP urls with a special format.  The urls contain the special
    54 transformed into HTTP URIs with a special format.  The URIs contain the special
    55 token "<sysrepo>" which the p5s parser knows to replace with the url of the zone
    55 token "<sysrepo>" which the p5s parser knows to replace with the URI of the zone
    56 proxy client.  The rest of the url contains the prefix of the publisher, then
    56 proxy client.  The rest of the URI contains the prefix of the publisher, then
    57 the sha1 hash of the global zone path to the file repository.
    57 the sha1 hash of the global zone path to the file repository.
    58 
    58 
    59 The information for the syspub/0 response comes from the global zone's image's
    59 The information for the syspub/0 response comes from the global zone's image's
    60 configuration.  The pkg/sysrepo service is responsible transforming the image
    60 configuration.  The application/pkg/system-repository service is responsible for
    61 configuration into an Apache configuration file and causing the system depot to
    61 transforming the image configuration into an Apache configuration file and
    62 reread its configuration.  The global zone pkg client restarts the pkg/sysrepo
    62 causing the system depot to reread its configuration.  The global zone
    63 service whenever the image's publisher configuration changes.
    63 pkg client restarts the application/pkg/system-repository service whenever the
       
    64 image's publisher configuration changes.
    64 
    65 
    65 The Apache configuration file, written by sysrepo.py using the Mako template
    66 The Apache configuration file, written by sysrepo.py using the Mako template
    66 sysrepo_httpd.conf.mako does two things:
    67 sysrepo_httpd.conf.mako does two things:
    67 
    68 
    68  * enables an Apache proxy accepting only requests to the configured
    69  * enables an Apache proxy accepting only requests to the configured
    70    on the loopback interface by default.
    71    on the loopback interface by default.
    71 
    72 
    72  * adds a series of mod_rewrite RewriteRule and Alias directives to allow
    73  * adds a series of mod_rewrite RewriteRule and Alias directives to allow
    73    the Apache instance to gain access to configured file:// publishers.
    74    the Apache instance to gain access to configured file:// publishers.
    74 
    75 
    75 The Apache urls are accessible from the system repository configured at
    76 The Apache URIs are accessible from the system repository configured at
    76 '<sysrepo>' for a given publisher '<publisher>' are below.
    77 '<sysrepo>' for a given publisher '<publisher>' are below.
    77 
    78 
    78 We serve static responses to the following URLs, the content being either
    79 We serve static responses to the following URIs, the content being either
    79 a known versions file, or the p5s file mentioned above:
    80 a known versions file, or the p5s file mentioned above:
    80 
    81 
    81   http://<sysrepo>/versions/0/
    82   http://<sysrepo>/versions/0/
    82   http://<sysrepo>/syspub/0
    83   http://<sysrepo>/syspub/0
    83 
    84 
    84 For access to file:// repositories, we use rewrite rules and Alias directives to
    85 For access to file:// repositories, we use rewrite rules and Alias directives to
    85 access the file repository contents.  In order to allow repositories with
    86 access the file repository contents.  In order to allow repositories with
    86 different paths, yet prevent exposing those paths to system repository clients,
    87 different paths, yet prevent exposing those paths to system repository clients,
    87 we use an SHA-1 hash of the path, and include that in the URL (below, this hash
    88 we use an SHA-1 hash of the path, and include that in the URI (below, this hash
    88 is represented by "HASH")  The URLs we accept for file:// repositories are:
    89 is represented by "HASH")  The URIs we accept for file:// repositories are:
    89 
    90 
    90   http://<sysrepo>/<publisher>/HASH/file/1/<file hash>
    91   http://<sysrepo>/<publisher>/HASH/file/1/<file hash>
    91   http://<sysrepo>/<publisher>/HASH/manifest/0/<package name@version>
    92   http://<sysrepo>/<publisher>/HASH/manifest/0/<package name@version>
    92   http://<sysrepo>/<publisher>/HASH/publisher/0
    93   http://<sysrepo>/<publisher>/HASH/publisher/0
    93   http://<sysrepo>/<publisher>/HASH/versions/0
    94   http://<sysrepo>/<publisher>/HASH/versions/0
    94 
    95 
    95 The system publisher also responds to 'OPTIONS * HTTP/1.0' requests.
    96 The system publisher also responds to 'OPTIONS * HTTP/1.0' requests.
       
    97 
       
    98 When we detect that a request to a given <publisher>/HASH refers to a GZ
       
    99 publisher within a .p5p archive, that request is rewritten so that a custom WSGI
       
   100 application, sysrepo_p5p.py handles the request.  That application accepts URIs
       
   101 of the form:
       
   102 
       
   103   http://<sysrepo>/wsgi_p5p?pub=<publisher>&hash=HASH&path=<path>
       
   104 
       
   105 where path is the remainder of the original system repository file:// URI, after
       
   106 the <publisher> and HASH components have been removed.