Skip to content

rubygitflow/blah_blah_chat

Repository files navigation

blah_blah_chat

Tests

Demo App written in Hotwire

Here we can add topics and post messages. Stimulus allows us to process posts on a single page. Turbo allows us to monitor the changes from any chat in real time.

Article: https://habr.com/ru/articles/781940/

Setup

Configure the database in config/database.yml

$ rails db:setup

or install all yarn and database dependencies with one command

$ bin/setup

Run the App

$ rails s

or in dev environment

$ bin/dev

Open the app http://localhost:3000 in the browser

API

$ http -f get ":3000/api/v1/chats"
$ http -f post ":3000/api/v1/chats/1/posts" "post[body]=New message"
$ http -f post ":3000/api/v1/chats/1/posts" "post[body]=New message" "highlight="

More details can be found in /blah-blah-chat-api-spec.jst or in JSight API repository .

Run tests

$ rspec ./spec

or

HEADLESS=true rspec ./spec

or

HEADLESS=1 rspec ./spec

Check syntax

$ rubocop

Create docker image

$ docker build . -t blah-blah-chat:1.1

Run docker container inside the application folder

  1. Start the container with any linked services
$ docker compose up
  1. Look at Health monitoring
$ watch -n1 docker ps
  1. Call the application in the browser from the docker container

http://localhost:3322

Run the docker container on a clean computer

  1. Install and run Docker Desktop on the system

see here https://docs.docker.com/compose/install

  1. Create a folder for docker configuration files

  2. Download docker-compose.yml from the below link inside the created folder

https://github.com/rubygitflow/blah_blah_chat/blob/master/docker-compose.yml

  1. Download env-example from the below link inside the created folder and rename it to .env

https://github.com/rubygitflow/blah_blah_chat/blob/master/env-example

  1. Run this command in a terminal inside the folder with the docker-compose.yml and .env files
sudo docker compose up
  1. Call the application in the browser from the docker container

http://localhost:3322