No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

2.2KB

Raspberry Pi deployment

This app can run directly on a Raspberry Pi with nginx + php-fpm instead of Docker.

What the script does

scripts/deploy-raspi.sh runs from your local machine and connects over SSH to the Pi. On the Pi it will:

  • install nginx, git, composer, and PHP 8.2 packages
  • clone or update the repository
  • create/update .env
  • install Composer dependencies
  • prepare the default SQLite database
  • run migrations
  • create an nginx vhost that serves public/
  • create a systemd service for php command.php queue:work

Assumptions

  • the Raspberry Pi is running a Debian/Raspberry Pi OS style distro with apt
  • your SSH user can run sudo
  • the repository is reachable from the Pi over Git/SSH or HTTPS
  • you want the app at /var/www/warehouse
  • you are fine using the app's default SQLite setup

Basic usage

From this repo on your local machine:

chmod +x scripts/deploy-raspi.sh
scripts/deploy-raspi.sh pi raspberrypi.local git@github.com:YOUR_USER/warehouse.git DietPi.ntp.kentcommunications.com

Arguments:

  • argument 1: SSH user, for example pi
  • argument 2: SSH host, for example 192.168.1.50
  • argument 3: Git clone URL the Pi can access
  • argument 4: nginx server_name value, optional, defaults to DietPi.ntp.kentcommunications.com

Useful environment overrides

DEPLOY_REF=main \
DEPLOY_PATH=/var/www/warehouse \
PHP_VERSION=8.2 \
scripts/deploy-raspi.sh pi raspberrypi.local git@github.com:YOUR_USER/warehouse.git DietPi.ntp.kentcommunications.com

After deploy

  • browse to http://DietPi.ntp.kentcommunications.com
  • check nginx with sudo systemctl status nginx
  • check php-fpm with sudo systemctl status php8.2-fpm
  • check the queue worker with sudo systemctl status warehouse-queue.service

Notes

  • the app serves from public/, so the nginx root must stay pointed there
  • low-stock emails are always queued in this app, so the queue worker service matters in production
  • this script sets up HTTP only; add TLS separately with certbot or another reverse-proxy setup if you want HTTPS
  • if you prefer MySQL instead of SQLite, update .env and the script before rerunning it

Powered by TurnKey Linux.