File tree 7 files changed +24
-21
lines changed
7 files changed +24
-21
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
3
# Project directory
4
- PROJECTDIR=/webapps/demo-analytics-dev
4
+ PROJECTDIR=/webapps/demo-analytics-dev/src
5
5
# App instance module
6
- ASGI_MODULE=src/ server.asgi
6
+ ASGI_MODULE=server.asgi
7
7
# we will communicte using this unix socket
8
8
SOCKFILE=/webapps/demo-analytics-dev/run/unicorn_dev.sock
9
9
@@ -15,7 +15,7 @@ GROUP=webapps
15
15
# Number of Workers
16
16
NUM_WORKERS=1
17
17
18
- WORKER_CLASS=venv/lib/ uvicorn.workers.UvicornWorker
18
+ WORKER_CLASS=uvicorn.workers.UvicornWorker
19
19
20
20
TIMEOUT=300
21
21
GRACEFUL_TIMEOUT=120
@@ -27,15 +27,15 @@ echo "Starting $NAME as `whoami`"
27
27
28
28
# Activate the virtual environment
29
29
cd $PROJECTDIR
30
- source venv/bin/activate
30
+ source ../ venv/bin/activate
31
31
32
32
# Create the run directory if it doesn't exist
33
33
RUNDIR=$( dirname $SOCKFILE )
34
34
test -d $RUNDIR || mkdir -p $RUNDIR
35
35
36
36
# Start your Unicorn
37
37
# Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)
38
- exec venv/bin/gunicorn ${ASGI_MODULE} :app \
38
+ exec ../ venv/bin/gunicorn ${ASGI_MODULE} :app \
39
39
--worker-class $WORKER_CLASS \
40
40
--workers $NUM_WORKERS \
41
41
--timeout $TIMEOUT \
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
3
# Project directory
4
- PROJECTDIR=/webapps/demo-analytics-pre-dev
4
+ PROJECTDIR=/webapps/demo-analytics-pre-dev/src
5
5
# App instance module
6
- ASGI_MODULE=src/ server.asgi
6
+ ASGI_MODULE=server.asgi
7
7
# we will communicte using this unix socket
8
8
SOCKFILE=/webapps/demo-analytics-pre-dev/run/unicorn_pre_dev.sock
9
9
@@ -15,7 +15,7 @@ GROUP=webapps
15
15
# Number of Workers
16
16
NUM_WORKERS=1
17
17
18
- WORKER_CLASS=venv/lib/ uvicorn.workers.UvicornWorker
18
+ WORKER_CLASS=uvicorn.workers.UvicornWorker
19
19
20
20
TIMEOUT=300
21
21
GRACEFUL_TIMEOUT=120
@@ -27,15 +27,15 @@ echo "Starting $NAME as `whoami`"
27
27
28
28
# Activate the virtual environment
29
29
cd $PROJECTDIR
30
- source venv/bin/activate
30
+ source ../ venv/bin/activate
31
31
32
32
# Create the run directory if it doesn't exist
33
33
RUNDIR=$( dirname $SOCKFILE )
34
34
test -d $RUNDIR || mkdir -p $RUNDIR
35
35
36
36
# Start your Unicorn
37
37
# Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)
38
- exec venv/bin/gunicorn ${ASGI_MODULE} :app \
38
+ exec ../ venv/bin/gunicorn ${ASGI_MODULE} :app \
39
39
--worker-class $WORKER_CLASS \
40
40
--workers $NUM_WORKERS \
41
41
--timeout $TIMEOUT \
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
3
# Project directory
4
- PROJECTDIR=/webapps/demo-analytics
4
+ PROJECTDIR=/webapps/demo-analytics/src
5
5
# App instance module
6
- ASGI_MODULE=src/ server.asgi
6
+ ASGI_MODULE=server.asgi
7
7
# we will communicte using this unix socket
8
8
SOCKFILE=/webapps/demo-analytics/run/unicorn_live.sock
9
9
@@ -15,7 +15,7 @@ GROUP=webapps
15
15
# Number of Workers
16
16
NUM_WORKERS=3
17
17
18
- WORKER_CLASS=venv/lib/ uvicorn.workers.UvicornWorker
18
+ WORKER_CLASS=uvicorn.workers.UvicornWorker
19
19
20
20
TIMEOUT=300
21
21
GRACEFUL_TIMEOUT=120
@@ -27,15 +27,15 @@ echo "Starting $NAME as `whoami`"
27
27
28
28
# Activate the virtual environment
29
29
cd $PROJECTDIR
30
- source venv/bin/activate
30
+ source ../ venv/bin/activate
31
31
32
32
# Create the run directory if it doesn't exist
33
33
RUNDIR=$( dirname $SOCKFILE )
34
34
test -d $RUNDIR || mkdir -p $RUNDIR
35
35
36
36
# Start your Unicorn
37
37
# Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)
38
- exec venv/bin/gunicorn ${ASGI_MODULE} :app \
38
+ exec ../ venv/bin/gunicorn ${ASGI_MODULE} :app \
39
39
--worker-class $WORKER_CLASS \
40
40
--workers $NUM_WORKERS \
41
41
--timeout $TIMEOUT \
Original file line number Diff line number Diff line change 1
1
[program:analytics_dev]
2
- command = /webapps/demo-analytics-dev/conf /gunicorn/analytics-dev.gunicorn.sh
2
+ command = /webapps/demo-analytics-dev/config /gunicorn/analytics-dev.gunicorn.sh
3
3
user = demo-analytics-dev
4
4
# stdout_logfile = /webapps/freadom/dev/log/dev-supervisor.log
5
5
# redirect_stderr = true
Original file line number Diff line number Diff line change 1
1
[program:analytics_pre_dev]
2
- command = /webapps/demo-analytics-pre-dev/conf /gunicorn/analytics-pre-dev.gunicorn.sh
2
+ command = /webapps/demo-analytics-pre-dev/config /gunicorn/analytics-pre-dev.gunicorn.sh
3
3
user = demo-analytics-pre-dev
4
4
# stdout_logfile = /webapps/freadom/dev/log/dev-supervisor.log
5
5
# redirect_stderr = true
Original file line number Diff line number Diff line change 1
1
[program:analytics_live]
2
- command = /webapps/demo-analytics/conf /gunicorn/analytics.gunicorn.sh
2
+ command = /webapps/demo-analytics/config /gunicorn/analytics.gunicorn.sh
3
3
user = demo-analytics
4
4
# stdout_logfile = /webapps/freadom/dev/log/dev-supervisor.log
5
5
# redirect_stderr = true
Original file line number Diff line number Diff line change 1
1
import logging
2
2
import sys
3
+ import os
3
4
from typing import List
4
5
5
6
from starlette .config import Config
6
7
from starlette .datastructures import CommaSeparatedStrings , Secret
7
8
9
+ SRC_DIR = os .path .dirname (os .path .dirname (__file__ ))
10
+
11
+ config = Config (os .path .join (os .path .dirname (SRC_DIR ), ".env" ))
8
12
9
- config = Config (".env" )
10
13
DEBUG : bool = config ("DEBUG" , cast = bool , default = False )
11
14
SECRET_KEY : Secret = config (
12
15
"SECRET_KEY" , default = "UBzPj7Qj29K4z4aeCqZ40xi8dVdTbbch" , cast = Secret
15
18
VERSION : str = config ("VERSION" , default = "1.0.0" )
16
19
MONGO_URI : str = config ("MONGO_URI" , default = "mongodb://127.0.0.1:27017" )
17
20
MONGO_DB_NAME : str = config ("MONGO_DB_NAME" , default = "demo_db" )
18
- MONGO_MAX_POOL_SIZE : int = config ("MONGO_MAX_POOL_SIZE" , default = 2 )
19
- MONGO_MIN_POOL_SIZE : int = config ("MONGO_MIN_POOL_SIZE" , default = 15 )
21
+ MONGO_MAX_POOL_SIZE : int = config ("MONGO_MAX_POOL_SIZE" , default = 15 )
22
+ MONGO_MIN_POOL_SIZE : int = config ("MONGO_MIN_POOL_SIZE" , default = 2 )
20
23
ALLOWED_HOSTS : List [str ] = config (
21
24
"ALLOWED_HOSTS" , cast = CommaSeparatedStrings , default = ""
22
25
)
You can’t perform that action at this time.
0 commit comments