-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from telefonicaid/feature/CLAUDIA-5625_supervisor
Instructions and scripts to run with supervisor.
- Loading branch information
Showing
3 changed files
with
97 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/sh | ||
# -*- encoding: utf-8 -*- | ||
# | ||
# Copyright 2014 Telefónica Investigación y Desarrollo, S.A.U | ||
# | ||
# This file is part of FI-WARE project. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# | ||
# You may obtain a copy of the License at: | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# For those usages not covered by the Apache version 2.0 License please | ||
# contact with [email protected] | ||
# | ||
# File to execute fiware-facts component | ||
# | ||
NAME="fiware_facts" # Name of the application | ||
SOCKFILE=/var/run/gunicorn.sock # we will communicate using this unix socket | ||
USER=root # the user to run as | ||
GROUP=root # the group to run as | ||
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn | ||
DJANGO_WSGI_MODULE=facts.server:app # WSGI module name | ||
LOCAL_IP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'` | ||
|
||
echo "Starting $NAME as `whoami`" | ||
|
||
# Create the run directory if it doesn't exist | ||
RUNDIR=$(dirname $SOCKFILE) | ||
test -d $RUNDIR || mkdir -p $RUNDIR | ||
|
||
exec gunicorn ${DJANGO_WSGI_MODULE} \ | ||
-b $LOCAL_IP:5000 \ | ||
--bind=unix:$SOCKFILE \ | ||
--name $NAME \ | ||
--workers $NUM_WORKERS \ | ||
--user=$USER --group=$GROUP \ | ||
--log-file=- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[program:fiware-facts] | ||
command = /etc/fiware.d/facts_start ; Command to start app | ||
user = root ; User to run as | ||
stdout_logfile = /var/log/fiware-facts/gunicorn_supervisor.log ; Where to write log messages | ||
redirect_stderr = true ; Save stderr in the same log | ||
environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8 ; Set UTF-8 as default encoding |