-
Notifications
You must be signed in to change notification settings - Fork 0
/
local_run.sh
59 lines (46 loc) · 1.48 KB
/
local_run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
echo "============================================================================="
echo "Welcome to the setup. This will setup the local virtual env."
echo "And then it will install all the required python libraries."
echo "You can rerun this without any issues."
echo "-----------------------------------------------------------------------------"
if [ -d ".environ" ]; then
echo "Enabling virtual environ"
else
echo "No Virtual environ. Please run local_setup.sh first"
exit 1
fi
# Activate virtual env
. .environ/bin/activate
export ENV=development
# Load environment variables from .env file
if [ -f .env ]; then
echo "Loading environment variables from .env file..."
set -o allexport
source .env
set +o allexport
else
echo ".env file not found. Ensure it exists with necessary credentials."
exit 1
fi
# Check if wkhtmltopdf is installed
if ! command -v wkhtmltopdf &> /dev/null; then
echo "Installing wkhtmltopdf..."
# Install wkhtmltopdf using Homebrew (macOS)
brew install Caskroom/cask/wkhtmltopdf
fi
# Set the path to wkhtmltopdf for pdfkit
export WKHTMLTOPDF_PATH=$(which wkhtmltopdf)
redis-server --daemonize yes
celery -A main.celery beat --loglevel=info &
# Run Celery Worker in the background
celery -A main.celery worker -n worker1 --loglevel=info &
# Run the Flask app
python main.py
# To stop Redis
redis-cli shutdown
# To stop Celery worker
pkill -f 'celery worker'
# To stop Celery beat
pkill -f 'celery beat'
deactivate