diff --git a/README-zh_CN.rst b/README-zh_CN.rst index b75f38d..560337b 100644 --- a/README-zh_CN.rst +++ b/README-zh_CN.rst @@ -176,6 +176,11 @@ Skyline 像九色鹿一样,轻巧、优雅,而又能力强大,为 OpenStac docker run -d --name skyline --restart=always -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml --net=host 99cloud/skyline:latest +API Doc +~~~~~~~~~ + +你可以使用 ``https://:9999/api/openstack/skyline/docs`` 来访问 API doc + 访问测试 ~~~~~~~~ diff --git a/README.rst b/README.rst index 9e46ee3..7d71889 100644 --- a/README.rst +++ b/README.rst @@ -112,6 +112,11 @@ Deployment with MariaDB https://docs.openstack.org/skyline-apiserver/latest/install/docker-install-ubuntu.html +API Doc +~~~~~~~~~ + +You can visit the API doc ``https://:9999/api/openstack/skyline/docs`` + Test Access ~~~~~~~~~~~ diff --git a/doc/source/install/docker-install-ubuntu.rst b/doc/source/install/docker-install-ubuntu.rst index 8da63a3..567a6d2 100644 --- a/doc/source/install/docker-install-ubuntu.rst +++ b/doc/source/install/docker-install-ubuntu.rst @@ -180,3 +180,8 @@ Finalize installation If you need to modify skyline port, add ``-e LISTEN_ADDRESS=`` in run command. Default port is 9999. + +API Doc +--------- + +You can visit the API doc ``https://:9999/api/openstack/skyline/docs`` diff --git a/releasenotes/notes/add-api-doc-5aaffa4e93ca469a.yaml b/releasenotes/notes/add-api-doc-5aaffa4e93ca469a.yaml new file mode 100644 index 0000000..d14b37c --- /dev/null +++ b/releasenotes/notes/add-api-doc-5aaffa4e93ca469a.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Added ``api_prefix`` forwarding to the nginx configuration file. + Now You can visit the API doc + ``https://:9999/api/openstack/skyline/docs``. diff --git a/skyline_apiserver/cmd/generate_nginx.py b/skyline_apiserver/cmd/generate_nginx.py index 68a569c..42c46f4 100644 --- a/skyline_apiserver/cmd/generate_nginx.py +++ b/skyline_apiserver/cmd/generate_nginx.py @@ -31,6 +31,7 @@ from skyline_console import static_path import skyline_apiserver from skyline_apiserver.config import CONF, configure from skyline_apiserver.log import LOG, setup +from skyline_apiserver.types import constants class CommandException(Exception): @@ -166,6 +167,7 @@ def main( context = { "skyline_console_static_path": static_path, "endpoints": [i.dict() for i in endpoints.values()], + "api_prefix": constants.API_PREFIX, } if ssl_certfile: context.update(ssl_certfile=ssl_certfile) diff --git a/skyline_apiserver/templates/nginx.conf.j2 b/skyline_apiserver/templates/nginx.conf.j2 index ed7e3e5..29c9358 100644 --- a/skyline_apiserver/templates/nginx.conf.j2 +++ b/skyline_apiserver/templates/nginx.conf.j2 @@ -98,6 +98,16 @@ http { proxy_set_header Host $http_host; } + location {{ api_prefix }}/ { + proxy_pass http://skyline{{ api_prefix }}/; + proxy_redirect off; + proxy_buffering off; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header Host $http_host; + } + {% for endpoint in endpoints %} {{ endpoint["part"] }} location {{ endpoint["location"] }} {