Code Monkey home page Code Monkey logo

chat-app's Introduction

Important note: Please keep in mind that this app is in its very early stage, be forgiving.

Chat App

General info

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.

Usage

Development

This setup is ready for developing inside VSCode Dev Container.

  1. Start docker-sync and wait for it to get up:
    docker-sync start
    
  2. Run the Docker Compose:
    • If you're using VSCode, use devcontainer.json file in frontend or backend 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
    
  3. 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
    
  4. Done! To verify it's working, check the exposed ports inside docker-compose.development.yml file.

Production

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:

  1. Setup a Web Server with a reverse proxy to exposed ports for both backend and frontend.
  2. Run the Docker Compose in deteached mode.

chat-app's People

Contributors

mszan avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.