Open Source IM System Tinode Deployment Tutorial|WSL Environment

Introduction

Our requirement is to deploy an IM system locally, choose tinode. In order to facilitate the startup of the backend, we use the WSL environment and install the database with docker to start the IM application.

Solution

WSL starts front-end and back-end services

  1. cmd input WSL --update to ensure that WSL is relatively new

  2. Enter WSL with cmd, make sure docker is installed, docker ps -a to see if it starts.

    if prompted

    wsl Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
    

    Need to start docker: sudo service docker start

  3. docker install mysql

    docker run --network="host" --name im-mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:latest
    
  4. Download https://github.com/tinode/chat/releases/ linux package

  5. Put it in the WSL directory and unzip it

  6. Execute ./init-db -data=data.json

  7. Execute ./tinode

    If you want to start on the server, use

    nohup ./tinode >im.out 2>&1 &
    
  8. Check whether the startup is successful ps aux|grep tinode

  9. Open http://localhost:6060/

  10. Login test, user name bob password bob123, user alice password alice123

The local deployment has been completed. If you want to modify the front-end code, the front-end needs to pull it from another repository

Front-end development

First make sure that the back-end has started normally, and then look at the front-end part alone

  1. WSL ensures that git is installed, and extracts the front-end code from an empty directory

    git clone https://github.com/tinode/webapp.git
    
  2. WSL ensures that nodejs is installed (refer to nodejs-on-wsl ), installation dependencies

    cd webapp
    npm i
    
  3. Package after modifying the code His project does not have a development mode, and it can only be repackaged after each modification

    npm run build
    
  4. Open index-dev.html with the VSCODE Live Server plugin But you need to change 127.0.0.1 to localhost

    http://localhost:8080/index-dev.html`
    

    Every time you open it, it is best to clear the browser cache and refresh

    How to clear the browser cache: Open the browser console, right-click the refresh button on the left side of the address bar, click Empty cache and hard refresh

  5. Login test

Reference

Comments