diff --git a/.examples/podman/README.md b/.examples/podman/README.md index 155ae52..d81fe3a 100644 --- a/.examples/podman/README.md +++ b/.examples/podman/README.md @@ -1,12 +1,14 @@ # Run LibreBooking with Podman -## Using the command line (test) +## Using the command line -This setup is meant for accessing the application for test purposes. -It features: +This example features: * A librebooking container reachable at -* A persistent storage for the database and librebooking configuration files +* A cron container executing scheduled librebooking-related jobs +* A database container hosting the librebooking data +* Persistent volumes storage for the database, librebooking configuration, +uploaded images and reservations Adapt files `db.env`and `lb.env` to your needs @@ -20,7 +22,7 @@ Add the containers to the pod ```sh podman container create \ - --name db \ + --name librebooking-db \ --replace \ --pod librebooking \ --volume librebooking-db_conf:/config:U \ @@ -28,12 +30,24 @@ podman container create \ docker.io/linuxserver/mariadb:10.6.13 podman container create \ - --name app \ + --name librebooking-app \ --replace \ --pod librebooking \ --volume librebooking-app_conf:/config:U \ + --volume librebooking-app_img:/var/www/html/Web/uploads/images:U \ + --volume librebooking-app_res:/var/www/html/Web/uploads/reservation:U \ --env-file lb.env \ docker.io/librebooking/librebooking:develop + +podman container create \ + --name librebooking-cron \ + --replace \ + --pod librebooking \ + --volumes-from librebooking-app \ + --volume ./crontab:/config/lb-jobs-cron:U \ + --env-file lb.env \ + docker.io/librebooking/librebooking:develop \ + supercronic /config/lb-jobs-cron ``` Start the application @@ -48,15 +62,15 @@ Stop the application podman pod stop librebooking ``` -## Using a Kubernetes yaml file (test) - -This setup is meant for accessing the application for test purposes. -It features: +## Using a pod file -* A librebooking container reachable at -* A persistent storage for the database and librebooking configuration files +This setup is equivalent to the previous one, except it uses the +`podman kube play` command. -Adapt file `librebooking.yml` to your needs +From the previous example, generate the pod file +```sh +podman kube generate librebooking --filename librebooking.yml +``` Start the application diff --git a/.examples/podman/crontab b/.examples/podman/crontab new file mode 100644 index 0000000..2ba4c66 --- /dev/null +++ b/.examples/podman/crontab @@ -0,0 +1,10 @@ +# Every minute +* * * * * php -f /var/www/html/Jobs/autorelease.php +* * * * * php -f /var/www/html/Jobs/sendmissedcheckin.php +* * * * * php -f /var/www/html/Jobs/sendreminders.php +* * * * * php -f /var/www/html/Jobs/sendwaitlist.php + +# Every day at midnight +0 0 * * * php -f /var/www/html/Jobs/sendseriesend.php +0 0 * * * php -f /var/www/html/Jobs/sessioncleanup.php +0 0 * * * php -f /var/www/html/Jobs/deleteolddata.php diff --git a/.examples/podman/lb.env b/.examples/podman/lb.env index 72bb6a6..47cef0f 100644 --- a/.examples/podman/lb.env +++ b/.examples/podman/lb.env @@ -2,7 +2,7 @@ LB_INSTALL_PASSWORD=app_install_pwd LB_DATABASE_PASSWORD=db_user_pwd LB_DATABASE_NAME=librebooking LB_DATABASE_USER=lb_user -LB_DATABASE_HOSTSPEC=db +LB_DATABASE_HOSTSPEC=librebooking-db LB_LOGGING_FOLDER=/var/log/librebooking LB_LOGGING_LEVEL=DEBUG LB_LOGGING_SQL=false diff --git a/.examples/podman/librebooking.yml b/.examples/podman/librebooking.yml deleted file mode 100644 index 5cc0f7e..0000000 --- a/.examples/podman/librebooking.yml +++ /dev/null @@ -1,63 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - labels: - app: librebooking - name: librebooking -spec: - containers: - - name: db - image: docker.io/linuxserver/mariadb:10.6.13 - volumeMounts: - - mountPath: /config - name: librebooking-db-conf-pvc - env: - - name: TZ - value: Europe/Helsinki - - name: PGID - value: "1000" - - name: MYSQL_ROOT_PASSWORD - value: db_root_pwd - - name: PUID - value: "1000" - - name: app - image: docker.io/librebooking/librebooking:develop - args: - - apache2-foreground - ports: - - containerPort: 8080 - hostPort: 8080 - securityContext: {} - volumeMounts: - - mountPath: /config - name: librebooking-app-conf-pvc - env: - - name: LB_LOGGING_FOLDER - value: /var/log/librebooking - - name: LB_DATABASE_PASSWORD - value: db_user_pwd - - name: LB_UPLOADS_IMAGE_UPLOAD_URL - value: Web/uploads/images - - name: LB_DATABASE_USER - value: lb_user - - name: LB_LOGGING_SQL - value: "false" - - name: LB_DATABASE_NAME - value: librebooking - - name: LB_UPLOADS_RESERVATION_ATTACHMENT_PATH - value: Web/uploads/reservation - - name: LB_DATABASE_HOSTSPEC - value: db - - name: LB_DEFAULT_TIMEZONE - value: Europe/Helsinki - - name: LB_LOGGING_LEVEL - value: DEBUG - - name: LB_INSTALL_PASSWORD - value: app_install_pwd - volumes: - - name: librebooking-db-conf-pvc - persistentVolumeClaim: - claimName: librebooking-db-conf - - name: librebooking-app-conf-pvc - persistentVolumeClaim: - claimName: librebooking-app-conf