Important note: Please keep in mind that this app is in its very early stage, be forgiving.
This is a dockerized real-time web chat app built with ReactJS, Django Rest Framework, WebSockets and Postgres.
In details, backend is built on top of Django and uses: Django Rest Framework, Django Channels, Postgres. Frontend is built on top of ReactJS and uses Ant Design as its main component library.
This setup is ready for developing inside VSCode Dev Container.
- Start docker-sync and wait for it to get up:
docker-sync start
- Run the Docker Compose:
- If you're using VSCode, use
devcontainer.json
file infrontend
orbackend
directory as described here. - If you're not using VSCode, start the development Docker Compose directly by running:
docker-compose -f docker-compose.development.yml up
- If you're using VSCode, use
- Make Django migrations from the inside of the container.
docker exec -it chat-app_backend /bin/bash
root@foo:/app# python3 manage.py makemigrations
root@foo:/app# python3 manage.py migrate
- Done! To verify it's working, check the exposed ports inside docker-compose.development.yml file.
Although this repository has been equipped with CI/CD to handle production deployment, the following section describes a manual setup.
This setup requires you to pass the following args:
-
SERVICE_POSTGRES_PASSWORD (e.g.: postgres) - database password
-
SERVICE_POSTGRES_DATA_LOC (e.g.: /p)ath/to/postgres/data - database external volume location
-
SERVICE_POSTGRES_PORT (e.g.: 6030) - exposed to host database port
-
SERVICE_REDIS_PORT (e.g.: 6020) - exposed to host redis port
-
SERVICE_BACKEND_PORT (e.g.: 6010) - exposed to host backend port
-
SERVICE_BACKEND_DJANGO_SETTINGS_MODULE (e.g.: src.)settings.production - django settings module env variable
-
SERVICE_BACKEND_DJANGO_SECRET_KEY (e.g.: FOO123) - django settings secret key
-
SERVICE_FRONTEND_ARG_REACT_APP_BACKEND_WEBSOCKET_URL (e.g.: wss://example. - pl/ws/) - backend WebSocket endpoint
Note: This needs a web server WebSocket reverse proxy to be set.
-
SERVICE_FRONTEND_ARG_REACT_APP_BACKEND_API_URL (e.g.: https://example.com/api) - backend base API endpoint
-
SERVICE_FRONTEND_PORT (e.g.: 6000) - exposed to host frontend port
Besides that, you should do the following:
- Setup a Web Server with a reverse proxy to exposed ports for both backend and frontend.
- Run the Docker Compose in deteached mode.