openagri-eu / farmcalendar

European Union Public License 1.2
1 stars 0 forks source link

OpenAgri Digital Farm Calendar

The “OpenAgri Digital Farm Calendar” service addresses the data capture needs of farms including the manual recording of: farmers operations, farmers observations, parcels properties and recording of farms’ assets. The Farm Calendar follows a mixed model (edge-cloud) approach, offering (reduced) functionality even without internet connectivity. A Web User Interface (UI) is provided which allows the users the visualize and navigate through the farm calendar of activities and to facilitate the management of the farm assets. Moreover, all these operations and farm assets can be managed through a REST API, which provides these resources in a linked data format (i.e., using JSON-LD) and conforms to the OpenAgri Common Semantic Model (OCSM).

Prerequisites

Before you start, make sure Docker and Docker Compose are installed on your system. Later versions of Docker also include now Docker Compose, but it is used as docker compose instead of docker-compose.

Service Setup

Setting up Configurations (.env file)

If you wish to start up this Farm Calendar service from this repository, you'll need to first copy the .env.sample file into a new file called .env, which will be the source of all configurations for this service, and its database.

In this new .env file you should change the configurations of the service to meet your deployment scenario. We strongly suggest changing configurations for the default usernames and passwords of the services used.

The details for the configuration variables that are not self-explanatory are:

Running

There is already a simple and ready to use docker-compose.yml file for your convinience. Nonetheless, you should be able to use the existing file as a base, and adapt it to your own deployment setup.

To run the service, execute the following command:

$ docker compose up -d

Stopping/Restarting

To stop the service related containers, run:

docker compose stop

And to start again the stopped containers:

docker compose start

To stop and remove the containers, use:

docker-compose down

Local Admin User (No Gatekeeper)

if you are not using the OpenAgri Gatekeeper service to provide authentication and user management, then you should remove the GATEKEEPER_LOGIN_URL configuration from your .env file. This will make your Farm Calendar service work with its own internal user authentication (using Django's auth and password process). In this case, to create your admin user you should run:

$ docker compose run --rm web python3 manage.py createsuperuser

this will present you with inputs that will guide your creation of your admin user.

Accessing your local Farm Calendar

After starting the services, the Farm Calendar Web UI will be available at: http://localhost:8002/

Meanwhile, the REST API root is available at: http://localhost:8002/api/v1/

Both the Web UI and REST API are only available after login in in the OpenAgri Gatekeeper, or if no Gatekeeper is bying used, then username and password of the local admin user sould be used.

Swagger Live Docs

Use the Online Swagger Editor to visualise the current API specification and documentation.

License

This project code is licensed under the EUPL 1.2 license, see the LICENSE file for more details. Please note that each service may have different licenses, which can be found their specific source code repository.