Skip to content

Repository for the web-app part of Forstler.

Notifications You must be signed in to change notification settings

n3ur0mancer/forstler-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Forstler – Single Page Application

Repository for the app part of Forstler. Please keep in mind that this is a work in progress.

frontend

What is this project about?

This repository is the single page application part of Forstler. Forstler is an app to monitor and visualize forest health. It uses regional data from third party providers and compares it with the local data which is being gathered by the Forstler IoT module.

The IoT part can be found in the forstler-iot repository.

The Forstler app also tries to provide recommendations for tree species, which can be suitable for the selected location, based on the climate, lighting and soil conditions.

This project is currently just a prototype and needs further development to be fully functional.

Getting Started

Prerequisites to get started

This project assumes that you have Node.js and Docker already up and running on your machine.

Create a MySQL container in Docker

  1. The Docker Desktop application is optional, but a nice user interface tool to visualise the running containers.

  2. Download the docker-compose.yml file, and store it in a dedicated directory. You can download the file from the Kaggle Forstler Project.

  3. Compose a docker container from the docker-compose.yml file in the directory where the file is located:

docker-compose -f docker-compose.yml up
  1. The docker container should now be up and running.
  2. You can terminate the container via the Docker Desktop application, or with the following command:
docker stop forstler-mysqldb
  1. To restart the created container, use the Docker Desktop application, or the following command:
docker start forstler-mysqldb

Connect and use SQL workbench

The following part assumes that you set up the MySQL docker container following the instructions from the previous section: “Create a MySQL container in Docker”.

I am using Sequel Ace since it seems to be the most reliable SQL workbench for me, but the following procedure should be roughly the same for other SQL workbenches as well.

  1. Start the forstler-mysqldb docker container.
  2. Open the SQL workbench of your choice and enter the credentials and port.
  3. The port should be set to: 3307.
  4. Test the connection and and insert the chosen password from the docker-compose.yml .
  5. You can now use the user interface of the SQL workbench to work with the database.

Creating the tables and populating them with data

All the necessary data for the prototype can be found and downloaded from the Kaggle Forstler Project. Also included are the aforementioned docker-compose.yml and the following dbconfig.env.

Also included are the CREATE TABLE syntaxed, which should be used in the created docker container to create the necessary tables. Once these are created, import the CSV datasets. They are conveniently named after the table that they should be imported in.

Creating the .env file for the database connection

Insert a dbconfig.env file in the root directory of the project (the directory with client and server inside).

In case you are using the stock configuration from the part “Create a MySQL container in Docker” you can simply download the dbconfig.env file from the Kaggle Forstler Project and store it in the root directory (i.e. in the directory with the server and client directories).

In case you used your personal configuration in the previous parts, make sure to adapt the information accordingly. The .env is included in the .gitignore file to make sure, that your supplied credentials will not be uploaded in case you want to fork this project.

Starting the server

  1. Naviagte to the ./forstler-app/server directory.
  2. Install the dependencies:
npm install
  1. In the CLI start the server with the following command:
node index.js
  1. You should be greeted with the following statement if everything worked our correctly: “Server listening on port 3001”

Starting the client

  1. Naviagte to the ./forstler-app/client directory.
  2. Install the dependencies:
npm install
  1. In the CLI start the server with the following command:
npm start
  1. The react.js app should now be up and running on the port 3000.