Setup on local machine
This doc should guide on how to setup playbooks project on your local
The Playbooks project has multiple components:
- ReactJs application
- Python Django backend server
- Celery beat
- 4 Celery workers listening on 4 different queues
- Redis
- Postgres DB
For development, you should keep all components deployed via the docker compose file. The one you are developing, you can deploy in local.
For the remaining, setup using the following scripts (all run from root directory in different terminal windows):
Note :- Replace the DB credentials if you have changed them
- Backend Server
export POSTGRES_HOST=localhost export POSTGRES_USER=user export POSTGRES_DB=db export POSTGRES_PASSWORD=pass export CELERY_BROKER_URL=redis://localhost:6379/0 export CELERY_RESULT_BACKEND=redis://localhost:6379/0 export REDIS_URL=redis://localhost:6379/0 python3 manage.py runserver 0.0.0.0:8080
- Celery beat
export POSTGRES_HOST=localhost export POSTGRES_USER=user export POSTGRES_DB=db export POSTGRES_PASSWORD=pass export CELERY_BROKER_URL=redis://localhost:6379/0 export CELERY_RESULT_BACKEND=redis://localhost:6379/0 export REDIS_URL=redis://localhost:6379/0 sh scripts/start-celery-beat.sh
- Celery worker
export POSTGRES_HOST=localhost export POSTGRES_USER=user export POSTGRES_DB=db export POSTGRES_PASSWORD=pass export CELERY_BROKER_URL=redis://localhost:6379/0 export CELERY_RESULT_BACKEND=redis://localhost:6379/0 export REDIS_URL=redis://localhost:6379/0 sh scripts/start-celery-worker.sh
- Scheduler Celery worker
export POSTGRES_HOST=localhost export POSTGRES_USER=user export POSTGRES_DB=db export POSTGRES_PASSWORD=pass export CELERY_BROKER_URL=redis://localhost:6379/0 export CELERY_RESULT_BACKEND=redis://localhost:6379/0 export REDIS_URL=redis://localhost:6379/0 export CELERY_QUEUE=workflow_scheduler sh scripts/start-celery-worker.sh
- Executor Celery worker
export POSTGRES_HOST=localhost export POSTGRES_USER=user export POSTGRES_DB=db export POSTGRES_PASSWORD=pass export CELERY_BROKER_URL=redis://localhost:6379/0 export CELERY_RESULT_BACKEND=redis://localhost:6379/0 export REDIS_URL=redis://localhost:6379/0 export CELERY_QUEUE=workflow_executor sh scripts/start-celery-worker.sh
- Action Execution Celery worker
export POSTGRES_HOST=localhost export POSTGRES_USER=user export POSTGRES_DB=db export POSTGRES_PASSWORD=pass export CELERY_BROKER_URL=redis://localhost:6379/0 export CELERY_RESULT_BACKEND=redis://localhost:6379/0 export REDIS_URL=redis://localhost:6379/0 export CELERY_QUEUE=workflow_action_execution sh scripts/start-celery-worker.sh
- ReactJs application
- Create a nginx.local.conf file in
web
directory with the following:events {} http { upstream prototype { server localhost:8080; } upstream ui { server localhost:3000; } server { listen 80; client_max_body_size 10M; gzip on; gzip_vary on; gzip_proxied any; gzip_comp_level 6; gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml; location /accounts/confirm-email/ { proxy_pass http://ui; } location /e/ { proxy_pass http://prototype; } location /accounts { proxy_pass http://prototype; } location /media { proxy_pass http://prototype; } location /connectors/ { proxy_pass http://prototype; } location /pb/ { proxy_pass http://prototype; } location /executor/ { proxy_pass http://prototype; } location /management { proxy_pass http://prototype; } location / { proxy_pass http://ui; } } access_log /dev/stdout; }
- Start the nginx server (inside web directory)
nginx -c $PWD/nginx.local.conf -g "daemon off;"
- Create a nginx.local.conf file in
Updated 4 months ago