Skip to content

Commit

Permalink
Clean up and better documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamSEY committed Jun 6, 2022
1 parent dade39b commit 024312b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ PS: You can get this file from firebase -> settings -> Service Account -> Fireba
now you're ready to start the server

```
docker-compose up
sudo docker-compose up -d
```

### From scratch
Expand Down
8 changes: 5 additions & 3 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ services:
firebase_sdk_admin_json: "firebase_admin_sdk.json" # firebase authentication (optional) If not needed, set an empty file instead.
restart: "always"
ports:
- "5511:5511"
- "5511:5511" # websocket server
- "3500:3500" # ZMQ
environment:
- "VERSION=1.0.0"
- "FIREBASE_DATABASE_URL=null" # if you want to use firebase push notifications
- "ZMQ_ADDRESS=null" # change to tcp://0.0.0.0:3500 for remote access otherwise it will be accessed only locally.
- "VERSION=1.0"
- "FIREBASE_DATABASE_URL=null" # if you want to use firebase push notifications. Check Readme.md.
2 changes: 1 addition & 1 deletion docker/scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# fetch new updates on docker restarts
git pull
git pull
ls -a

yarn install --save --no-progress
Expand Down
5 changes: 3 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
const { Server } = require('./lib/Server');
const fs = require('fs');

const { version, FIREBASE_DATABASE_URL } = process.env;
const { VERSION, FIREBASE_DATABASE_URL, ZMQ_ADDRESS } = process.env;
const firebaseSdkPath = '/etc/easy-chat-pushjs/config/firebase_admin_sdk.json';
const jwtPublicKey = '/etc/easy-chat-pushjs/config/jwtRS256.key.pub';

const config = {
// zmqServerAddress: 'tcp://0.0.0.0:3500', // in case you want to connect to the server from another machine.
// Not secure. Use firewall to allow access only from private/trusted IP addresses to the port.
version: version ? version : '1.0',
zmqServerAddress: ZMQ_ADDRESS !== 'null' ? ZMQ_ADDRESS : 'tcp://127.0.0.1:3500',
version: VERSION ? VERSION : 1.0,
jwtPublicKey: jwtPublicKey,
wsPort: 5511,
onUserDisconnects: (userInfo) => { console.log('user disconnected', { userInfo }) },
Expand Down

0 comments on commit 024312b

Please sign in to comment.