2024-06-07 13:38:32 -07:00







2024-07-25 14:54:50 -07:00
<h1 align="center"><a href="https://bluewavelabs.ca" target="_blank">BlueWave Uptime</a></h1>
2024-05-05 11:09:19 -07:00
2024-07-25 14:54:50 -07:00
<p align="center"><strong>An open source server monitoring application</strong></p>
2024-09-04 21:50:26 -04:00

(yes, we have a light theme as well, but this looks better on readme.md)
2024-08-23 22:15:19 -04:00
2024-07-25 14:54:50 -07:00
BlueWave Uptime is an open source server monitoring application used to track the operational status and performance of servers and websites. It regularly checks whether a server/website is accessible and performs optimally, providing real-time alerts and reports on the monitored services' availability, downtime, and response time.
2024-06-15 11:06:28 -04:00
2024-09-19 07:41:42 -04:00
## Demo
See [BlueWave Uptime ](https://uptime-demo.bluewavelabs.ca/ ) in action. The username is uptimedemo@demo .com and the password is Demouser1!
2024-07-28 17:34:23 -04:00
## Features
2024-08-09 16:42:37 -04:00
- [x] Completely open source, deployable on your servers
- [x] Website monitoring
- [x] Port monitoring
- [x] Ping monitoring
- [x] Incidents at a glance
- [x] Page speed monitoring
2024-08-19 14:28:18 -07:00
- [x] E-mail notifications
2024-08-09 16:42:37 -04:00
- [ ] Scheduled maintenance (in the works)
2024-07-28 17:36:54 -04:00
2024-08-09 15:48:10 -04:00
**Roadmap (short term):**
2024-08-13 13:29:12 -07:00
2024-08-13 10:33:28 -04:00
- [ ] Memory, disk and CPU monitoring
2024-08-09 16:42:37 -04:00
- [ ] 3rd party integrations
- [ ] DNS monitoring
- [ ] SSL monitoring
2024-07-28 17:34:23 -04:00
2024-08-09 15:48:10 -04:00
**Roadmap (long term):**
2024-08-13 13:29:12 -07:00
2024-08-13 10:33:28 -04:00
- [ ] Status pages
2024-08-09 15:48:10 -04:00
2024-07-28 17:34:23 -04:00
## Tech stack
2024-08-13 13:29:12 -07:00
- [ReactJs ](https://react.dev/ )
- [MUI (React framework) ](https://mui.com/ )
- [Node.js ](https://nodejs.org/en )
- [MongoDB ](https://mongodb.com )
2024-07-28 17:34:23 -04:00
2024-06-18 13:19:58 -07:00
## Contributing
2024-06-15 11:06:28 -04:00
2024-07-28 18:12:38 -04:00
We love contributors. Here's how you can contribute:
2024-06-15 11:06:28 -04:00
2024-08-13 13:29:12 -07:00
- Check [Contributor's guideline ](https://github.com/bluewave-labs/bluewave-uptime/blob/master/CONTRIBUTING.md ).
- Have a look at our Figma designs [here ](https://www.figma.com/design/RPSfaw66HjzSwzntKcgDUV/Uptime-Genie?node-id=0-1&t=WqOFv9jqNTFGItpL-1 ). We encourage you to copy to your own Figma page, then work on it as it is read-only.
- Open an issue if you believe you've encountered a bug
- Make a pull request to add new features/make quality-of-life improvements/fix bugs.
2024-06-15 11:06:28 -04:00
2024-07-28 18:12:38 -04:00
<a href="https://github.com/bluewave-labs/bluewave-uptime/graphs/contributors">
<img src="https://contrib.rocks/image?repo=bluewave-labs/bluewave-uptime" />
</a>
Made with [contrib.rocks ](https://contrib.rocks ).
2024-07-28 19:42:19 -04:00

2024-06-15 11:06:28 -04:00
2024-08-18 01:57:16 -04:00
[](https://star-history.com/#bluewave -labs/bluewave-uptime&Date)
2024-08-19 14:28:18 -07:00
Also check other developer and contributor-friendly projects of BlueWave:
2024-08-17 19:14:22 -04:00
- [BlueWave HRM ](https://github.com/bluewave-labs/bluewave-hrm )
- [BlueWave Onboarding ](https://github.com/bluewave-labs/bluewave-onboarding )
- [BlueWave DataRoom ](https://github.com/bluewave-labs/bluewave-dataroom )
2024-09-25 23:39:56 -04:00
- [VerifyWise ](https://github.com/bluewave-labs/verifywise )
2024-08-17 19:14:22 -04:00
2024-05-05 11:09:19 -07:00
## Getting Started
- Clone this repository to your local machine
2024-09-30 13:30:59 +08:00
1. [Quickstart for Users ](#user-quickstart )
2. [Quickstart for Developers ](#dev-quickstart )
3. [Manual Install ](#manual-install )
- [Install Client ](#install-client )
- [Environment ](#env-vars-client )
- [Start Client ](#start-client )
- [Install Server ](#install-server )
- [Environment ](#env-vars-server )
- [Database ](#databases )
- [(Optional) Dockerised Databases ](#optional-docker-databases )
- [Start Server ](#start-server )
4. [API Documentation ](#api-documentation )
5. [Error Handling ](#error-handling )
6. [Contributors ](#contributors )
2024-05-15 12:40:56 -07:00
2024-05-05 11:09:19 -07:00
---
2024-09-30 13:30:59 +08:00
## <u> Quickstart for Users</u><a id="user-quickstart"></a>
2024-09-23 13:17:05 +08:00
2024-09-30 13:30:59 +08:00
1. Download our [Docker Compose File ](/Docker/dist/docker-compose.yaml )
2. Run `docker compose up` to start the application
3. Application is running at `http://localhost`
2024-09-23 13:17:05 +08:00
2024-09-30 13:30:59 +08:00
## <u>Quickstart for Developers</u> <a id="dev-quickstart"></a>
2024-08-13 13:29:12 -07:00
2024-08-13 13:46:25 -07:00
<span style="color: red; font-weight: bold;">MAKE SURE YOU CD TO THE SPECIFIED DIRECTORIES AS PATHS IN COMMANDS ARE RELATIVE</span>
2024-08-13 13:29:12 -07:00
2024-09-30 13:30:59 +08:00
### Cloning and Initial Setup
2024-08-13 13:29:12 -07:00
1. Clone this repository
2. Checkout the `develop` branch `git checkout develop`
2024-09-30 13:30:59 +08:00
### Docker Images Setup
2024-08-13 13:29:12 -07:00
3. <span style="color: red; font-weight: bold;">CD</span> to the `Docker` directory
4. Run `docker run -d -p 6379:6379 -v $(pwd)/redis/data:/data --name uptime_redis uptime_redis`
5. Run `docker run -d -p 27017:27017 -v $(pwd)/mongo/data:/data/db --name uptime_database_mongo uptime_database_mongo`
2024-06-24 16:04:06 -07:00
2024-09-30 13:30:59 +08:00
### Server Setup
2024-08-13 13:29:12 -07:00
6. <span style="color: red; font-weight: bold;">CD</span> to `Server` directory, run `npm install`
7. While in `Server` directory, create a `.env` file with the [required environmental variables ](#env-vars-server )
8. While in the `Server` directory, run `npm run dev`
2024-09-30 13:30:59 +08:00
### Client Setup
2024-08-13 13:29:12 -07:00
9. <span style="color: red; font-weight: bold;">CD</span> to `Client` directory `run npm install`
10. While in the `Client` directory, create a `.env` file with the [required environmental variables ](#env-vars-client )
11. While in the `Client` cirectory run `npm run dev`
2024-09-30 13:30:59 +08:00
### Access Application
2024-08-13 13:29:12 -07:00
12. Client is running at `localhost:5173`
13. Server is running at `localhost:5000`
---
2024-09-30 13:30:59 +08:00
## <u>Manual Install</u> <a id="manual-install"></a>
2024-06-24 16:04:06 -07:00
2024-09-30 13:30:59 +08:00
---
2024-05-05 11:09:19 -07:00
2024-09-30 13:30:59 +08:00
### Client Installation<a id="install-client"></a>
2024-05-05 11:09:19 -07:00
1. Change directory to the `Client` directory
2. Install all dependencies by running `npm install`
2024-09-30 13:30:59 +08:00
---
2024-06-12 11:04:11 -07:00
2024-09-30 13:30:59 +08:00
### Environmental Variables <a id="env-vars-client"></a>
2024-06-12 11:04:11 -07:00
2024-09-06 11:51:55 -07:00
| ENV Variable Name | Required/Optional | Type | Description | Accepted Values |
| --------------------- | ----------------- | --------- | ------------------ | ---------------------------------- |
| VITE_APP_API_BASE_URL | Required | `string` | Base URL of server | {host}/api/v1 |
| VITE_APP_LOG_LEVEL | Optional | `string` | Log level | `"none"` \|`"error"` \| `"warn"` \| |
| VITE_APP_DEMO | Optional | `boolean` | Demo server or not | `true` \|`false` \| |
2024-06-12 11:04:11 -07:00
2024-09-30 13:30:59 +08:00
---
2024-06-12 11:04:11 -07:00
2024-09-30 13:30:59 +08:00
### Starting Development Server<a id="start-client"></a>
2024-05-05 11:09:19 -07:00
1. Run `npm run dev` to start the development server.
---
2024-09-30 13:30:59 +08:00
### Server Installation<a id="install-server"></a>
2024-05-05 11:09:19 -07:00
1. Change directory to the `Server` directory
2024-05-22 14:38:47 -07:00
2. Install all dependencies by running `npm install`
2024-05-05 11:09:19 -07:00
2024-09-30 13:30:59 +08:00
---
2024-05-10 14:34:04 -07:00
2024-09-30 13:30:59 +08:00
### Environmental Variables <a id="env-vars-server"></a>
2024-05-28 10:41:10 -07:00
Configure the server with the following environmental variables:
2024-05-10 14:34:04 -07:00
2024-07-26 18:57:32 -07:00
| ENV Variable Name | Required/Optional | Type | Description | Accepted Values |
| --------------------- | ----------------- | --------- | ---------------------------------------- | ------------------------------------------------ |
| CLIENT_HOST | Required | `string` | Frontend Host | |
| JWT_SECRET | Required | `string` | JWT secret | |
| DB_TYPE | Optional | `string` | Specify DB to use | `MongoDB \| FakeDB` |
| DB_CONNECTION_STRING | Required | `string` | Specifies URL for MongoDB Database | |
| PORT | Optional | `integer` | Specifies Port for Server | |
| LOGIN_PAGE_URL | Required | `string` | Login url to be used in emailing service | |
| REDIS_HOST | Required | `string` | Host address for Redis database | |
| REDIS_PORT | Required | `integer` | Port for Redis database | |
| TOKEN_TTL | Optional | `string` | Time for token to live | In vercel/ms format https://github.com/vercel/ms |
| PAGESPEED_API_KEY | Optional | `string` | API Key for PageSpeed requests | |
| SYSTEM_EMAIL_HOST | Required | `string` | Host to send System Emails From | |
| SYSTEM_EMAIL_PORT | Required | `number` | Port for System Email Host | |
| SYSTEM_EMAIL_ADDRESS | Required | `string` | System Email Address | |
| SYSTEM_EMAIL_PASSWORD | Required | `string` | System Email Password | |
2024-05-10 14:34:04 -07:00
2024-09-30 13:30:59 +08:00
---
2024-05-10 14:34:04 -07:00
2024-09-30 13:30:59 +08:00
### Databases <a id="databases"></a>
2024-05-28 10:41:10 -07:00
2024-09-25 23:39:56 -04:00
This project requires two databases:
2024-05-28 10:41:10 -07:00
2024-09-25 23:39:56 -04:00
1. **Main Application Database:** The project uses MongoDB for its primary database, with a MongoDB Docker image provided for easy setup.
2. **Redis for Queue Management:** A Redis database is used for the PingService’ s queue system, and a Redis Docker image is included for deployment.
2024-05-28 10:41:10 -07:00
2024-06-14 12:07:34 -07:00
You may use the included Dockerfiles to spin up databases quickly if you wish.
2024-05-28 10:41:10 -07:00
2024-09-30 13:30:59 +08:00
#### (Optional) Dockerised Databases <a id="optional-docker-databases"></a>
2024-05-28 10:41:10 -07:00
2024-06-24 16:04:06 -07:00
Dockerfiles for the server and databases are located in the `Docker` directory
2024-05-28 10:41:10 -07:00
<details>
<summary><b>MongoDB Image</b></summary>
2024-06-26 10:41:59 -07:00
Location: `Docker/mongoDB.Dockerfile`
2024-05-28 10:41:10 -07:00
2024-06-24 16:04:06 -07:00
The `Docker/mongo/data` directory should be mounted to the MongoDB container in order to persist data.
2024-05-28 10:41:10 -07:00
2024-06-24 16:04:06 -07:00
From the `Docker` directory run
2024-05-28 10:41:10 -07:00
2024-06-14 12:07:34 -07:00
1. Build the image: `docker build -f mongoDB.Dockerfile -t uptime_database_mongo .`
2. Run the docker image: `docker run -d -p 27017:27017 -v $(pwd)/mongo/data:/data/db --name uptime_database_mongo uptime_database_mongo`
2024-05-28 10:41:10 -07:00
</details>
<details>
<summary><b>Redis Image</b></summary>
2024-06-26 10:41:59 -07:00
Location `Docker/redis.Dockerfile`
2024-05-28 10:41:10 -07:00
2024-06-24 16:04:06 -07:00
the `Docker/redis/data` directory should be mounted to the Redis container in order to persist data.
2024-05-28 10:41:10 -07:00
2024-06-24 16:04:06 -07:00
From the `Docker` directory run
2024-05-28 10:41:10 -07:00
2024-06-14 12:07:34 -07:00
1. Build the image: `docker build -f redis.Dockerfile -t uptime_redis .`
2. Run the image: `docker run -d -p 6379:6379 -v $(pwd)/redis/data:/data --name uptime_redis uptime_redis`
2024-05-28 10:41:10 -07:00
</details>
2024-09-30 13:30:59 +08:00
---
### Starting the Development Server <a id="start-server"></a>
2024-06-14 12:07:34 -07:00
- run `npm run dev` to start the development server
OR
2024-05-05 11:09:19 -07:00
2024-06-14 12:07:34 -07:00
- run `node index.js` to start server
2024-05-10 02:16:50 -04:00
2024-05-10 14:34:04 -07:00
---
2024-09-30 13:30:59 +08:00
## <u>API Documentation</u><a id="api-documentation"></a>
2024-05-10 14:34:04 -07:00
2024-09-25 14:07:33 +08:00
Our API is documented in accordance with the [OpenAPI spec ](https://www.openapis.org/ ).
2024-05-10 14:34:04 -07:00
2024-09-30 13:30:59 +08:00
You can see the documentation on your local development server at [http://localhost:{port}/api-docs ](htt>>p://localhost:5000/api-docs )
2024-05-10 14:34:04 -07:00
2024-09-25 14:07:33 +08:00
You can also view the documentation on our demo server at [https://uptime-demo.bluewavelabs.ca/api-docs ](https://uptime-demo.bluewavelabs.ca/api-docs )
2024-06-05 13:23:43 -07:00
2024-09-30 13:30:59 +08:00
## <u>Error handling</u>
2024-05-27 11:03:12 -07:00
Errors are returned in a standard format:
`{"success": false, "msg": "No token provided"}`
Errors are handled by error handling middleware and should be thrown with the following parameters
| Name | Type | Default | Notes |
| ------- | --------- | ---------------------- | ------------------------------------ |
| status | `integer` | 500 | Standard HTTP codes |
| message | `string` | "Something went wrong" | An error message |
| service | `string` | "Unknown Service" | Name of service that threw the error |
Example:
```
const myRoute = async(req, res, next) => {
try{
const result = myRiskyOperationHere();
}
catch(error){
error.status = 404
error.message = "Resource not found"
error.service = service name
next(error)
return;
}
}
```
Errors should not be handled at the controller level and should be left to the middleware to handle.