Musicroom Documentation
Brief guide on how to start working on the project.
About the codebase π
The whole repo is divided into 3 parts
Django Server
- Location:
/server
- This is the main django server serving files, APIs and implementing most of the features.
Live server
- Location:
/liveServer
- This is the nodeJS server is used to push realtime updates to clients via websockets and also implements the group chat feature, it listens to updates from the main server via
Redis
pub/sub feature and relays the updates to appropriate rooms and clients. It usesMongoDB
for storing chat messages andsocket.io
to connecting with clients.
React codebase
- Location:
/webapp
- This is the React Frontend codebase that gets bundled and served by our main server.
How to start working on the server code β
This codebase is in Django
Create a virtualenv π
virtualenv venv
Activate our python virtual environment β
venv\Scripts\activate
Install all required packages π¦
pip install -r requirements.txt
After making changes to static files
python manage.py collectstatic
After modifying database models, generate necessary migration code πΎ
python manage.py makemigrations musicroom
Apply any database migration πΏ
python manage.py migrate --run-syncdb
Run server in dev mode πββοΈ
python manage.py runserver 0.0.0.0:8000
Run server in production mode π
(This will only work on linux)
gunicorn -b 0.0.0.0:80 musicroom.wsgi
Env variables for django β
For local setup, you can also use settings_dev.py
file
DJ_SECRET_KEY
: Django secret keyBASE_URL
: Root url of the server. eg:https://example.com
DATABASE_URL
: eg:postgres://user:password@localhost/dbname
DOMAIN_NAME
: eg:example.com
LIVE_ACCESS_KEY
: A random string that needs to be same both servers. eg:xx-access-key-xx
LIVE_URL
: Thesocket.io
url of the live server. eg:https://live.friendzone.live/updates
REDIS_URL
: eg:redis://user1:password@redis.example.com:31949
SNAPKIT_CLIENT_ID
: Optional
How to start working on the Live server code β
This codebase is in NodeJs
Install all required packages π¦
npm i
Env variables for NodeJs
For local setup, you can also use .env
file
MAIN_SERVER_URL
: eg:https://example.com
if running on same machine as main server, you can use the local address ielocalhost:port
ACCESS_KEY
: Same access key set in the main server.REDIS_URL
: Should be same as main serverMONGO_URL
: eg:mongodb://localhost:27017/mr
MAIN_SERVER_PUBLIC_URL
: eg:https://example.com
Run server
node index.js