Giter Site home page Giter Site logo

lights's Introduction

Install NATS (rpi)

Download NATS and install it in /opt:

wget https://github.com/nats-io/nats-server/releases/download/vx.y.z/nats-server-vx.y.z-linux-arm6.zip
unzip nats-server-vx.y.z-linux-arm6.zip 
sudo mkdir -p /opt/nats-server/bin
sudo cp ~/nats-server-vx.y.z-linux-arm6/nats-server /opt/nats-server/bin/

Create a dir for config:

sudo mkdir /etc/opt/nats-server/

Create a new file /etc/systemd/system/nats.service:

[Unit]
Description=NATS Server
After=network.target

[Service]
ExecStart=/opt/nats-server/bin/nats-server
WorkingDirectory=/etc/opt/nats-server
StandardOutput=inherit
StandardError=inherit
Restart=always
#User=nats

[Install]
WantedBy=multi-user.target

Ideally also create a new user nats, so that the service is not run as root.

Start the new service:

sudo systemctl start nats

Make sure it runs:

sudo systemctl status nats

Enable it so that it is started on boot:

sudo systemctl enable nats

Other useful commands:

sudo systemctl stop nats
sudo systemctl restart nats

Install sunset

cd cmd/sunset
go build
sudo mkdir -p /opt/sunset/bin
sudo mkdir /etc/opt/sunset
sudo cp sunset /opt/sunset/bin

Create /etc/systemd/system/sunset.service

[Unit]
Description=Sunset events
After=nats.service

[Service]
ExecStart=/opt/sunset/bin/sunset
WorkingDirectory=/etc/opt/sunset
StandardOutput=inherit
StandardError=inherit
Restart=always
#User=nats

[Install]
WantedBy=multi-user.target

Start and enable it so that it is started on boot:

sudo systemctl start sunset
sudo systemctl enable sunset

Install lightcontroller

cd cmd/lightcontroller
go build
sudo mkdir -p /opt/lightcontroller/bin
sudo mkdir /etc/opt/lightcontroller
sudo cp lightcontroller /opt/lightcontroller/bin

Create /etc/systemd/system/lightcontroller.service

[Unit]
Description=Light controller
After=nats.service

[Service]
ExecStart=/opt/lightcontroller/bin/lightcontroller
WorkingDirectory=/etc/opt/lightcontroller
StandardOutput=inherit
StandardError=inherit
Restart=always
#User=nats

[Install]
WantedBy=multi-user.target

Start and enable it so that it is started on boot:

sudo systemctl start lightcontroller
sudo systemctl enable lightcontroller

Install controller

cd cmd/controller
go build
sudo mkdir -p /opt/controller/bin
sudo mkdir /etc/opt/controller
sudo cp controller /opt/controller/bin

Create /etc/systemd/system/controller.service

[Unit]
Description=Controller
After=nats.service

[Service]
ExecStart=/opt/controller/bin/controller
WorkingDirectory=/etc/opt/controller
StandardOutput=inherit
StandardError=inherit
Restart=always
#User=nats

[Install]
WantedBy=multi-user.target

Start and enable it so that it is started on boot:

sudo systemctl start controller
sudo systemctl enable controller

lights's People

Contributors

gmulders avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.