Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | {{/* |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */}} |
| 16 | |
| 17 | set -ex |
| 18 | COMMAND="${@:-start}" |
| 19 | |
| 20 | function start () { |
| 21 | {{- if .Values.manifests.certificates }} |
| 22 | for WSGI_SCRIPT in cinder-wsgi; do |
| 23 | cp -a $(type -p ${WSGI_SCRIPT}) /var/www/cgi-bin/cinder/ |
| 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 | if [ -f /var/run/apache2/apache2.pid ]; then |
| 45 | # Remove the stale pid for debian/ubuntu images |
| 46 | rm -f /var/run/apache2/apache2.pid |
| 47 | fi |
| 48 | # Starts Apache2 |
| 49 | exec {{ .Values.conf.software.apache2.binary }} {{ .Values.conf.software.apache2.start_parameters }} |
| 50 | {{- else }} |
Rico Lin | 5aa4a90 | 2023-11-02 01:30:08 +0800 | [diff] [blame] | 51 | exec uwsgi --ini /etc/cinder/cinder-api-uwsgi.ini |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 52 | {{- end }} |
| 53 | } |
| 54 | |
| 55 | function stop () { |
| 56 | {{- if .Values.manifests.certificates }} |
| 57 | if [ -f /etc/apache2/envvars ]; then |
| 58 | # Loading Apache2 ENV variables |
| 59 | source /etc/apache2/envvars |
| 60 | mkdir -p ${APACHE_RUN_DIR} |
| 61 | fi |
| 62 | {{ .Values.conf.software.apache2.binary }} -k graceful-stop |
| 63 | {{- else }} |
| 64 | kill -TERM 1 |
| 65 | {{- end }} |
| 66 | } |
| 67 | |
| 68 | $COMMAND |