Skip to content
This repository has been archived by the owner on Oct 22, 2022. It is now read-only.

Commit

Permalink
Updates Docker config and corresponding documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-miller-0 committed Feb 21, 2021
1 parent f49427f commit 9ce703d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 80
EXPOSE 3000
EXPOSE 1883
CMD ["npm", "start"]
CMD ["npm", "run", "start-docker"]
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ tail -f <LOG_DEST>

### Running with Docker

> **NOTE**: The Docker scripts are written using the default ports (specified in `config.js`: 1883 for MQTT, 3000 for http). If you want to change these ports, please also update the `Dockerfile` and the `start-docker` script in `package.json`.
You can also build and run this module locally with Docker:

```
Expand Down Expand Up @@ -167,6 +169,25 @@ Assuming your process is running in the cloud (or wherever you deployed it), you

If you are not getting messages from your external requester to your Lattice, something in the communication pathway is probably broken. Please read the above documentation to make sure you have done everything you need to for your situation. If you are sure you set your pathway up properly, there are a few ways to debug and troubleshoot what's going on.

### Make sure the connector process is running correctly

You can ensure that your process is running with the following cURL command (using the default 3000 http port, as specified in `config.js`):

```
curl -X POST -H "Content-Type: application/json" -d '[1,2,3]' http://localhost:3000/fake_lattice_id
```

This request should hang, i.e. you should not immediately get a `Connection refused` error. If you do get that error, it means your process isn't running on the expected port.

### Make sure your ports are correct

The ports your connector will use are listed in `config.js`. Their defaults are:

* MQTT: 1883
* http: 3000

You are welcome to change these, but be aware of the changes on the requester side. Also, if you are running Docker, you will need to update your `Dockerfile` and `start-docker` npm script (i.e. in `package.json`).

### Make sure your Lattice is connected to the internet

The most generic troubleshooting you can do is unplug your Lattice and plug it back in. Wait a minute or two and make sure that the top right of your screen eventually shows only a single icon: the wifi icon. If it shows any other icons, you probably aren't connected to the internet. Update your wifi on your Lattice by going to `Settings -> Wifi`.
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
"build": "babel src -d dist",
"lint": "eslint src",
"start": "npx pm2 start dist/index.js --name lattice-connect --watch",
"start-docker": "node dist/index.js",
"stop": "npx pm2 stop lattice-connect",
"rm": "npx pm2 delete lattice-connect && pkill node",
"logs": "npx pm2 logs lattice-connect",
"test": "mocha --timeout 180000 test/integration.js",
"docker-build": "docker build -t lattice-connect:1.0 .",
"docker-run": "docker run -d --name lattice-connect -p 80:80 -p 1883:1883 lattice-connect:1.0"
"docker-run": "docker run -d --name lattice-connect -p 3000:3000 -p 1883:1883 lattice-connect:1.0"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 9ce703d

Please sign in to comment.