|
1 | | -# MLH Localhost: Building Scalable Apps w/ CockroachDB |
| 1 | +Startrek Quotes with CockroachDB |
| 2 | +================================ |
2 | 3 |
|
3 | | -This repositiory contains the sample code from the [MLH Localhost: Hacking |
4 | | -with CockroachDB][3] workshop. |
| 4 | +Quotes are queried from CockroachDB and displayed every few seconds. |
| 5 | + |
5 | 6 |
|
6 | | -## Sample Code / Downloads |
| 7 | +Project on Glitch |
| 8 | +================= |
7 | 9 |
|
8 | | - - Star Trek App - [Demo][4] / [Source][1] / [Download][2] |
| 10 | +Project can be found on Glitch at [https://checker-aries.glitch.me/](https://checker-aries.glitch.me) |
9 | 11 |
|
10 | | -## License |
| 12 | +Troubleshooting |
| 13 | +=============== |
11 | 14 |
|
12 | | -Unless otherwise stated, the code in this repo is released under the MIT |
13 | | -License. |
| 15 | +**Note:** if you open a Glitch console and `cockroach` is installed, the `cockroach` command will still not be found until you run `alias cockroach="~/.data/cockroach"` |
| 16 | + |
| 17 | +### Troubleshooting `BRB! Connecting to CockroachDB` |
| 18 | + |
| 19 | +This happens occassionally when the project has been running for a while. It may go to sleep. Simply reload the page and wait a few minutes while the project wakes up and restarts the DB process. |
| 20 | + |
| 21 | +If the app is really unresponsive, you may also go into the Glitch Console and type `sh cockroach.sh` to run the cockroachDB process manually. Hit `enter` to execute the DB process. You should see a bunch of output on the Glitch console. |
| 22 | + |
| 23 | +### App is still not responding and `EADDRINUSE :::3000` appears in the Glitch Log |
| 24 | + |
| 25 | +You have no choice but to kill the server.js process in the Glitch Console. |
| 26 | + |
| 27 | + |
| 28 | +* Go to the Glitch Console |
| 29 | +* Type `ps -ax` to see a list of all running processes. |
| 30 | +* Find the process `node server.js` and note the PID. |
| 31 | +* Finally, kill that process by running `kill [PID]` |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | +Don't worry about restarting the node server.js as Glitch will do this automatically. You may return to your project on Glitch IDE and check the log to ensure you have no issues. |
| 36 | + |
| 37 | +### Error: `bash: cockroach: command not found` |
| 38 | + |
| 39 | +If you attempt to enter one of the commands beginning with `cockroach` and get the error above, enter this in your terminal: |
| 40 | + |
| 41 | +`alias cockroach="~/.data/cockroach"` then |
| 42 | + |
| 43 | +`cockroach version`. If you see this: |
14 | 44 |
|
15 | 45 | ``` |
16 | | -Copyright (c) 2017 Major League Hacking, Inc. |
17 | | -
|
18 | | -Permission is hereby granted, free of charge, to any person obtaining a copy |
19 | | -of this software and associated documentation files (the "Software"), to deal |
20 | | -in the Software without restriction, including without limitation the rights |
21 | | -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
22 | | -copies of the Software, and to permit persons to whom the Software is |
23 | | -furnished to do so, subject to the following conditions: |
24 | | -
|
25 | | -The above copyright notice and this permission notice shall be included in all |
26 | | -copies or substantial portions of the Software. |
27 | | -
|
28 | | -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
29 | | -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
30 | | -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
31 | | -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
32 | | -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
33 | | -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
34 | | -SOFTWARE |
| 46 | +Build Tag: v2.0.3 |
| 47 | +Build Time: 2018/06/18 16:11:33 |
| 48 | +Distribution: CCL |
| 49 | +Platform: linux amd64 (x86_64-unknown-linux-gnu) |
| 50 | +Go Version: go1.10 |
| 51 | +C Compiler: gcc 6.3.0 |
| 52 | +Build SHA-1: 91715a9a95edbe716912173204fa4c0fc6724457 |
| 53 | +Build Type: release |
35 | 54 | ``` |
36 | | -[1]: https://github.com/MLH/mlh-localhost-cockroachdb |
37 | | -[2]: https://github.com/MLH/mlh-localhost-cockroachdb/archive/master.zip |
38 | | -[3]: https://localhost.mlh.io/activities/intro-to-cockroachdb/ |
39 | | -[4]: http://mlhlocal.host/cockroachdb-demo |
| 55 | + |
| 56 | +you have fixed the error. |
| 57 | + |
| 58 | +### See CockroachDB information instead of the app |
| 59 | + |
| 60 | +If someone sees information about `cockroachdb` instead of the quotes interface, they probably started the database incorrectly somehow. Quit the database using `cockroach quit --insecure --port=26257` (or whatever port number is required) and start it again. |
| 61 | + |
| 62 | +### Running out of space |
| 63 | + |
| 64 | +This only occured once during testing, but sometimes CockroachDB can run out of space on Glitch. In this case, remove the files `cockroach-data`, `mlh-node1` and `mlh-node2`. Then restart and refill the databases. |
0 commit comments