openstack-k8s-operators / barbican-operator

Apache License 2.0
5 stars 24 forks source link

Missing Barbican WSGI Files #30

Open d34dh0r53 opened 1 year ago

d34dh0r53 commented 1 year ago

barbican_api container

/var/www/cgi-bin/barbican/main

#!/usr/bin/python3
#PBR Generated from 'wsgi_scripts'

import threading

from barbican.api.app import get_api_wsgi_script

if __name__ == "__main__":
    import argparse
    import socket
    import sys
    import wsgiref.simple_server as wss

    parser = argparse.ArgumentParser(
        description=get_api_wsgi_script.__doc__,
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        usage='%(prog)s [-h] [--port PORT] [--host IP] -- [passed options]')
    parser.add_argument('--port', '-p', type=int, default=8000,
                        help='TCP port to listen on')
    parser.add_argument('--host', '-b', default='',
                        help='IP to bind the server to')
    parser.add_argument('args',
                        nargs=argparse.REMAINDER,
                        metavar='-- [passed options]',
                        help="'--' is the separator of the arguments used "
                        "to start the WSGI server and the arguments passed "
                        "to the WSGI application.")
    args = parser.parse_args()
    if args.args:
        if args.args[0] == '--':
            args.args.pop(0)
        else:
            parser.error("unrecognized arguments: %s" % ' '.join(args.args))
    sys.argv[1:] = args.args
    server = wss.make_server(args.host, args.port, get_api_wsgi_script())

    print("*" * 80)
    print("STARTING test server barbican.api.app.get_api_wsgi_script")
    url = "http://%s:%d/" % (server.server_name, server.server_port)
    print("Available at %s" % url)
    print("DANGER! For testing only, do not use in production")
    print("*" * 80)
    sys.stdout.flush()

    server.serve_forever()

/var/lib/kolla/config_files/src/etc/httpd/conf.d/10-barbican_wsgi_main.conf

# ************************************
# Vhost template in module puppetlabs-apache
# Managed by Puppet
# ************************************
#
<VirtualHost 172.17.1.108:9311>
  ServerName controller-0.internalapi.redhat.local

  ## Vhost docroot
  DocumentRoot "/var/www/cgi-bin/barbican"

  ## Directories, there should at least be a declaration for /var/www/cgi-bin/barbican

  <Directory "/var/www/cgi-bin/barbican">
    Options -Indexes +FollowSymLinks +MultiViews
    AllowOverride None
    Require all granted
  </Directory>

  ## Logging
  ErrorLog "/var/log/httpd/barbican_wsgi_main_error.log"
  ServerSignature Off
  CustomLog "/var/log/httpd/barbican_wsgi_main_access.log" combined
  SetEnvIf X-Forwarded-Proto https HTTPS=1

  ## WSGI configuration
  WSGIApplicationGroup %{GLOBAL}
  WSGIDaemonProcess barbican-api display-name=barbican_wsgi_main group=barbican processes=8 threads=1 user=barbican
  WSGIProcessGroup barbican-api
  WSGIScriptAlias / "/var/www/cgi-bin/barbican/main"
</VirtualHost>
d34dh0r53 commented 1 year ago

/var/lib/kolla/config_files/config.json

{
  "command": "/usr/sbin/httpd -DFOREGROUND",
  "config_files": [
    {
      "dest": "/etc/httpd/conf.d",
      "merge": false,
      "preserve_properties": true,
      "source": "/var/lib/kolla/config_files/src/etc/httpd/conf.d"
    },
    {
      "dest": "/etc/httpd/conf.modules.d",
      "merge": false,
      "preserve_properties": true,
      "source": "/var/lib/kolla/config_files/src/etc/httpd/conf.modules.d"
    },
    {
      "dest": "/",
      "merge": true,
      "preserve_properties": true,
      "source": "/var/lib/kolla/config_files/src/*"
    }
  ]
}