StartMyVPN relies on Laravel queues for operations that run in the background:
- Installing OpenVPN / WireGuard on new servers
- Generating WireGuard peer configs for users
- Adding and removing users from servers when services change
- Enforcing speed limits on WireGuard peers
- Cleaning up expired VPN configurations
Without a running queue worker, these operations will not execute.
Supervisor (recommended for production)
Supervisor keeps queue workers alive and restarts them if they crash.
Install Supervisor
sudo apt install supervisor -y
Create a worker configuration
sudo nano /etc/supervisor/conf.d/startmyvpn-worker.conf
[program:startmyvpn-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/startmyvpn/artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/var/www/startmyvpn/storage/logs/worker.log
stopwaitsecs=3600
Adjust numprocs based on your server’s CPU cores. 2 workers is sufficient for most deployments.
Start the workers
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start startmyvpn-worker:*
Check worker status
sudo supervisorctl status
Restarting workers after deployment
After deploying updates, restart the queue workers so they pick up code changes:
php artisan queue:restart
# OR via supervisorctl
sudo supervisorctl restart startmyvpn-worker:*
Development / testing
For local development, run the worker manually in a separate terminal:
Or process a single job at a time:
php artisan queue:work --once