Giter Site home page Giter Site logo

danielbrendel / hortusfox-web Goto Github PK

View Code? Open in Web Editor NEW
564.0 6.0 31.0 49.43 MB

Self-hosted collaborative plant management system for your local environment

Home Page: https://hortusfox.github.io

License: MIT License

PHP 67.33% JavaScript 7.43% SCSS 6.21% Hack 17.34% CSS 0.50% Shell 1.19%
gardening plant-care plant-growth plant-parent plants plants-grow home-plants plant-manager plant-monitoring plant-collection

hortusfox-web's Introduction


HortusFox

A self-hosted collaborative plant management system
(C) 2023 - 2024 by Daniel Brendel

www.hortusfox.com

web-php db-mysql license-mit maintained-yes

social-discord social-mastodon social-youtube social-instagram

Buy Me a Coffee at ko-fi.com


Table of Contents

Description

HortusFox is a self-hosted collaborative plant management system which you can use in your own environment to manage all your plants. You can add your plants with various details and photos and assign them to a location of your environment. There is a dashboard available that shows all important overview information. The system does also feature a warning system in order to indicate which plants need special care, user authentication, tasks, inventory management, calendar, collaborative chat and a history log of what actions users have taken. The system features collaborative management, so you can manage your plants with multiple users.

Features

  • ๐Ÿชด Plant management
  • ๐Ÿ  Custom locations
  • ๐Ÿ“œ Tasks system
  • ๐Ÿ“– Inventory system
  • ๐Ÿ“† Calendar system
  • ๐Ÿ” Search feature
  • ๐Ÿ•ฐ๏ธ History feature
  • ๐ŸŒฆ๏ธ Weather feature
  • ๐Ÿ’ฌ Group chat
  • โš™๏ธ Profile management
  • ๐Ÿฆ‹ Themes
  • ๐Ÿ”‘ Admin dashboard
  • ๐Ÿ“ข Reminders
  • ๐Ÿ’พ Backups
  • ๐Ÿ’ป REST API

Resources

Installation

Docker

Using Docker and Docker Compose simplifies the setup process and ensures consistency across different environments.

Prerequisites

  • Docker installed on your system
  • Docker Compose installed on your system

Follow these steps:

  1. Clone the repository:
git clone https://github.com/danielbrendel/hortusfox-web.git
cd hortusfox-web
  1. Set environment variables in the docker-compose.yml.

Set your admin user e-mail and password in order to login

# Admin login credentials
# services.app.environment
APP_ADMIN_EMAIL: "[email protected]"
APP_ADMIN_PASSWORD: "password"

Set database settings if required. It is encouraged to set custom passwords due to security reasons. All other settings can be left unaltered.

# Settings used to establish connections to the database
# services.app.environment
DB_HOST: db
DB_PORT: 3306
DB_DATABASE: hortusfox
DB_USERNAME: user
DB_PASSWORD: password
DB_CHARSET: "utf8mb4"

# Settings of the database container
# services.db.environment
MYSQL_ROOT_PASSWORD: my-secret-pw
MYSQL_DATABASE: hortusfox
MYSQL_USER: user
MYSQL_PASSWORD: password
  1. Pull the image and run the application:
docker-compose pull
docker-compose up -d
  1. The application should now be running on http://localhost:8080.

  2. You can now go to the admin dashboard in order to adjust your workspace settings and also go to your profile page in order to adjust your user preferences.

Hint: You should use a file system not like NTFS due to it can't deal with Unix ownerships, groups & permissions properly.

Installer

You can also use the integrated installer in order to install the product. In order for that to do, be sure that you are not running the system via the internal asatru development server. Instead you might want to, for instance, run the system from the context of a webserver environment like XAMPP. If you do that, just create a file named do_install (no file extension) in the root directory of the project and browse to the installer and the system will guide you through the installation process.

http://localhost/install

Be sure that PHP is installed and both your webserver and mysql server are running. If there is no vendor folder already created then the system will try to run Composer in order to install all required dependencies. For that to work you need to have Composer installed on your system. Altough the system tries to create the database for you, sometimes this might fail, so you will have to create the database before running the installation. However all table migrations will then be created by the system. The system can then be managed via the admin section (e.g. environment settings, users, locations).

Manual

In order to manually install HortusFox you need to first setup a PHP environment along with a MariaDB database and also Composer. Afterwards you can clone or download the repository. Then go to the root directory of the project and let Composer install the required dependencies.

composer install

Now we need to configure the project. Create a .env file from the .env.example, open it and manage the following variables:

# URL to the official service backend. Used for e.g. version comparision
APP_SERVICE_URL="https://www.hortusfox.com"

# URL to the repository of the project
APP_GITHUB_URL="https://github.com/danielbrendel/hortusfox-web"

# This must be set to true for the product to work in order to enable database connection
DB_ENABLE=true

# Enter your hostname or IP address of your MariaDB database server
DB_HOST=localhost

# Enter the database username
DB_USER=root

# Enter the database user password
DB_PASSWORD=""

# Database connection port. Normally this doesn't need to be changed
DB_PORT=3306

# The actual database of your MariaDB server to be used
DB_DATABASE=hortusfox

# Database driver. This needs to be unaltered for now
DB_DRIVER=mysql

# The name of the e-mail sender
SMTP_FROMNAME="Test"

# The e-mail address of the sender
SMTP_FROMADDRESS="[email protected]"

# Hostname or address to your SMTP mail provider
SMTP_HOST=""

# Port to be used for connecting to the host
SMTP_PORT=587

# Your SMTP username
SMTP_USERNAME=""

# Your SMTP password for authentication
SMTP_PASSWORD=""

# Communication encryption
SMTP_ENCRYPTION=tls

After saving the file you can now let the product create all neccessary tables via the following command:

php asatru migrate:fresh

Now you need to insert your initial app settings profile into the database. These settings can be later adjusted in the admin dashboard.

INSERT INTO `AppModel` (id, workspace, language, scroller, chat_enable, chat_timelimit, chat_showusers, chat_indicator, chat_system, history_enable, history_name, enable_media_share, cronjob_pw, overlay_alpha, smtp_fromname, smtp_fromaddress, smtp_host, smtp_port, smtp_username, smtp_password, smtp_encryption, pwa_enable, owm_enable, owm_api_key, owm_latitude, owm_longitude, owm_unittype, owm_cache, created_at) VALUES (
    NULL, 
    'My workspace name', 
    'en', 
    1, 
    1, 
    5, 
    1, 
    0,
    1, 
    1, 
    'History', 
    0, 
    'a-secret-pw', 
    null, 
    '', 
    '', 
    '', 
    587, 
    '', 
    '', 
    'tls',
    0,
    0,
    null,
    null,
    null,
    'default',
    300,
    CURRENT_TIMESTAMP
);

Next you should let the system perform some initial operations

# Add default plant attributes
php asatru plants:attributes

# Add default calendar classes
php asatru calendar:classes

You might now want to start your web server to host the application. If you want to quickly use the inbuilt webserver you can start it via:

php asatru serve

Now browse to http://localhost:8000/ and you should be redirected to the authentication page. At this point you need to create your first user. Go to your database control panel and switch to the users table. Add the user account that should get access to the application with admin privileges. The following is an example:

INSERT INTO `users` (`name`, `email`, `password`, `admin`) VALUES
(
    'Username',
    '[email protected]',
    'your_password_token_here',
    1
);

As you might have noticed the values that you need to customize are name, email, password and admin. All others are left with their default values. The password hash must be created manually. For testing purposes you might just want to quickly use something like:

php -r "echo password_hash('test', PASSWORD_BCRYPT);"

You may now login with your initial admin user account using your e-mail address and the password of which you have stored the hash in the table. After logging in, you should then be redirected to the dashboard. Further users can now be created via the admin area. Users can change their passwords in their profile preferences. They can also reset their password. Therefore an e-mail will be sent to them with restoration instructions. Each new created user can get a confirmation e-mail with an automatically generated password in order to log in. It is recommended that users change their passwords after their first login. Last but not least you need to add all your locations of your local environment to the database. You can do that either via the admin section or manually by inserting entries into the locations table.

INSERT INTO `locations` (`id`, `name`, `icon`, `active`, `created_at`) VALUES
(
    NULL,
    'Name of location',
    'fas fa-leaf',
    1,
    CURRENT_TIMESTAMP
);

The mandatory fields are name of location (e.g. garden, living room, kitchen, etc) as well as the FontAwesome icon to be used. You can use all free FontAwesome icons (v5.15.4 free icons). For a complete list of available icons, visit the FontAwesome search page. Note that you can then manage various aspects of the system via the admin section when logged in as a user with admin privileges. Additionally you might want to build the android mobile app for your users.

Cronjobs

Cronjobs are used to regularly execute a specific task. For each cronjob you need to set the cronjob parameter with your token set via AppModel.cronjob_pw. The following cronjobs are available:

# Used to inform users about overdue tasks. Should be called multiple times per day.
GET /cronjob/tasks/overdue?cronpw={your-auth-token}

# Used to inform users about tasks that are due tomorrow. Should be called multiple times per day.
GET /cronjob/tasks/tomorrow?cronpw={your-auth-token}

# Used to inform users about due calendar dates
GET /cronjob/calendar/reminder?cronpw={your-auth-token}

Application testing

WARNING: Application testing is currently under construction and will progress with further development.

Introduction

Application tests are useful to verify that specific parts of the application are still working after an update.

There are two types of tests whose purpose depend on the use case.

Feature

Feature tests are used to test an entire workflow. In order to achieve this, you simulate a call to a specific route of the application. Afterwards the returned result is checked if it matches the assumption. The assumption can depend on the calling context and request data (if any). Often calling a route will encompass various parts of the application during the process, such as Models, Modules, Helper functions, etc.

Unit

Unit tests are useful to test against specific parts of the application. For instance, you can test various methods of a Model or a Module. This is especially useful if you employ a test-driven-development approach to verify that a method works as expected in various scenarios.

Running the tests

In order to run all application tests, please issue the following command in the context of the root project directory:

"vendor/bin/phpunit" --stderr

In order to run the Feature suite, please issue the following command:

"vendor/bin/phpunit" --stderr --testsuite Feature

In order to run the Unit suite, please issue the following command:

"vendor/bin/phpunit" --stderr --testsuite Unit

Test data

Testing data should be specified as environment variables in the php section via the phpunit.xml.

System requirements

  • PHP ^8.3
  • MariaDB ^11.4
  • SMTP server for e-mailing
  • Docker with Docker-Compose for containerization

Contributing

Please view the contribution guidelines if you intend to contribute to this repository.

Security

If you discover any security vulnerability, please refer to the security guidelines on how to proceed.

hortusfox-web's People

Contributors

aeber avatar boc-the-git avatar brianw777 avatar danielbrendel avatar hasecilu avatar iandday avatar inputobject2 avatar krinkuto11 avatar lovelesscodes avatar mbrylka avatar millio345 avatar nbentfeld avatar xthrodx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hortusfox-web's Issues

Authentication page

If authentication failed then redirect to an auth page where user can input token in order to authenticate.

Input fields background color

For all input fields that are not part of a modal, the background color should match the dark style of the view it is placed in.

Optional 'due' date for tasks

Allow users to add an optional 'due' date to tasks. If it is reached and the task is not completed, then show a warning.

Error during installation

Dear Daniel,

First of all, thank you so much for your work on Hortusfox - your dedication is impressive, and this piece of software looks like exactly filling a gap in my self-hosting needs!

The Bug

I have tried to install Hortusfox following these instructions, however could not succeed: I stumble on an error when trying to populate the database (asatry migrate:fresh):

charlie@HomeServices:/opt/hortusfox-web$ php asatru migrate:fresh
PHP Fatal error:  Uncaught Error: Class "CacheModel_Migration" not found in /opt/hortusfox-web/vendor/danielbrendel/asatru-php-framework/src/database.php:1145
Stack trace:
#0 /opt/hortusfox-web/vendor/danielbrendel/asatru-php-framework/src/database.php(1199): Asatru\Database\MigrationLoader->dropAll()
#1 /opt/hortusfox-web/vendor/danielbrendel/asatru-php-framework/src/console.php(1034): migrate_fresh()
#2 /opt/hortusfox-web/asatru(37): Asatru\Console\handleInput()
#3 {main}
  thrown in /opt/hortusfox-web/vendor/danielbrendel/asatru-php-framework/src/database.php on line 1145

For reference, I cloned the repo in /opt, and gave all credentials to user charlie on the /opt/hortusfox-web folder

Server details

OS Debian 12

charlie@HomeServices:/opt/hortusfox-web$ uname -a
Linux HomeServices 5.15.131-1-pve #1 SMP PVE 5.15.131-1 (2023-11-09T09:29Z) x86_64 GNU/Linux

PHP v8.2.7

charlie@HomeServices:/opt/hortusfox-web$ php --version
PHP 8.2.7 (cli) (built: Jun  9 2023 19:37:27) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.7, Copyright (c), by Zend Technologies

MySQL v15.1

MySQL is installed and configured (I manually created user and database for hortusfox):

mysql  Ver 15.1 Distrib 10.11.4-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper

Composer v2.6.6

charlie@HomeServices:/opt/hortusfox-web$ composer
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 2.6.6 2023-12-08 18:32:26

Installation details

As far as I can tell, the Installation went smoothly. Here is the detail of the packages installed:

charlie@HomeServices:/opt/hortusfox-web$ composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 33 installs, 0 updates, 0 removals
  - Installing sebastian/version (2.0.1): Extracting archive
  - Installing sebastian/type (1.1.4): Extracting archive
  - Installing sebastian/resource-operations (2.0.2): Extracting archive
  - Installing sebastian/recursion-context (3.0.1): Extracting archive
  - Installing sebastian/object-reflector (1.1.2): Extracting archive
  - Installing sebastian/object-enumerator (3.0.4): Extracting archive
  - Installing sebastian/global-state (3.0.3): Extracting archive
  - Installing sebastian/exporter (3.1.5): Extracting archive
  - Installing sebastian/environment (4.2.4): Extracting archive
  - Installing sebastian/diff (3.0.4): Extracting archive
  - Installing sebastian/comparator (3.0.5): Extracting archive
  - Installing phpunit/php-timer (2.1.3): Extracting archive
  - Installing phpunit/php-text-template (1.2.1): Extracting archive
  - Installing phpunit/php-file-iterator (2.0.5): Extracting archive
  - Installing theseer/tokenizer (1.2.2): Extracting archive
  - Installing sebastian/code-unit-reverse-lookup (1.0.2): Extracting archive
  - Installing phpunit/php-token-stream (4.0.4): Extracting archive
  - Installing phpunit/php-code-coverage (7.0.15): Extracting archive
  - Installing phar-io/version (3.2.1): Extracting archive
  - Installing phar-io/manifest (2.0.3): Extracting archive
  - Installing myclabs/deep-copy (1.11.1): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.28.0): Extracting archive
  - Installing doctrine/instantiator (1.5.0): Extracting archive
  - Installing phpunit/phpunit (8.5.36): Extracting archive
  - Installing phpmailer/phpmailer (v6.9.1): Extracting archive
  - Installing symfony/translation-contracts (v3.4.0): Extracting archive
  - Installing symfony/deprecation-contracts (v3.4.0): Extracting archive
  - Installing symfony/translation (v6.4.0): Extracting archive
  - Installing symfony/polyfill-php80 (v1.28.0): Extracting archive
  - Installing psr/clock (1.0.0): Extracting archive
  - Installing carbonphp/carbon-doctrine-types (3.1.0): Extracting archive
  - Installing nesbot/carbon (2.72.1): Extracting archive
  - Installing danielbrendel/asatru-php-framework (v1.0): Extracting archive
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
27 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Reproduction steps:

  1. Configure server with NGinx, MySQL, PHP and Composer
  2. Clone git repo
  3. Run composer install in cloned repo
  4. Initialize databases with php asatru migrate:fresh

Thanks in advance!

Cleanup data on plant removal

The following data should also be removed when deleting a plant:

  • The photo images (thumb and original)
  • All associated gallery entries and photo images

Plants sorting

Sort plants in locations by various aspects:

  • Alphabetically
  • Last time watered
  • Last time repotted
  • Health status
  • Perennial
  • Light level
  • Humidity

Installer feature

Implement an installer feature so the product can be comfortably installed.

Versioned asset query

Use the versioning parameter of the asset() call in order to force a browser cache update.

Link to plant info website

Add an optional hyperlink to an informational resource to the scientific name. If one is provided then the text will turn into a hyperlink. If not it will just be plain text.

User settings in profile

Let users change some personal settings in profile view.

Possible settings:

  • Language
  • Log visibility

Mail notifications

Implement notifications per e-mail for important infos, such as when a task is overdue. Use with cronjob multiple execs per day, so not all users are notified at once.

Improve tasks layout

On desktop width task items should be displayed inline-block and take half of frame, so two items can be displayed next to each other.

Readme improvements

The following needs to be added/updated:

  • Add a description and indication that when installing the product the admin must add plant locations to the database manually
  • Fix all typos (e.g. You next step)

Overflow scrolling in single views

In single view pages such as auth or reset, the mobile scrolling is a bit messed up. Overflow scrolling for width should be disabled.

Long term session

Long term session, so that logins are not lost after closing browser.

Version check and hint

Check for new versions and if a new version is available then notice admin users by displaying a hint in the admin dashboard and index dashboard.

Chronicles

Implement a chronicles feature, so workspaces can keep a history of all past plants. Admins can give the chronicles a custom name if desired.

Quick search for plants

Add a quick search filter for plants of locations, so that the current list can be filtered by expressions.

Calendary filter for history

Let user select plants to show via calendary year starting from the first added entry. Show all related years as clickable tag style inline list.

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.