Skip to content

Enterprise Service Bus used to unite different parts of Smart House / Smart Office

Notifications You must be signed in to change notification settings

sky-telehouse/sky-bus

Repository files navigation

sky-telehouse/sky-bus

Develop (latest): Build Status

Master (release-1.0.0): Build Status

Installation

  1. Get docker
  2. Pull Postgres container: docker pull postgres
  3. Run Postgres container:
    First use: docker run -d -p 5432:5432 --name sky_pg -e POSTGRES_PASSWORD=1q2w3e postgres
    Later: docker start sky_pg
    NB: credentials are hardcoded in sky-bus, later will be moved to .env
  4. Get a pgadmin: docker pull dpage/pgadmin4
  5. Run pgadmin container:
    First use: docker run -p 80:80 --name sky_pgadm -e 'PGADMIN_DEFAULT_EMAIL=user@user.user' -e 'PGADMIN_DEFAULT_PASSWORD=1q2w3e' -d dpage/pgadmin4
    Later: docker start sky_pgadm
  6. Connect containers in a network so they are able to reach each other (make a shell script or run each of the following lines):
docker network create sky_network
docker network connect sky_network sky_pg
docker network connect sky_network sky_pgadm
docker network inspect sky_network
  1. Type localhost in your web-browser's address bar. If you have done everything correctly, you should be able to see a pgAdmin login page.
  2. Input the default login/password: user@user.user/1q2w3e (from p. 5). You should see the pgAdmin dashboard.
  3. Press "Add new server" in Quick Links section. In General tab in Name input sky_pg, then go to connection tab and set Host name/address to localhost:5432, username to postgres and password to 1q2w3e (username and password are from p. 3).
  4. Press Save.
  5. In the Browser tab (on the left) select servers->sky_pg->Databases->postgres.
  6. Open Tools->Query tool in the top bar.
  7. Paste all of the code from dump.sql file from the root of the repository to the Query editor and press the ▶ button above.
  8. Refresh the page. You should be able to see sky scheme in Schemas.
  9. Go to the root of the cloned repository and run:
yarn
yarn dev
  1. Input localhost:3000/ping in your browser address bar. You should get PONG GET in response.

You are ready to develop. You can use yarn dev to run the bus. If you want to run specific version, use docker:

docker pull savolkov/sky-bus
docker run -p 3000:3000 --name sky_bus -d savolkov/sky-bus

API Docs

Sputkin

Open door

POST /open

Body description

{
   uuid: "entryphone id"
}

Body example

{
   uuid: "xxxx-xxxx-xxxx"
}

Set people inform

POST /inform

Body description

{
   uuid: "entryphone id"
   dateFrom: "", 
   dateEnd: "", 
   audioFileUrl: ""
}

Body example

{
   uuid: "xxxx-xxxx-xxxx"
   dateFrom: "2018-08-09T18:31:42", 
   dateEnd: "2018-08-09T18:31:42", 
   audioFileUrl: "https://some.file.mp3"
}

Set people poll

POST /inform

Body description

{
   uuid: "entryphone id"
   dateFrom: "", 
   dateEnd: "", 
   audioFileUrl: ""
}

Body example

{
   uuid: "xxxx-xxxx-xxxx"
   dateFrom: "2018-08-09T18:31:42", 
   dateEnd: "2018-08-09T18:31:42", 
   audioFileUrl: "https://some.file.mp3"
}

Sigur integration

  1. Enable event sending to web server in Sigur mysql db (use web integration docs)
  2. Set webhook url to http://localhost:3000/sigur/event
  3. reboot sigur via Sigur server monitoring tool