webcron/README.md

62 lines
2.2 KiB
Markdown
Raw Permalink Normal View History

2017-04-15 13:45:37 +02:00
# Webcron Management
2021-11-25 15:23:20 +01:00
(c) 2017-2018, 2021- Jeroen De Meerleer <me@jeroened.be>
2017-04-15 13:45:37 +02:00
2021-11-25 15:23:20 +01:00
Webcron management is an easy-to-use interface to manage cronjobs running on a publicly available http-location.
2017-04-15 13:45:37 +02:00
2022-09-07 12:09:49 +02:00
## Building
2021-11-25 15:23:20 +01:00
### Requirements for build-server
2022-09-07 12:09:49 +02:00
* php <= 8.1 (incl composer <= 2, ext-pcntl, ext-openssl, ext-intl)
2022-09-05 16:13:31 +02:00
* NodeJS <= 16.0 (incl. npm <= 8)
2021-11-25 15:23:20 +01:00
### Building
Please run following command on the build server
```shell
$ composer install --no-dev --optimize-autoloader
$ npm install
2022-09-07 12:09:49 +02:00
$ npm run build
2021-11-25 15:23:20 +01:00
$ rm -rf node_modules # Node modules are only required for building
```
2017-04-15 13:45:37 +02:00
2022-09-07 12:09:49 +02:00
## Installation
### Requirements
* php <= 8.1
* ext-openssl
* ext-intl
* ext-pcntl (highly recommended)
* MariaDB
* SSH-access to the server
* Ability to change the webroot directory
* Ability to run a script as daemon (eg. supervisor or systemd units)
2017-04-15 13:45:37 +02:00
2021-11-25 15:23:20 +01:00
### Installation
2022-09-07 12:09:49 +02:00
1. Create a build yourself or download the build from the releases page
2. Upload the build to the webserver.
2021-11-25 15:23:20 +01:00
3. Set up your webhosting to use the `/public` directory as web root
2022-09-07 12:09:49 +02:00
4. Create the .env file by copying .env.sample to .env and change the values
5. Run `php bin/console doctrine:migrations:migrate` to create or migrate the database
6. Create a first user by running `php bin/console webcron:user add`
7. 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)
2017-04-15 13:45:37 +02:00
2021-11-25 15:23:20 +01:00
```shell
0 * * * * cd /path/to/webcron/ && php webcron daemon --time-limit=3600 > /dev/null 1&>2
2017-04-15 13:45:37 +02:00
```
2022-09-07 12:09:49 +02:00
## Upgrading
### Requirements
Same requirements and deploying
2021-11-25 15:23:20 +01:00
2022-09-07 12:09:49 +02:00
### Procedure
1. Remove all files except .env from the webserver
2. Upload the new build to the webserver
3. Run `php bin/console doctrine:migrations:migrate` to migrate the database
2017-05-10 15:28:45 +02:00
2022-09-07 12:09:49 +02:00
## Common pitfalls
2017-05-10 15:28:45 +02:00
### I can't do an automatic system upgrade!
Doing a system upgrade requires sudo which has a certain number security measurements. To enable running anything with sudo (eg. `sudo apt dist-upgrade -y`) the user needs to be able to run sudo without tty and password.
TL;DR
* [disable sudo passwords](http://jeromejaglale.com/doc/unix/ubuntu_sudo_without_password)
2022-08-09 17:33:25 +02:00
* [disable tty requirement](https://serverfault.com/questions/111064/sudoers-how-to-disable-requiretty-per-user)