Skip to content

Commit

Permalink
gRPC updated
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Feb 18, 2022
1 parent a8a7796 commit 0a2f0d2
Show file tree
Hide file tree
Showing 11 changed files with 3,673 additions and 2,833 deletions.
50 changes: 27 additions & 23 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ See [instructions](./docker/README.md)

1. Install [Go environment](https://golang.org/doc/install). Make sure Go version is at least 1.14. Building with Go 1.13 or below **will fail**!

2. Make sure either [RethinkDB](https://www.rethinkdb.com/docs/install/) or MySQL (or MariaDB or Percona) is installed and running. MySQL 5.7 or above is required. MySQL 5.6 or below **will not work**. MongoDB (v4.2 and above) is also available and stable but not tested in production.
2. OPTIONAL only if you intend to modify code: Install [protobuf](https://developers.google.com/protocol-buffers/) and [gRPC](https://grpc.io/docs/languages/go/quickstart/) including [code generator](https://developers.google.com/protocol-buffers/docs/reference/go-generated) for Go.

3. Fetch, build Tinode server and tinode-db database initializer:
- **RethinkDb**:
```
go get -tags rethinkdb github.com/tinode/chat/server && go build -tags rethinkdb -o $GOPATH/bin/tinode github.com/tinode/chat/server
go get -tags rethinkdb github.com/tinode/chat/tinode-db && go build -tags rethinkdb -o $GOPATH/bin/init-db github.com/tinode/chat/tinode-db
```
- **MySQL**:
3. Make sure one of the following databases is installed and running:
* MySQL 5.7 or above. MySQL 5.6 or below **will not work**.
* MongoDB 4.0 or above.
* RethinkDB.

4. Fetch, build Tinode server and tinode-db database initializer:
- **MySQL**:
```
go get -tags mysql github.com/tinode/chat/server && go build -tags mysql -o $GOPATH/bin/tinode github.com/tinode/chat/server
go get -tags mysql github.com/tinode/chat/tinode-db && go build -tags mysql -o $GOPATH/bin/init-db github.com/tinode/chat/tinode-db
Expand All @@ -48,6 +48,11 @@ See [instructions](./docker/README.md)
go get -tags mongodb github.com/tinode/chat/server && go build -tags mongodb -o $GOPATH/bin/tinode github.com/tinode/chat/server
go get -tags mongodb github.com/tinode/chat/tinode-db && go build -tags mongodb -o $GOPATH/bin/init-db github.com/tinode/chat/tinode-db
```
- **RethinkDb**:
```
go get -tags rethinkdb github.com/tinode/chat/server && go build -tags rethinkdb -o $GOPATH/bin/tinode github.com/tinode/chat/server
go get -tags rethinkdb github.com/tinode/chat/tinode-db && go build -tags rethinkdb -o $GOPATH/bin/init-db github.com/tinode/chat/tinode-db
```
- **All** (bundle all the above DB adapters):
```
go get -tags "mysql rethinkdb mongodb" github.com/tinode/chat/server && go build -tags "mysql rethinkdb mongodb" -o $GOPATH/bin/tinode github.com/tinode/chat/server
Expand All @@ -63,15 +68,15 @@ See [instructions](./docker/README.md)
The value of `buildstamp` will be sent by the server to the clients.


4. Open `tinode.conf`. Check that the database connection parameters are correct for your database. If you are using MySQL make sure [DSN](https://github.com/go-sql-driver/mysql#dsn-data-source-name) in `"mysql"` section is appropriate for your MySQL installation. Option `parseTime=true` is required.
5. Open `tinode.conf`. Check that the database connection parameters are correct for your database. If you are using MySQL make sure [DSN](https://github.com/go-sql-driver/mysql#dsn-data-source-name) in `"mysql"` section is appropriate for your MySQL installation. Option `parseTime=true` is required.
```js
"mysql": {
"dsn": "root@tcp(localhost)/tinode?parseTime=true",
"database": "tinode"
},
```

5. Make sure you specify the adapter name in your `tinode.conf`. E.g. you want to run Tinode with MySQL:
6. Make sure you specify the adapter name in your `tinode.conf`. E.g. you want to run Tinode with MySQL:
```js
"store_config": {
...
Expand All @@ -80,26 +85,25 @@ See [instructions](./docker/README.md)
},
```

6. Now that you have built the binaries, follow instructions in the _Running a Standalone Server_ section.
7. Now that you have built the binaries, follow instructions in the _Running a Standalone Server_ section.


## Running a Standalone Server

1. Make sure your database is running:
- **RethinkDB**: https://www.rethinkdb.com/docs/start-a-server/
```
rethinkdb --bind all --daemon
```
- **MySQL**: https://dev.mysql.com/doc/mysql-startstop-excerpt/5.7/en/programs-server.html
```
mysql.server start
```
```
mysql.server start
```
- **MongoDB**: https://docs.mongodb.com/manual/administration/install-community/

MongoDB should run as single node replicaset. See https://docs.mongodb.com/manual/administration/replica-set-deployment/
```
mongod
```
MongoDB should run as single node replicaset. See https://docs.mongodb.com/manual/administration/replica-set-deployment/
```
mongod
```
- **RethinkDB**: https://www.rethinkdb.com/docs/start-a-server/
```
rethinkdb --bind all --daemon
```

2. Run DB initializer
```
Expand Down
18 changes: 10 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module github.com/tinode/chat

go 1.14
go 1.16

require (
firebase.google.com/go v3.12.0+incompatible
github.com/aws/aws-sdk-go v1.29.29
github.com/go-sql-driver/mysql v1.5.0
github.com/golang/mock v1.2.0
github.com/golang/protobuf v1.3.5
github.com/google/go-cmp v0.5.2
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.5
github.com/gorilla/handlers v1.4.2
github.com/gorilla/websocket v1.4.2
github.com/jmoiron/sqlx v1.2.0
Expand All @@ -18,12 +18,14 @@ require (
github.com/tinode/jsonco v1.0.0
github.com/tinode/snowflake v1.0.0
go.mongodb.org/mongo-driver v1.7.0
golang.org/x/crypto v0.0.0-20200320181102-891825fb96df
golang.org/x/net v0.0.0-20200320220750-118fecf932d8
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 // indirect
golang.org/x/text v0.3.5
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
golang.org/x/text v0.3.7
google.golang.org/api v0.20.0
google.golang.org/grpc v1.28.0
google.golang.org/genproto v0.0.0-20220217155828-d576998c0009 // indirect
google.golang.org/grpc v1.44.0
google.golang.org/protobuf v1.27.1
gopkg.in/rethinkdb/rethinkdb-go.v6 v6.2.1
)
Loading

0 comments on commit 0a2f0d2

Please sign in to comment.