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
-
cmd input
WSL --update
to ensure that WSL is relatively new -
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
-
docker install mysql
docker run --network="host" --name im-mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:latest
-
Download
https://github.com/tinode/chat/releases/
linux package -
Put it in the WSL directory and unzip it
-
Execute
./init-db -data=data.json
-
Execute
./tinode
If you want to start on the server, use
nohup ./tinode >im.out 2>&1 &
-
Check whether the startup is successful
ps aux|grep tinode
-
Open
http://localhost:6060/
-
Login test, user name
bob
passwordbob123
, useralice
passwordalice123
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
-
WSL ensures that git is installed, and extracts the front-end code from an empty directory
git clone https://github.com/tinode/webapp.git
-
WSL ensures that nodejs is installed (refer to nodejs-on-wsl ), installation dependencies
cd webapp
npm i -
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
-
Open
index-dev.html
with the VSCODE Live Server plugin But you need to change127.0.0.1
tolocalhost
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
-
Login test
Top comments (0)