Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds standalone server setup #497

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions infra.docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: "3.9"

services:
db:
image: postgres:11
environment:
- POSTGRES_DB=${POSTGRES_DB:-db}
- POSTGRES_USER=${POSTGRES_USER:-user}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-pass}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- mynetwork

redis:
image: "redis:alpine"
ports:
- "6379:6379"
networks:
- mynetwork

fluentd:
build:
context: ./fluentd
dockerfile: Dockerfile
image: fluent/fluentd:v1.12-debian-1
volumes:
- ./fluentd/fluentd.conf:/fluentd/etc/fluent.conf
ports:
- "24224:24224"
- "24224:24224/udp"
networks:
- mynetwork

networks:
mynetwork:

volumes:
postgres_data:
79 changes: 79 additions & 0 deletions start_all_services.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash

# Exit script on any error
set -e

# Step 1: Set environment variables (adjust as needed)
export DJANGO_DEBUG=True
export CELERY_BROKER_URL=redis://localhost:6379/0
export CELERY_RESULT_BACKEND=redis://localhost:6379/0
export REDIS_URL=redis://localhost:6379/0
export POSTGRES_DB=db
export POSTGRES_USER=user
export POSTGRES_PASSWORD=pass
export POSTGRES_HOST=localhost
export POSTGRES_PORT=5432
export FLUENTD_ADDRESS=localhost:24224
# export OKTA_DOMAIN=your-okta-domain
# export OKTA_CLIENT_ID=your-okta-client-id

# Step 2: Set up Python virtual environment

echo "Setting up Python virtual environment..."

# Create the virtual environment using python3 -m venv
if [ ! -d "venv" ]; then
python3 -m venv venv
echo "Virtual environment created successfully."
fi

# Activate the virtual environment
source venv/bin/activate

# Step 3: Install Python dependencies
echo "Installing Python dependencies..."
pip install --upgrade pip # Upgrade pip to avoid any issues with older versions
pip install -r requirements.txt

# Step 4: Install frontend dependencies
echo "Installing frontend dependencies..."
cd web
npm install

# Step 5: Start the services

# Start Django server
echo "Starting Django server..."
cd ..
python manage.py runserver 0.0.0.0:8080 &

# Start Celery workers
echo "Starting Celery workers..."
celery -A playbooks worker --concurrency=10 -l INFO -Ofair -Q celery --max-tasks-per-child=1000 --prefetch-multiplier=1 &

# Start Workflow Scheduler Celery Worker
echo "Starting Workflow Scheduler Celery Worker..."
celery -A playbooks worker --concurrency=10 -l INFO -Ofair -Q workflow_scheduler --max-tasks-per-child=1000 --prefetch-multiplier=1 &

# Start Workflow Executor Celery Worker
echo "Starting Workflow Executor Celery Worker..."
celery -A playbooks worker --concurrency=10 -l INFO -Ofair -Q workflow_executor --max-tasks-per-child=1000 --prefetch-multiplier=1 &

# Start Workflow Action Execution Celery Worker
echo "Starting Workflow Action Execution Celery Worker..."
celery -A playbooks worker --concurrency=10 -l INFO -Ofair -Q workflow_action_execution --max-tasks-per-child=1000 --prefetch-multiplier=1 &

# Start Celery Beat
echo "Starting Celery Beat..."
celery -A playbooks beat --loglevel=info &

# Start the Web frontend
echo "Starting the Web frontend..."
cd web
npm run build && npm run start &

# Step 6: Verify services are running
echo "All services started successfully. Monitoring logs..."

# Keep the script running so that the services remain active
tail -f /dev/null
Loading