How to setup your dev environment for editing & contributing code?

Mohit GoyalMohit Goyal
2 min read

Playbooks is a web server application that interacts with a Django API server via Nginx. It also includes salary workers for scheduling asynchronous tasks and a persistence layer consisting of Postgres and Redis cache.

Setup Phase

Step 1: Ensure a running instance of Postgres and Redis on the local machine. Installation guides are available for different machine types to set up Postgres and Redis. Alternatively, Docker can be used for the same purpose.

Step 2: Use the DB Docker Compose file located in the Docker folder to set up Postgres and Redis.

Step 3: Verify the setup by checking Docker Desktop to see if both instances are running.

Build Phase

Step 4: Create all the tables and relations between them that the API server will use by running the command

python manage.py migrate

Step 5: Confirm the creation of all tables and relations in the Postgres DB using a tool like Postico.

Run Phase

Step 6: Start the API server on the local machine using the below command

python manage.py runserver

The server will run on port 8000, but the port can be changed according to preference.

Step 7: Go to the web folder and use the following command to bring up the React application

npm start

Step 8: Inside the web folder, use the command shown to start the Nginx server. This ensures the React application can connect with the Django application.

nginx -c $PWD/nginx.local.conf -g "daemon off;"

Step 9: Once both servers are running, open a browser and go to localhost to see the running application.

Testing Changes

Step 10: Test changes by creating a playbook and an HTTP task. For example, remove the method field in the API task and save the changes.

Step 11: Django will load the changes and restart the server. Refresh the application platform and try to create an API task. The method field should be missing.

Step 12: To restore the method field, undo the changes, save, and refresh the page. Try to create the task again.

For further assistance with local setup, refer to the details mentioned in the github project. The contribution page includes a link to the playbook architecture and local setup guide.

0
Subscribe to my newsletter

Read articles from Mohit Goyal directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Mohit Goyal
Mohit Goyal