From bef89ec31e3738c714b4d3516cd96528e15b922e Mon Sep 17 00:00:00 2001 From: Andy Ning Date: Fri, 4 Mar 2022 12:58:09 -0500 Subject: [PATCH] Start barbican with gunicorn during bootstrap for Debian Start barbican with gunicorn during bootstrap to align with its startup by SM after unlock. This change also enables barbican to be managed by SM after controller unlock. Test Plan for Debian: PASS: package build, image build PASS: system bootstrap, barbican-api is running with gunicorn PASS: controller unlock, barbican-api service state in SM is enabled-active enabled-active Story: 2009101 Task: 44713 Signed-off-by: Andy Ning Change-Id: Ib2583b0585679753dc871f9ee0202253832283d9 --- ...pi-with-gunicorn-during-bootstrap-fo.patch | 83 +++++++++++++++++++ openstack/barbican/debian/deb_patches/series | 1 + 2 files changed, 84 insertions(+) create mode 100644 openstack/barbican/debian/deb_patches/0002-Start-barbican-api-with-gunicorn-during-bootstrap-fo.patch diff --git a/openstack/barbican/debian/deb_patches/0002-Start-barbican-api-with-gunicorn-during-bootstrap-fo.patch b/openstack/barbican/debian/deb_patches/0002-Start-barbican-api-with-gunicorn-during-bootstrap-fo.patch new file mode 100644 index 00000000..3e21860c --- /dev/null +++ b/openstack/barbican/debian/deb_patches/0002-Start-barbican-api-with-gunicorn-during-bootstrap-fo.patch @@ -0,0 +1,83 @@ +From 31cab241e50e2fc99f257c5e9a1a006c66b7041f Mon Sep 17 00:00:00 2001 +From: Andy Ning +Date: Thu, 3 Mar 2022 19:34:02 +0000 +Subject: [PATCH] Start barbican-api with gunicorn during bootstrap for Debian + +Signed-off-by: Andy Ning +--- + debian/barbican-api.install | 2 +- + debian/barbican-api.service.in | 19 +++++++++++++++++++ + debian/barbican-common.install | 1 + + debian/gunicorn-config.py | 16 ++++++++++++++++ + 4 files changed, 37 insertions(+), 1 deletion(-) + create mode 100644 debian/barbican-api.service.in + create mode 100644 debian/gunicorn-config.py + +diff --git a/debian/barbican-api.install b/debian/barbican-api.install +index 05ddad9..3d8f2b4 100644 +--- a/debian/barbican-api.install ++++ b/debian/barbican-api.install +@@ -1 +1 @@ +-debian/barbican-api-uwsgi.ini /etc/barbican ++debian/gunicorn-config.py /etc/barbican +diff --git a/debian/barbican-api.service.in b/debian/barbican-api.service.in +new file mode 100644 +index 0000000..197a281 +--- /dev/null ++++ b/debian/barbican-api.service.in +@@ -0,0 +1,19 @@ ++[Unit] ++Description=Openstack Barbican API server ++After=syslog.target network.target ++Before=httpd.service ++ ++[Service] ++PIDFile=/run/barbican/pid ++User=barbican ++Group=barbican ++RuntimeDirectory=barbican ++RuntimeDirectoryMode=770 ++ExecStart=/usr/bin/gunicorn --pid /run/barbican/pid -c /etc/barbican/gunicorn-config.py --paste /etc/barbican/barbican-api-paste.ini ++ExecReload=/usr/bin/kill -s HUP $MAINPID ++ExecStop=/usr/bin/kill -s TERM $MAINPID ++StandardError=syslog ++Restart=on-failure ++ ++[Install] ++WantedBy=multi-user.target +diff --git a/debian/barbican-common.install b/debian/barbican-common.install +index 663fdc8..f1944b5 100644 +--- a/debian/barbican-common.install ++++ b/debian/barbican-common.install +@@ -1,5 +1,6 @@ + bin/barbican-api /usr/bin + usr/bin/* ++etc/barbican/api_audit_map.conf etc/barbican + etc/barbican/barbican-api-paste.ini etc/barbican + etc/barbican/barbican.conf etc/barbican + etc/barbican/vassals/barbican-api.ini etc/barbican/vassals +diff --git a/debian/gunicorn-config.py b/debian/gunicorn-config.py +new file mode 100644 +index 0000000..c8c1e07 +--- /dev/null ++++ b/debian/gunicorn-config.py +@@ -0,0 +1,16 @@ ++import multiprocessing ++ ++bind = '0.0.0.0:9311' ++user = 'barbican' ++group = 'barbican' ++ ++timeout = 30 ++backlog = 2048 ++keepalive = 2 ++ ++workers = multiprocessing.cpu_count() * 2 ++ ++loglevel = 'info' ++errorlog = '-' ++accesslog = '-' ++ +-- +2.30.2 + diff --git a/openstack/barbican/debian/deb_patches/series b/openstack/barbican/debian/deb_patches/series index 038a5b27..272a6679 100644 --- a/openstack/barbican/debian/deb_patches/series +++ b/openstack/barbican/debian/deb_patches/series @@ -1 +1,2 @@ 0001-Remove-dbconfig-and-openstack-pkg-tools-config.patch +0002-Start-barbican-api-with-gunicorn-during-bootstrap-fo.patch