UPDATED README

This commit is contained in:
Jeroen De Meerleer 2021-11-25 15:23:20 +01:00
parent adf1cd2355
commit 942453a7a1
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
1 changed files with 44 additions and 28 deletions

View File

@ -1,38 +1,57 @@
# Webcron Management
(c) 2017, 2021 Jeroen De Meerleer <me@jeroened.be>
(c) 2017-2018, 2021- Jeroen De Meerleer <me@jeroened.be>
Webcron management is an easy-to-use interface to manage cronjob running on a publicly available http-location.
Webcron management is an easy-to-use interface to manage cronjobs running on a publicly available http-location.
## Status update
I'm currently in the process of rewriting the application to more modern standards. The current main branch is very unstable at the moment. Please don't use it.
Rewrite is currently beta-quality. Production-use is possible, but use with caution. Personally, I'm using it myself already in a production-like environment.
I encourage everyone to wait for the new version as upgrading will probably be very difficult.
### Known bugs
* (__! Security vulnerability !__) Secret variables can become exposed in job output
* Datepicker ([Tempus dominus v6](https://getdatepicker.com/)) is currently alpha-quality software. Altough [the dev states it is usable](https://jonathanpeterson.com/posts/state-of-my-datetime-picker-part-2.html)
### What will change with the rewrite?
* All urls will change. eg. /login/ and /jobs/5/edit/ instead of /login.php and editjob.php?jobId=5
* Dropping support for directly calling webcron.php from url-bar
* Daemonized main-script which will enable running cronjobs by seconds
## Deploying
### Requirements for web-server
* php <= 8.0
* ext-openssl
* ext-pcntl (highly recommended)
* MySQL/MariaDB or SQLite
* Ability to change the webroot directory
* Ability to run a script as daemon (eg. supervisor or systemd units)
## Requirements
* Webserver able to run PHP
* PHP 8.0 or greater
* MySQL/MariaDB (Or sqLite)
* Ability to add a system cronjob for installation (You can maybe ask you webhost?)
## Instalation
### Requirements for build-server
* php <= 8.0 (incl composer <= 2)
* NodeJS <= 14.0 (incl. npm <= 7)
Follow the instructions below to install the webcron interface
1. Copy this repository to a public directory on your server
2. Create a database using the database.sql provided in the repository
3. Create a first user by inserting a first record to the users table (Password is hashed with bcrypt)
4. Run `composer install` to install dependencies.
5. Open ssh and add following line to your crontab
```
* * * * cd /path/to/webcron/ && php webcron.php > /dev/null 1&>2
### Building
Please run following command on the build server
```shell
$ composer install --no-dev --optimize-autoloader
$ npm install
$ npx build prod
$ rm -rf node_modules # Node modules are only required for building
```
## Common pittfalls
### Configuration
All configuration can be found in .env.sample. Please copy this to file to .env and change its values
### Installation
First follow the build and configuration instructions. If you don't follow them correctly Webcron Management won't work correctly
1. Create your database and import the storage/database.sql file into the database
2. Create a first user by inserting a first record to the users table (Password is hashed using the HASHING_METHOD in your .env)
3. Set up your webhosting to use the `/public` directory as web root
4. Upload the repository to the webserver
5. Set up the daemon script using systemd, supervisord or similar system
* If this is not possible running the daemon using a cronjob is still possible using below gist (Not recommended)
```shell
0 * * * * cd /path/to/webcron/ && php webcron daemon --time-limit=3600 > /dev/null 1&>2
```
The webcron interface should now work as expected.
## Common pitfalls
### Cronjobs are not running
Did you edit the crontab?
@ -41,7 +60,4 @@ Doing a system upgrade requires sudo which has a certain number security measure
TL;DR
* [disable sudo passwords](http://jeromejaglale.com/doc/unix/ubuntu_sudo_without_password)
* [disable tty requirement](https://serverfault.com/questions/111064/sudoers-how-to-disable-requiretty-per-user)
### Can I schedule a reboot every week?
Yes, you can do this by creating a job with `reboot` as "url". When this job needs to run, the reboot is triggered to run at the very end. At the first run of the master script a list of active and terribly failed services is pushed to the job so you can check this if something is wrong.
* [disable tty requirement](https://serverfault.com/questions/111064/sudoers-how-to-disable-requiretty-per-user)