pns-solutions / Plant-Nutrient-Control

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is our main Project with all features!

Installation on a fresh and clean server (like Raspberry Pi)

When setting up a raspberry pi and you do not know the IP adress, the device should be available at raspberrypi.local. A freshly installed pi can be accessed via WiFi only if the network setup was done while flashing the SD card or via SSH over ethernet.
For the latter option use

sudo raspi-config

after following step 1.

1. Login to your server (e.g.raspberry-pi)

ssh USERNAME@XXX.XXX.XXX.XX

2. Update apt-get

sudo apt-get update

3. Install Git:

sudo apt install git -y

4. Clone repo to your raspberry pi (or whatever you want to use)

you can use HTTPS (with personal access token) or SSH

HTTPS:

git clone https://github.com/pns-solutions/Plant-Nutrient-Control.git

use the token as password

SSH:

git clone git@github.com:pns-solutions/Plant-Nutrient-Control.git

if you don't have an ssh-key, follow the guide in the additional information section

5. Go to the cloned repository (on your server)

cd Plant-Nutrient-Control

6. Give all scripts the right permissions

chmod +x ./scripts/install-docker.sh && chmod +x ./scripts/start-docker.sh && chmod +x ./scripts/build-docker.sh &&  chmod +x ./scripts/addCronTab.sh

7. Install docker

./scripts/install-docker.sh

You will probably be asked to allow the installation of additional packages. Accept by entering 'Y'.

After this script is finished, the system will restart. Wait a minute to reconnect via SSH. Then go again into the cloned repository (cd Plant-Nutrient-Control).

8. Start docker

./scripts/start-docker.sh

9. Add CronTab

./scripts/addCronTab.sh

10. Build docker

./scripts/build-docker.sh

If there were no problems, your system should run now. Otherwise, use the manuel installation in the additional information section


Installation on an already fully set up server (like Raspberry Pi)

1. make sure you have installed the following dependencies

  • apt-get (update it before you start with the installation)
  • git
  • docker (installed and running)

2. Login to your server (e.g.raspberry-pi)

ssh USERNAME@XXX.XXX.XXX.XX

3. Clone repo to your raspberry pi (or whatever you want to use)

you can use SSH (preferred) or HTTPS

SSH:

git clone git@github.com:pns-solutions/Plant-Nutrient-Control.git

if you don't have an ssh-key, follow the guide in the additional information section

HTTPS:

git clone https://github.com/pns-solutions/Plant-Nutrient-Control.git

4. Go to the cloned repository (on your server)

cd Plant-Nutrient-Control

5. Build docker application

chmod +x ./scripts/build-docker.sh
./scripts/build-docker.sh

If there were not problems, your system should run now. Otherwise, use the manuel installation in the additional information section


Restart Application

1. Go to the cloned repository (on your server)

cd Plant-Nutrient-Control

2. Restart docker application

docker-compose up -d --force-recreate

Locations

Your application should now be accessible from the following locations:

  • Application: 192.168.xxx.xx:8080
  • Elasticsearch: 192.168.xxx.xx:9200 | Will take a few minutes to start after docker compose completes successfully.
  • Kibana: 192.168.xxx.xx:5601 | Will take a few seconds to start after docker compose completes successfully.
  • Grafana: 192.168.xxx.xx:3030 | admin:admin (initial)
  • NodeRed: 192.168.xxx.xx:1880
  • MQTT: 192.168.xxx.xx:8883 | Does not display HTTPS results. Try a NodeRed flow.

Default Imports

NodeRed Flows

  • menu
  • import
  • local
  • select: dataFaker.json
  • import

Grafana Dashboard

  • go to the left menu and hover over the plus sign
  • select import
  • upload the dashboard json file
    • location: grafana/default-dashboards/
  • select load

Additional Information

Manuel installation without script

1. Login to your server (e.g.raspberry-pi)

ssh USERNAME@XXX.XXX.XXX.XX

2. Update apt-get

sudo apt-get update

install docker

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

adding your user to the docker group

sudo usermod -a -G docker $USER

restart pi:

sudo reboot

install docker compose

sudo apt-get install docker-compose

start docker

sudo systemctl enable docker # Auto-start on boot
sudo systemctl start docker # Start right now

go to the cloned repository (on your server)

cd /DockerSetup

run the following commands:

docker-compose build && docker-compose up -d
docker exec -it webapplication sh -c "mkdir -p logs && chmod 755 logs"
docker exec -it webapplication sh -c "cd assets/composer && composer update &&  composer install"
docker exec -d webapplication sh -c "cd scripts && chmod 755 restartSensorController.sh && ./restartSensorController.sh"

Generate SHH-Key

ssh-keygen -t rsa
  • enter
  • password
  • repeat password
  • get ssh key:
cat ~/.ssh/id_rsa.pub  
  • copy key to clipboard
  • go to GitHub
  • you profile icon -> setting
  • SSH and GPG keys
  • new SSH key
  • add the key from ssh

About


Languages

Language:HTML 36.7%Language:CSS 32.2%Language:PHP 26.5%Language:Dockerfile 2.1%Language:JavaScript 1.6%Language:Shell 0.9%