
From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> src/kimchid_server is a launch script similar to the old version of kimchid. nginx.conf.in is a template has is being used by the new kimchid script to generate a customized proxy configuration. Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> --- src/kimchid_server.in | 45 +++++++++++++++++++++++++++++++++ src/nginx.conf.in | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 src/kimchid_server.in create mode 100644 src/nginx.conf.in diff --git a/src/kimchid_server.in b/src/kimchid_server.in new file mode 100644 index 0000000..e6a4827 --- /dev/null +++ b/src/kimchid_server.in @@ -0,0 +1,45 @@ +#!/usr/bin/python +# +# Project Kimchi +# +# Copyright IBM, Corp. 2014 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 USA + +import sys +sys.path.insert(1, '/usr/lib/python2.7/site-packages') + +import kimchi.server +import kimchi.config + +from kimchi.config import config, paths +from kimchi.utils import parse_command_line_options + +if not paths.installed: + sys.path.append(paths.prefix) + + +def main(options): + (options, args) = parse_command_line_options() + + # Add non-option arguments + setattr(options, 'ssl_cert', config.get('server', 'ssl_cert')) + setattr(options, 'ssl_key', config.get('server', 'ssl_key')) + + kimchi.server.main(options) + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/src/nginx.conf.in b/src/nginx.conf.in new file mode 100644 index 0000000..3f958b1 --- /dev/null +++ b/src/nginx.conf.in @@ -0,0 +1,69 @@ +#!/usr/bin/python +# +# Project Kimchi +# +# Copyright IBM, Corp. 2014 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 USA + + +# This is a template file to be used to generate a nginx +# proxy config file at kimchid script. + +user nginx; +worker_processes 1; + +error_log /var/log/nginx/error.log; + +events { + worker_connections 1024; +} + + +http { + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + + server { + listen $proxy_port; + listen $proxy_ssl_port ssl; + ssl_certificate $cert_pem; + ssl_certificate_key $cert_key; + + location / { + proxy_pass http://localhost:$backend_port; + proxy_set_header Host $host; + } + location /config/ui/tabs.xml { + proxy_pass http://localhost:$frontend_port; + proxy_set_header Host $host; + } + location /help { + proxy_pass http://localhost:$frontend_port; + proxy_set_header Host $host; + } + location /favicon.ico { + proxy_pass http://localhost:$frontend_port; + proxy_set_header Host $host; + } + } +} -- 1.8.3.1