Git Product home page Git Product logo

lucatacconi / crunz-ui Goto Github PK

View Code? Open in Web Editor NEW
12.0 2.0 0.0 1.12 MB

Natural graphical user interface for Crunz (Crunzphp/Crunz). Allows users to setup tasks natively written in PHP and schedule them configuringing date and time of start, intervals and conditions of init and execution.

License: MIT License

Vue 51.61% CSS 0.03% JavaScript 2.88% HTML 1.15% PHP 43.12% Shell 1.21%
api jwt-authentication vue vuetify vue-router http-vue-loader crunz crontab administration slim4

crunz-ui's Introduction

Crunz-ui

Latest Stable Version Total Downloads Latest Unstable Version License

Crunz-ui


Crunz-ui starts from the most famous GitHub Crunzphp/Crunz project and it's proposed to be its natural graphical interface, developed to make its usage more accessible and easy to use. Designed to be extremely light, it uses lucatacconi/silly-vue-scaffolding which guarantees the project its elastic and dynamic structure.


Table of Contents (click to expand)

ℹ️ Use the link below if you want to skip information about Crunz and Crunz-ui and go straight to setup procedures:

Shortcuts to Docker and Composer setup procedure


What Crunz is and how Crunz-ui connects to it

Crunz is an application that allows users to schedule tasks natively written in PHP, programming date and time of start, interval and conditions of execution, and init.

You can find details about Crunz and how to write and schedule tasks at the following address: https://github.com/crunzphp/crunz

Crunz task example:

<?php
// tasks/backupTasks.php

use Crunz\Schedule;

$schedule = new Schedule();
$task = $schedule->run('cp project project-bk');
$task->daily();

return $schedule;

Crunz-ui natively uses Crunz libraries and functions to read and interpret the configured tasks; then presents tasks in a tabular or graphical display, showing them on a monthly or daily view.


What else can Crunz-ui do?

In addition to displaying tasks in tabular or graphic format, Crunz-ui allows you to:

  • Manage tasks through easy-to-use interfaces (create, modify, archive, delete tasks)
  • Upload or download tasks with an intuitive and simple file manager system
  • Quick display of results of the tasks that have been executed (The indicator icons easily show whether the task was performed with errors or successfully)
  • Search and display the outcome of task execution on a specific date or selected through various search parameters
  • Forced run of the task, even outside the scheduled time with an eventual display of the log once the execution is completed



Crunz-ui

Browser Support

Chrome Firefox Safari Opera Edge IE
Latest ✔ Latest ✔ Latest ✔ Latest ✔ Latest ✔ No

System Requirements

  • Linux OS and Bash shell
  • Service ntp enabled
  • Apache and PHP 7.4 or newer, with rewrite.load module enabled
  • Composer
  • Sudo capabilities

Pre-installation safety warnings

⚠️ Crunz and Crunz-ui need that the operator has the permissions to set up crontab entry to schedule the regular execution of the task management process. Crontab entry owner must be carefully selected: using high permissions level user (ex root) could allow tasks to access sensitive files or perform malicious operations on the entire server file system.

⚠️ It is very important to change as soon as possible the default password of the Crunz-ui admin user. Leaving the default password could allow malicious users to access the Crunz-ui task manager and load dangerous tasks with the capability to access sensitive files or perform malicious operations on the entire server file system.

⚠️ It is important to keep system clock synchronized. In the case of an unsynchronized clock, there could be misalignments in the execution of the tasks or the management of the user sessions.

⚠️ For browser security configurations, copy to clipboard buttons are available only if Crunz-ui is released in localhost or in an https domain.

⚠️ In countries where is present daylight saving time switch, there may be discrepancies in the task execution time and task outcome display on the day of the time switch.


Installation and application setup

The two quickest ways to install Crunz-ui are with a Docker container or by installing via Composer

Docker setup

Docker

If it is not necessary to install Crunz-ui alongside an existing Crunz installation, the simplest way to install it is to configure the software and do its startup through Docker. The Crunz-ui Docker container is the quickest way to have a running and ready-to-use application.

First of all, download both files to Github server.

  • Dockerfile - Docker container configuration file
  • Crunz.yml - Crunz standard configuration file

Manually edit Crunz configurations present in the Crunz.yml file. Inside the file, there are suggestions about the individual configuration parameters. Please refer to Crunzphp/Crunz for more details on the configuration.

Initialize Crunz-iu Docker container. Be careful to select the correct timezone before running the command. (ex. TIMEZONE=Europe/Rome)

sudo docker build -t crunz-ui --build-arg TIMEZONE=Europe/Rome:

Start Crunz-iu Docker container indicating the port through which to access the web interface (ex. DEST_PORT:ORIG_PORT 80:80 ):

sudo docker run -dp 80:80 --name crunz-ui-app crunz-ui

Access the application via browser (Refer to First login section for connection details)

http://LOCAL_IP/crunz-ui (Ex. http://192.168.1.127/crunz-ui)

Please refer to Ubuntu/Debian Docker setup example for suggestion.

Composer setup

Composer

Otherwise It's recommended that you use Composer to install Crunz-ui.

Starting from your Apache Server's Document Root folder or from a directory served by a virtual host, begin the application setup by Composer command:

composer create-project lucatacconi/crunz-ui

This will install Crunz-ui and all required dependencies.

ℹ️ There is no need to set a large max_execution_time property in your php.ini: Crunz performs tasks as if they were run from the console. When running PHP from the command line the default setting is 0 therefore without time limits.

Cruz-ui installed by Composer can work using the Crunz embedded in the packages or using the tasks and configurations of Crunz previously installed on the user's system.

If you have never used Crunz before or want to use the Crunz integrated into the packages, refer to the Never used Crunz before section. If you want to use Cruz-ui on a version of Crunz previously installed on the user's systems, refer to the Usage on a previous installation of Crunz section.

ℹ️ By default Crunz checks the correctness of the php code before considering the task file. In case of servers with less computing power, checking the syntax of the tasks considerably slows down the display of tables and statistics. You can set the .env parameter CHECK_PHP_TASKS_SYNTAX to false to inhibit syntax checking. In case of syntax errors in the tasks, configuring parameter CHECK_PHP_TASKS_SYNTAX to false could cause anomalous behavior in the Crunz-ui interfaces

Crunz-ui can also be used with Xampp. However, it is necessary to create a symbolic link of the Xampp's PHP in your system executables folder:

sudo ln -s /opt/lampp/bin/php /usr/bin/

Using Crunz-ui on Xampp with PHP already present on the server in a separate installation from XAMPP, functions "Execute and wait log" present in the Tasks table section menu will fail with the following error: Unable to load dynamic library 'curl.so'. Check FAQ to solve the problem.

Never used Crunz before

Cruz-ui has Crunz packages embedded in its libraries. Once configured, the application can then start viewing, managing and executing tasks.

To configure the application in this way, once Crunz-ui is installed, proceed as follows:

By accessing the project folder, you can use the specific function of Crunz to generate the basic configuration file of Crunz itself:

./vendor/bin/crunz publish:config

The procedure will ask the user to provide default timezone for task run date calculations; execution will generate the Crunz configuration file with the default settings. For more advanced configurations, refer to the Crunz manual.

At this point it is necessary to configure all the users who must be able to access the application. Refer to Accounts configuration section to configure users. By default, in the basic configuration, the admin user is configured with the temporary password password.

Then set an ordinary cron job (a crontab entry) which runs every minute, and delegates the responsibility to Crunz-ui event runner:

* * * * * cd /[BASE_CRUNZUI_PATH] && ./crunz-ui.sh

By default the configured log folder is ./var/logs inside Crunz-ui folder. To use custom log folder configure the .env file with the path of new log folder. The folder must be accessible and writeable by the Apache user.

If you have configured a custom log folder, the crontab configuration must be changed as follows:

* * * * * cd /[BASE_CRUNZUI_PATH] && ./crunz-ui.sh -l [LOGS_PATH]

Please refer to Ubuntu/Debian setup example for suggestion.

Usage on a previous installation of Crunz

First of all you need to tell Crunz-ui the exact location where Crunz is installed. To do this, edit the .env file inside the main folder of Crunz-ui by un-commenting the entry CRUNZ_BASE_DIR and indicating into that the value of the absolute path of Crunz installation. In order to be able to insert, modify and delete tasks, the Apache user must have access and write permissions to the tasks folder.

Then copy crunz-ui.sh file and TasksTreeReader.php into the Crunz base folder:

cp /[BASE_CRUNZUI_PATH]/crunz-ui.sh /[BASE_CRUNZ_PATH]
cp /[BASE_CRUNZUI_PATH]/TasksTreeReader.php /[BASE_CRUNZ_PATH]

By default crunz.ui.sh batch will search for standard log folder ./var/logs inside main Crunz folder. Therefore, if you want to use standard configuration, you need to create default folder for logs. The folder must be accessible and writeable by the Apache user:

cd /[BASE_CRUNZ_PATH]
mkdir ./var ./var/logs

Modify the Crunz process, configured in Crontab during the Crunz installation, replacing it with the Crunz-ui process:

* * * * * cd /[BASE_CRUNZ_PATH] && ./crunz-ui.sh

Configure, if needed, Crunz-ui .env file with a custom path of the log folder. In this case too it is important that the folder is accessible and writeable by the Apache user. If you have configured a custom log folder, the crontab configuration must be changed as follows:

* * * * * cd /[BASE_CRUNZ_PATH] && ./crunz-ui.sh -l [LOGS_PATH]

At this point it is necessary to configure all the users who must be able to access the application. Refer to Accounts configuration section to configure users. By default, in the basic configuration, the admin user is configured with the temporary password password.

Custom log directory configuration

By default, the configured log folder is ./var/logs inside Crunz / Crunz-ui folder. The folder must be accessible and writeable by the Apache user.

To configure custom folder set the .env file with the path of new log folder.

If you have configured a custom log folder, the crontab configuration must be changed as follows:

* * * * * cd /[BASE_CRUNZ_PATH / BASE_CRUNZUI_PATH] && ./crunz-ui.sh -l [LOGS_PATH]

Accounts configuration

All users enabled to access the application are configured in the configuration file /config/accounts.json.

The accounts.json configuration file has the following format:

[
    {
        "username":"admin",
        "name":"Admin User",
        "userType":"admin",
        "email":"[email protected]",
        "password":"password",
        "active":"Y",
        "expireDate":"2020-10-10",
        "customSessionDuration":""
    },
    {
        "username":"j.doe",
        "name":"Jhon Doe",
        "userType":"user",
        "email":"[email protected]",
        "password":"password",
        "active":"Y",
        "expireDate":"2020-10-10",
        "customSessionDuration":""
    },
    ...
]

Among the various information listed, the type of user is also induced, information that is then used to filter the menu items enabled for the user. For simplicity's choice the access configurations have been inserted in a file. However, nothing prevents the implementation of user management based on database reading.


First login

The application is preconfigured with a single access user to verify the login procedure and access the dashboard and the main menu.

To test access use the login admin and password password


Contributing

This project is maintained by a group of awesome contributors. Contributions are extremely welcome ❤️. Please see Contributing informations for details.

Roadmap

Please see Roadmap for details.

FAQ and Troubleshooting

For help, FAQ or troubleshooting please refer to FAQ and Troubleshooting.

Credits

License

Crunz-ui is licensed under the MIT license. See License File for more information.

crunz-ui's People

Contributors

emanuelemarchesotti avatar flagellarmirror avatar jimtools avatar lucatacconi avatar

Stargazers

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

Watchers

 avatar  avatar

crunz-ui's Issues

Sometime empty content editing task

Sometimes, when accessing the editing of a task nothing appears in the task content section even if the task file is correctly filled and functioning.

Could it be a problem in base64 decoding?

Wrong task calc in statistics for high frequency task

In case of high frequency tasks the calculation always seems to contain at least an execution as if it were unscheduled even if all the tasks are scheduled.It seems that the execution of the first task is not considered if the task has a lifetime set in the middle of the day.

The total task count does not seem correct in case of high frequency tasks.

immagine

Deprecation Warning

To Reproduce
Steps to reproduce the behavior:

When we run a command : vendor/bin/crunz schedule:list, we are getting the error pasted below.

Expected behavior

 [Deprecation] Method 'everyTwelveHours' is deprecated since v2.3, use 'cron'
               method instead. File
               /var/www/html/crunz-ui/vendor/lavary/crunz/src/Event.php, line
               217

Screenshots
image

How can I run on Nginx?

Can you tell me how to set up rewrite rules in Nginx? I'm having trouble getting it to work properly on Nginx.

DB stored tasks

Is your feature request related to a problem? Please describe.
Can't be used if running on phpfpm server farm with separate backends or in docker deploys with no shared storage.

Describe the solution you'd like
Store all takes in DB, deploy to tasks directory via cron script, also updates/deletes tasks as needed.
This could then extend to allowing you to assign tasks to specific nodes or distribute tasks etc as possible future features.

Describe alternatives you've considered
There are other apps that store crons in DB, just not the power of crunz and many are old and just support exec, not php functions.

Additional context
N/a

High frequency tasks display error

In case of tasks that are repeated once a minute or every few minutes, the dashboard fails in calculating the graphs.

In the same way, the display page of daily tasks and monthly tasks fails to produce the graphical display and goes into error.

Login didnt work

After login - Page redirects back to login page
I have configured the server with necessary PHP modules and configured the httpd conf properly.

Task not executed warning

It is not easy to understand, in the task table, if a task has been programmed but not executed.

If, for example, a task that is carried out once a day and has always been performed in the previous days but yesterday, not due to an error on the task but for an external reason (server error, network problems, ..), has not been performed, user has no immediate signs that point it out.

User will see the green indicator that tells him that the last time it was executed successfully, User will see the data of the last execution, but if he does not carefully observe the fact that the day before it was not carried out it could escape him.

It is necessary to find a way to notify the user.

Engine Error: Error - Task execution Error - Related to Logs All Settings appear correct

Describe the bug
When attempting to run a task manually, the following error is shown:
Engine Error: Error - Task execution Error

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Tasks table'
  2. Click on '...'
  3. Click on 'Execute and wait log'
  4. See the error (see below for screenshots)

Expected behavior
I would expect the task to run and show the log, or at least show the task ran successfully or indicate if there were any errors.

Screenshots
Screenshot of Error:
image

Screenshot Confirming that the Log file directories and settings all check out:
image

Desktop (please complete the following information):

  • OS: Mac Catalina
  • Browser Chrome
  • Version 91.0.4472.164

Additional context
The error is generated by the following block in task.php.

if(empty($log_file_name)){
throw new Exception("ERROR - Task execution error");
}

Search error

Running each search, nothing is shown and the following error appears in the console:

vue.min.js:11 TypeError: Cannot read properties of undefined (reading '0') at a.customSearch (eval at compile (httpVueLoader.js:161:5), <anonymous>:78:72) at a.search (eval at compile (httpVueLoader.js:161:5), <anonymous>:339:18) at dn (vue.min.js:11:21974) at t.run (vue.min.js:11:28876) at Ye (vue.min.js:11:18719) at Array.<anonymous> (vue.min.js:11:23024) at _n (vue.min.js:11:22424) vn @ vue.min.js:11

Bad contab time format cause internal server error

Describe the bug
Insert a bad crontab time format in a task causes an internal server error end block the executio of all task.
The task with bad format is non more visible in the task list and you have to edit the script on the filesystem.

To Reproduce
edit or create new task and insert a bad value for ->cron()
example: ..... ->cron('20/30 * * * *');

Expected behavior
verify cron format compatibility before save.

Wrong display title under Analytics section

In the boxes inside the analytics section, the title of the card does not change color in the case of a dark theme. It is impossible to read. It must, also in this case, change color dynamically

Task ID change uploading new tasks

The task ID is used to calculate the log file name with the outcome of the single task operation.

When uploading a new task, the number of tasks is changed: it cannot be used as a unique ID.

It is necessary to find a solution to uniquely identify the task.

Increased security in the application

problem
I saw that in the authentication process the password is only encrypted using the md5 algorithm without any salt or key, this makes the password easily decryptable in transit.

solution
I suggest adding an encryption key that remains constant when using md5 in app-side and server-side, this will make decryption more difficult.

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.