follow the document to run the telegramd in your custom development environment. etcd, mysql and redis are required components. for sake of simplicity docker is applied :-)
- Install Docker for Ubuntu. for version 18.04 see Ubuntu-18-04
- Install Docker for Mac
- Install Docker for Windows
to pull and run etcd container enter the following command in the shell:
$ docker run --name etcd-docker -d -p 2379:2379 -p 2380:2380 appcelerator/etcd
to create mysql container run the following command:
$ docker run --name mysql-docker -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -d mysql:5.7
alternatively, if you want create a mysql container with root password use the below command
- using such a container, before run telegramd modules corresponding config file need to be changed
$ docker run --name mysql-docker -p 3306:3306 -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:5.7
note that my-secret-pw is the password to be set for the MySQL root user
to run mysql client for test connection or test a sql command run the following:
$ docker exec -it mysql-docker mysql -uroot -p
and enter your password defined in previous command:
mysql> exit
to install redis run the following command
$ docker run --name redis-docker -p 6379:6379 -d redis
After restart your development environment to start etc, mysql, and redis container run the following command
$ docker start redis-docker mysql-docker etcd-docker
to see current running containers run the following command
$ docker ps
$ mkdir $GOPATH/src/github.com/nebula-chat
$ cd $GOPATH/src/github.com/nebula-chat
$ git clone https://github.com/nebula-chat/chatengine.git
run the following command to create database
$ docker exec -it mysql-docker sh -c 'exec mysql -u root -p -e"CREATE DATABASE chatengine;"'
and to create db schema run the following:
1- if root password does not set for mysql container:
$ docker exec -i mysql-docker mysql --user=root chatengine < $GOPATH/src/github.com/nebula-chat/chatengine/scripts/chatengine.sql
2- if root password is set:
$ docker exec -i mysql-docker mysql --user=root --password=my-secret-pw chatengine < $GOPATH/src/github.com/nebula-chat/chatengine/scripts/chatengine.sql
note: my-secret-pw is the same as defined in run mysql container section
if password is empty ignore this section otherwise add password to the following files
$ $GOPATH/src/github.com/nebula-chat/chatengine/messenger/biz_server/biz_server.toml
$ $GOPATH/src/github.com/nebula-chat/chatengine/messenger/sync/sync.toml
$ $GOPATH/src/github.com/nebula-chat/chatengine/service/document/document.toml
$ $GOPATH/src/github.com/nebula-chat/chatengine/service/auth_session/auth_session.toml
set my-secret-pw in mysql dsn as follow:
[[mysql]]
name = "immaster"
dsn = "root:my-secret-pw@/chatengine?charset=utf8"
...
[[mysql]]
name = "imslave"
dsn = "root:my-secret-pw@/chatengine?charset=utf8"
...
$ cd $GOPATH/src/github.com/nebula-chat/chatengine/access/frontend
$ go build
$ cd $GOPATH/src/github.com/nebula-chat/chatengine/access/session
$ go build
$ cd $GOPATH/src/github.com/nebula-chat/chatengine/access/auth_key
$ go build
$ cd $GOPATH/src/github.com/nebula-chat/chatengine/service/auth_session
$ go build
$ cd $GOPATH/src/github.com/nebula-chat/chatengine/messenger/sync
$ go build
$ cd $GOPATH/src/github.com/nebula-chat/chatengine/messenger/upload
$ go build
$ cd $GOPATH/src/github.com/nebula-chat/chatengine/service/document
$ go build
$ cd $GOPATH/src/github.com/nebula-chat/chatengine/messenger/biz_server
$ go build
in the following file
$ $GOPATH/src/github.com/nebula-chat/chatengine/messenger/biz_server/config.json
replace ipAddress by your IP
"dc_options": [
{
"constructor": 414687501,
"data2": {
"id": 2,
"ip_address": "127.0.0.1",
"port": 12345
}
}
],
$ cd $GOPATH/src/github.com/nebula-chat/chatengine/service/auth_session
$ ./auth_session
$ cd $GOPATH/src/github.com/nebula-chat/chatengine/service/document
$ ./document
$ cd $GOPATH/src/github.com/nebula-chat/chatengine/messenger/sync
$ ./sync
$ cd $GOPATH/src/github.com/nebula-chat/chatengine/messenger/upload
$ ./upload
$ cd $GOPATH/src/github.com/nebula-chat/chatengine/messenger/biz_server
$ ./biz_server
$ cd $GOPATH/src/github.com/nebula-chat/chatengine/access/session
$ ./session
$ cd $GOPATH/src/github.com/nebula-chat/chatengine/access/auth_key
$ ./auth_key
$ cd $GOPATH/src/github.com/nebula-chat/chatengine/access/frontend
$ ./frontend
- if a panic is raised for
http: multiple registrations for /debug/requests
then remove github.com/coreos/etcd/vendor/golang.org/x/net/trace folder