Skip to content

Commit

Permalink
Update cookiecutter generated files (#595)
Browse files Browse the repository at this point in the history
* Update cookiecutter generated files

* Fix pydantic version comparison bug
  • Loading branch information
kumaranvpl authored Nov 21, 2024
1 parent 6ea92d4 commit 6966647
Show file tree
Hide file tree
Showing 42 changed files with 68 additions and 134 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
my_fastagency_app
├── deployment
│   └── firebase
│   ├── allowed_users.yaml
│   └── firebase_config.yaml
├── docker
│   ├── content
│   │   ├── nginx.conf.template
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ map $fly_machine_id $sticky_action {

# Main server block
server {
listen $MESOP_PORT;
listen $SERVICE_PORT;
server_name localhost;

# Security headers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

FASTAPI_PORT=${FASTAPI_PORT:-8008}


export MESOP_PORT=${MESOP_PORT:-8888}
export SERVICE_PORT=$MESOP_PORT

# Default number of workers if not set
WORKERS=${WORKERS:-1}
Expand All @@ -18,24 +20,26 @@ echo "Fly machine ID: $FLY_MACHINE_ID"
# Generate nginx config
for ((i=1; i<$WORKERS+1; i++))
do
PORT=$((MESOP_PORT + i))
PORT=$((SERVICE_PORT + i))
sed -i "5i\ server 127.0.0.1:$PORT;" nginx.conf.template
done
envsubst '${MESOP_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf
envsubst '${SERVICE_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf
echo "Nginx config:"
cat /etc/nginx/conf.d/default.conf

# Start nginx
nginx -g "daemon off;" &


# Run uvicorn server
uvicorn my_fastagency_app.deployment.main_1_fastapi:app --host 0.0.0.0 --port $FASTAPI_PORT > /dev/stdout 2>&1 &


# Run gunicorn server
# Start multiple single-worker gunicorn instances on consecutive ports
for ((i=1; i<$WORKERS+1; i++))
do
PORT=$((MESOP_PORT + i))
PORT=$((SERVICE_PORT + i))
echo "Starting gunicorn on port $PORT"
gunicorn --workers=1 my_fastagency_app.deployment.main_2_mesop:app --bind 0.0.0.0:$PORT > /dev/stdout 2>&1 &
done
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8008:8008 -p 8888:8888 deploy_fastagency
docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8008:8008 -p 8888:8888 deploy_fastagency
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
my_fastagency_app
├── deployment
│   └── firebase
│   ├── allowed_users.yaml
│   └── firebase_config.yaml
├── docker
│   ├── content
│   │   ├── nginx.conf.template
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ map $fly_machine_id $sticky_action {

# Main server block
server {
listen $MESOP_PORT;
listen $SERVICE_PORT;
server_name localhost;

# Security headers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# Accept env variable for PORT



export MESOP_PORT=${MESOP_PORT:-8888}
export SERVICE_PORT=$MESOP_PORT

# Default number of workers if not set
WORKERS=${WORKERS:-1}
Expand All @@ -16,24 +18,26 @@ echo "Fly machine ID: $FLY_MACHINE_ID"
# Generate nginx config
for ((i=1; i<$WORKERS+1; i++))
do
PORT=$((MESOP_PORT + i))
PORT=$((SERVICE_PORT + i))
sed -i "5i\ server 127.0.0.1:$PORT;" nginx.conf.template
done
envsubst '${MESOP_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf
envsubst '${SERVICE_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf
echo "Nginx config:"
cat /etc/nginx/conf.d/default.conf

# Start nginx
nginx -g "daemon off;" &


# Run uvicorn server
uvicorn my_fastagency_app.deployment.main_:app --host 0.0.0.0 --port $FASTAPI_PORT > /dev/stdout 2>&1 &


# Run gunicorn server
# Start multiple single-worker gunicorn instances on consecutive ports
for ((i=1; i<$WORKERS+1; i++))
do
PORT=$((MESOP_PORT + i))
PORT=$((SERVICE_PORT + i))
echo "Starting gunicorn on port $PORT"
gunicorn --workers=1 my_fastagency_app.deployment.main:app --bind 0.0.0.0:$PORT > /dev/stdout 2>&1 &
done
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8888:8888 deploy_fastagency
docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8888:8888 deploy_fastagency
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
my_fastagency_app
├── deployment
│   └── firebase
│   ├── allowed_users.yaml
│   └── firebase_config.yaml
├── docker
│   ├── content
│   │   ├── nginx.conf.template
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ map $fly_machine_id $sticky_action {

# Main server block
server {
listen $MESOP_PORT;
listen $SERVICE_PORT;
server_name localhost;

# Security headers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ NATS_FASTAPI_PORT=${NATS_FASTAPI_PORT:-8000}

FASTAPI_PORT=${FASTAPI_PORT:-8008}


export MESOP_PORT=${MESOP_PORT:-8888}
export SERVICE_PORT=$MESOP_PORT

# Default number of workers if not set
WORKERS=${WORKERS:-1}
Expand All @@ -20,10 +22,10 @@ echo "Fly machine ID: $FLY_MACHINE_ID"
# Generate nginx config
for ((i=1; i<$WORKERS+1; i++))
do
PORT=$((MESOP_PORT + i))
PORT=$((SERVICE_PORT + i))
sed -i "5i\ server 127.0.0.1:$PORT;" nginx.conf.template
done
envsubst '${MESOP_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf
envsubst '${SERVICE_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf
echo "Nginx config:"
cat /etc/nginx/conf.d/default.conf

Expand All @@ -33,14 +35,16 @@ nginx -g "daemon off;" &
# Run nats uvicorn server
uvicorn my_fastagency_app.deployment.main_1_nats:app --host 0.0.0.0 --port $NATS_FASTAPI_PORT > /dev/stdout 2>&1 &


# Run uvicorn server
uvicorn my_fastagency_app.deployment.main_2_fastapi:app --host 0.0.0.0 --port $FASTAPI_PORT > /dev/stdout 2>&1 &


# Run gunicorn server
# Start multiple single-worker gunicorn instances on consecutive ports
for ((i=1; i<$WORKERS+1; i++))
do
PORT=$((MESOP_PORT + i))
PORT=$((SERVICE_PORT + i))
echo "Starting gunicorn on port $PORT"
gunicorn --workers=1 my_fastagency_app.deployment.main_3_mesop:app --bind 0.0.0.0:$PORT > /dev/stdout 2>&1 &
done
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
my_fastagency_app
├── deployment
│   └── firebase
│   ├── allowed_users.yaml
│   └── firebase_config.yaml
├── docker
│   ├── content
│   │   ├── nginx.conf.template
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ map $fly_machine_id $sticky_action {

# Main server block
server {
listen $MESOP_PORT;
listen $SERVICE_PORT;
server_name localhost;

# Security headers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

FASTAPI_PORT=${FASTAPI_PORT:-8008}


export MESOP_PORT=${MESOP_PORT:-8888}
export SERVICE_PORT=$MESOP_PORT

# Default number of workers if not set
WORKERS=${WORKERS:-1}
Expand All @@ -18,24 +20,26 @@ echo "Fly machine ID: $FLY_MACHINE_ID"
# Generate nginx config
for ((i=1; i<$WORKERS+1; i++))
do
PORT=$((MESOP_PORT + i))
PORT=$((SERVICE_PORT + i))
sed -i "5i\ server 127.0.0.1:$PORT;" nginx.conf.template
done
envsubst '${MESOP_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf
envsubst '${SERVICE_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf
echo "Nginx config:"
cat /etc/nginx/conf.d/default.conf

# Start nginx
nginx -g "daemon off;" &


# Run uvicorn server
uvicorn my_fastagency_app.deployment.main_1_fastapi:app --host 0.0.0.0 --port $FASTAPI_PORT > /dev/stdout 2>&1 &


# Run gunicorn server
# Start multiple single-worker gunicorn instances on consecutive ports
for ((i=1; i<$WORKERS+1; i++))
do
PORT=$((MESOP_PORT + i))
PORT=$((SERVICE_PORT + i))
echo "Starting gunicorn on port $PORT"
gunicorn --workers=1 my_fastagency_app.deployment.main_2_mesop:app --bind 0.0.0.0:$PORT > /dev/stdout 2>&1 &
done
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8008:8008 -p 8888:8888 deploy_fastagency
docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8008:8008 -p 8888:8888 deploy_fastagency
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
my_fastagency_app
├── deployment
│   └── firebase
│   ├── allowed_users.yaml
│   └── firebase_config.yaml
├── docker
│   ├── content
│   │   ├── nginx.conf.template
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ map $fly_machine_id $sticky_action {

# Main server block
server {
listen $MESOP_PORT;
listen $SERVICE_PORT;
server_name localhost;

# Security headers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# Accept env variable for PORT



export MESOP_PORT=${MESOP_PORT:-8888}
export SERVICE_PORT=$MESOP_PORT

# Default number of workers if not set
WORKERS=${WORKERS:-1}
Expand All @@ -16,24 +18,26 @@ echo "Fly machine ID: $FLY_MACHINE_ID"
# Generate nginx config
for ((i=1; i<$WORKERS+1; i++))
do
PORT=$((MESOP_PORT + i))
PORT=$((SERVICE_PORT + i))
sed -i "5i\ server 127.0.0.1:$PORT;" nginx.conf.template
done
envsubst '${MESOP_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf
envsubst '${SERVICE_PORT},${FLY_MACHINE_ID}' < nginx.conf.template >/etc/nginx/conf.d/default.conf
echo "Nginx config:"
cat /etc/nginx/conf.d/default.conf

# Start nginx
nginx -g "daemon off;" &


# Run uvicorn server
uvicorn my_fastagency_app.deployment.main_:app --host 0.0.0.0 --port $FASTAPI_PORT > /dev/stdout 2>&1 &


# Run gunicorn server
# Start multiple single-worker gunicorn instances on consecutive ports
for ((i=1; i<$WORKERS+1; i++))
do
PORT=$((MESOP_PORT + i))
PORT=$((SERVICE_PORT + i))
echo "Starting gunicorn on port $PORT"
gunicorn --workers=1 my_fastagency_app.deployment.main:app --bind 0.0.0.0:$PORT > /dev/stdout 2>&1 &
done
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8888:8888 deploy_fastagency
docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8888:8888 deploy_fastagency
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
my_fastagency_app
├── deployment
│   └── firebase
│   ├── allowed_users.yaml
│   └── firebase_config.yaml
├── docker
│   ├── content
│   │   ├── nginx.conf.template
Expand Down

This file was deleted.

Loading

0 comments on commit 6966647

Please sign in to comment.