Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xiduzo/shiftr-clone
https://github.com/xiduzo/shiftr-clone
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/xiduzo/shiftr-clone
- Owner: xiduzo
- Created: 2024-03-12T13:24:08.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-10-16T11:50:08.000Z (3 months ago)
- Last Synced: 2024-11-11T12:47:21.166Z (3 months ago)
- Language: TypeScript
- Size: 682 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is a poor-mans self-hosted version of [shiftr.io](https://www.shiftr.io/)
# Dev
## Pre-requisites
1. Node.js
Make sure you have Node.js installed on your machine. You can download it from [nodejs.org](https://nodejs.org/en/).
2. MQTT broker
For this project to run, make sure there is a MQTT broker running which you can connect to.
3. Docker
Preferably the `Mosquitto` broker is used from the `docker-compose` file. You can install [docker-desktop](https://docs.docker.com/desktop/release-notes/).
```bash
docker-compose up -d mosquitto
```## Run locally
First, install the dependencies:
```bash
npm i
```Then start the server:
```bash
npm run dev
```## Run in docker
To run the project in docker, run the following command:
```bash
docker-compose up -d --build
```# Docker
## Server
This Docker-container will build and run the server.
The server is responsible for reading the `Mosquitto` log-stream and re-publishing the messages to the client.
## Client
This Docker-container will only build the client files and put them at `/src/client/dist/`.
It could be served by a web-server like `nginx` or `apache`.
Or temporarily by running the following commands:
```bash
npm install http-server -g
``````bash
# From within the src/client/dist folder
http-server -p 8080
```## Mosquitto
This Docker-container will run the `Mosquitto` broker.
The most important settings in the `mosquitto.conf` are:
1. `log_type all` -- making sure all internal actions are exposed to the `server`.
2. `log_dest file /mosquitto/log/mosquitto.log` -- making sure the log is written to a file which the `server` has access to.### User management
The default user configured is `username:password`.
```bash
# Encrypt the password file
docker exec mosquitto mosquitto_passwd -U /mosquitto/config/passwd
``````bash
# Add a user
docker exec mosquitto mosquitto_passwd -b /mosquitto/config/passwd user password
```