blob: 108438652d260d52054aa0b8b2899cedc2a35955 [file] [log] [blame]
Mohammed Naserf3f59a72023-01-15 21:02:04 -05001#!/bin/bash
2
3{{/*
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17set -ex
18COMMAND="${@:-start}"
19
20function start () {
21{{- if .Values.manifests.certificates }}
22 for WSGI_SCRIPT in nova-api-wsgi; do
23 cp -a $(type -p ${WSGI_SCRIPT}) /var/www/cgi-bin/nova/
24 done
25
26 if [ -f /etc/apache2/envvars ]; then
27 # Loading Apache2 ENV variables
28 source /etc/apache2/envvars
29 mkdir -p ${APACHE_RUN_DIR}
30 fi
31
32{{- if .Values.conf.software.apache2.a2enmod }}
33 {{- range .Values.conf.software.apache2.a2enmod }}
34 a2enmod {{ . }}
35 {{- end }}
36{{- end }}
37
38{{- if .Values.conf.software.apache2.a2dismod }}
39 {{- range .Values.conf.software.apache2.a2dismod }}
40 a2dismod {{ . }}
41 {{- end }}
42{{- end }}
43
44
45 if [ -f /var/run/apache2/apache2.pid ]; then
46 # Remove the stale pid for debian/ubuntu images
47 rm -f /var/run/apache2/apache2.pid
48 fi
49 # Starts Apache2
50 exec {{ .Values.conf.software.apache2.binary }} {{ .Values.conf.software.apache2.start_parameters }}
51{{- else }}
Mohammed Naser69247252023-09-26 22:23:46 -040052 exec uwsgi --ini /etc/nova/nova-api-uwsgi.ini
Mohammed Naserf3f59a72023-01-15 21:02:04 -050053{{- end }}
54}
55
56function stop () {
57{{- if .Values.manifests.certificates }}
58 if [ -f /etc/apache2/envvars ]; then
59 source /etc/apache2/envvars
60 fi
61 {{ .Values.conf.software.apache2.binary }} -k graceful-stop
62{{- else }}
63 kill -TERM 1
64{{- end }}
65}
66
67$COMMAND