serve web app from / instead of /x/, update docker config template

This commit is contained in:
or-else
2018-06-27 16:33:33 +03:00
parent a1bffc6bb4
commit 5ae2e4b450
5 changed files with 60 additions and 20 deletions

View File

@ -2,7 +2,7 @@
## Installing from Binaries
1. Visit the [Releases page](https://github.com/tinode/chat/releases/), choose the latest or otherwise the most suitable release. From the list of binaries download the one for your database and platform. Once the binary is downloaded, unpack it to a directory of your choosing, `cd` to that directory.
1. Visit the [Releases page](https://github.com/tinode/chat/releases/), choose the latest or otherwise the most suitable release. From the list of binaries download the one for your database and platform. Once the binary is downloaded, unpack it to a directory of your choosing, `cd` to that directory.
2. Make sure your database is running. Make sure it's configured to accept connections from `localhost`. In case of MySQL, Tinode will try to connect as `root` without the password. See notes below (_Building from Source_, section 4) on how to configure Tinode to use a different user or a password. MySQL 5.7 or above is required. MySQL 5.6 or below **will not work**.
@ -41,9 +41,9 @@ See [instructions](./docker/README.md)
go get -tags mysql github.com/tinode/chat/server && go install -tags mysql github.com/tinode/chat/server
go get -tags mysql github.com/tinode/chat/tinode-db && go install -tags mysql github.com/tinode/chat/tinode-db
```
Note the required **`-tags rethinkdb`** or **`-tags mysql`** build option.
Note the required **`-tags rethinkdb`** or **`-tags mysql`** build option.
You may also optionally define `main.buildstamp` for the server by adding a build option, for instance, with a timestamp:
```
-ldflags "-X main.buildstamp=`date -u '+%Y%m%dT%H:%M:%SZ'`"
@ -51,7 +51,7 @@ 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 approprite for your MySQL installation. Option `parseTime=true` is required.
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 approprite for your MySQL installation. Option `parseTime=true` is required.
```js
"mysql": {
"dsn": "root@tcp(localhost)/tinode?parseTime=true",
@ -67,7 +67,6 @@ See [instructions](./docker/README.md)
## Running a Standalone Server
1. Run RethinkDB:
```
rethinkdb --bind all --daemon
@ -81,17 +80,17 @@ See [instructions](./docker/README.md)
```
$GOPATH/bin/tinode-db -config=$GOPATH/src/github.com/tinode/chat/tinode-db/tinode.conf -data=$GOPATH/src/github.com/tinode/chat/tinode-db/data.json
```
DB intializer needs to be run only once per installation. See [instructions](tinode-db/README.md) for more options.
3. Unpack JS client to a directory, for instance `$HOME/tinode/example-react-js/` by first unzipping `https://github.com/tinode/example-react-js/archive/master.zip` then extract `tinode.js` from `https://github.com/tinode/tinode-js/archive/master.zip` to the same directory.
4. Run server
4. Run server
```
$GOPATH/bin/server -config=$GOPATH/src/github.com/tinode/chat/server/tinode.conf -static_data=$HOME/tinode/example-react-js/
```
5. Test your installation by pointing your browser to [http://localhost:6060/x/](http://localhost:6060/x/). Keep in mind that by default the static files from the `-static_data` path are served at `/x/`. You can change this by editing the line `static_mount` in the config file.
5. Test your installation by pointing your browser to [http://localhost:6060/](http://localhost:6060/). The static files from the `-static_data` path are served at web root `/`. You can change this by editing the line `static_mount` in the config file.
6. If you want to use the [Android client](https://github.com/tinode/android-example) and want push notification to work, find the section `"push"` in `tinode.conf`, item `"name": "fcm"`, then change `"enabled"` to `true`. Go to [https://console.firebase.google.com/](https://console.firebase.google.com/) (https://console.firebase.google.com/project/**NAME-OF-YOUR-PROJECT**/settings/cloudmessaging) and get a server key. Paste the key to the `"api_key"` field. See more at [https://github.com/tinode/android-example](https://github.com/tinode/android-example).
@ -99,7 +98,7 @@ See [instructions](./docker/README.md)
- Install RethinkDB, run it stanalone or in [cluster mode](https://www.rethinkdb.com/docs/start-a-server/#a-rethinkdb-cluster-using-multiple-machines). Run DB initializer, unpack JS files as described in the previous section.
- Cluster expects at least two nodes. A minimum of three nodes is recommended.
- Cluster expects at least two nodes. A minimum of three nodes is recommended.
- The following section configures the cluster.
@ -122,7 +121,7 @@ See [instructions](./docker/README.md)
}
}
```
* `self` is the name of the current node. Generally it's more convenient to specify the name of the current node at the command line using `cluster_self` option. Command line value overrides the config file value. If the value is not provided either in the config file or through the command line, the clustering is disabled.
* `self` is the name of the current node. Generally it's more convenient to specify the name of the current node at the command line using `cluster_self` option. Command line value overrides the config file value. If the value is not provided either in the config file or through the command line, the clustering is disabled.
* `nodes` defines individual cluster nodes. The sample defines three nodes named `one`, `two`, and `tree` running at the localhost at the specified cluster communication ports. Cluster addresses don't need to be exposed to the outside world.
* `failover` is an experimental feature which migrates topics from failed cluster nodes keeping them accessible:
* `enabled` turns on failover mode; failover mode requires at least three nodes in the cluster.

View File

@ -16,7 +16,7 @@ The goal of this project is to actually deliver on XMPP's original vision: creat
## Getting support
* For support, general questions, discussion post to [https://groups.google.com/d/forum/tinode](https://groups.google.com/d/forum/tinode).
* For support, general questions, discussions post to [https://groups.google.com/d/forum/tinode](https://groups.google.com/d/forum/tinode).
* For bugs [open an issue](https://github.com/tinode/chat/issues/new).
@ -24,7 +24,7 @@ The goal of this project is to actually deliver on XMPP's original vision: creat
### Web
A javascript demo is usually available at https://api.tinode.co/x/example-react-js/ ([source](https://github.com/tinode/example-react-js/)). Login as one of `alice`, `bob`, `carol`, `dave`, `frank`. Password is `<login>123`, e.g. login for `alice` is `alice123`. You can discover other users by email or phone by prefixing them with `email:` or `tel:` respectively. Emails are `<login>@example.com`, e.g. `alice@example.com`, phones are `17025550001` through `17025550009`.
A web demo is usually available at https://api.tinode.co/ ([source](https://github.com/tinode/example-react-js/)). Login as one of `alice`, `bob`, `carol`, `dave`, `frank`. Password is `<login>123`, e.g. login for `alice` is `alice123`. You can discover other users by email or phone by prefixing them with `email:` or `tel:` respectively. Emails are `<login>@example.com`, e.g. `alice@example.com`, phones are `17025550001` through `17025550009`.
### Android

View File

@ -39,7 +39,7 @@ All images are available at https://hub.docker.com/r/tinode/
The port mapping `-p 6060:18080` tells Docker to map container's port 18080 to host's port 6060 making server accessible at http://localhost:6060/. The container will initialize the database with test data on the first run.
5. Test the installation by pointing your browser to [http://localhost:6060/x/](http://localhost:6060/x/).
5. Test the installation by pointing your browser to [http://localhost:6060/](http://localhost:6060/).
## Optional

View File

@ -1,12 +1,24 @@
{
"listen": ":18080",
"static_mount": "/x/",
"static_mount": "/",
"grpc_listen": ":16061",
"api_key_salt": "$API_KEY_SALT",
"max_message_size": 4194304,
"max_subscriber_count": 32,
"max_tag_count": 16,
"media": {
"use_handler": "fs",
"max_size": 33554432,
"gc_period": 60,
"gc_block_size": 100,
"handlers": {
"fs": {
"upload_to": "uploads"
}
}
},
"tls": {
"enabled": false,
"http_redirect": ":80",
@ -19,6 +31,9 @@
},
"auth_config": {
"basic": {
"add_to_tags": true
},
"token": {
"expire_in": 1209600,
"serial_num": 1,
@ -27,7 +42,6 @@
},
"store_config": {
"worker_id": 1,
"uid_key": "$UID_ENCRYPTION_KEY",
"adapters": {
"mysql": {
@ -41,15 +55,42 @@
}
},
"acc_validation": {
"email": {
"add_to_tags": true,
"required": [],
"config": {
"smtp_server": "smtp.example.com",
"smtp_port": "25",
"sender": "noreply@example.com",
"sender_password": "your-password-here",
"msg_body_templ": "./templ/email-validation-body.templ",
"msg_subject": "Tinode chat: confirm email",
"headers": [],
"max_retries": 4,
"debug_response": "123456"
}
},
"tel": {
"add_to_tags": true,
"config": {
"template": "./templ/sms-validation.templ",
"max_retries": 4,
"debug_response": "123456"
}
}
},
"push": [
{
"name":"stdout",
"config": {
"disabled": true
"enabled": false
}
}
],
"plugins": [
{
"enabled": $PLUGIN_PYTHON_CHAT_BOT_ENABLED,
@ -63,5 +104,5 @@
"service_addr": "tcp://localhost:40051"
}
]
}

View File

@ -8,7 +8,7 @@
"listen": ":6060",
// URL path for mounting the directory with static files.
"static_mount": "/x/",
"static_mount": "/",
// Address:port to listen for gRPC clients. Leave blank to disable gRPC support.
// Could be overridden from the command line with --grpc_listen.