- php artisan horizon:install
INFO Installing Horizon resources.
Service Provider ......................................................... 0.66ms DONE
Configuration ............................................................ 0.35ms DONE
INFO Horizon scaffolding installed successfully.
Predis\Connection\ConnectionException
php_network_getaddresses: getaddrinfo for redis failed: Temporary failure in name resolution [tcp://redis:6379].
/etc/redis/redis.conf
...
# If you run Redis from upstart or systemd, Redis can interact with your
# supervision tree. Options:
# supervised no - no supervision interaction
# supervised upstart - signal upstart by putting Redis into SIGSTOP mode
# supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET
# supervised auto - detect upstart or systemd method based on
# UPSTART_JOB or NOTIFY_SOCKET environment variables
# Note: these supervision methods only signal "process is ready."
# They do not enable continuous liveness pings back to your supervisor.
supervised systemd
...
- sudo systemctl status redis
● redis-server.service - Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2024-11-13 09:11:49 UTC; 13s ago
Docs: http://redis.io/documentation,
man:redis-server(1)
Process: 1796508 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)
Main PID: 1796517 (redis-server)
Tasks: 4 (limit: 1131)
Memory: 2.0M
CGroup: /system.slice/redis-server.service
└─1796517 /usr/bin/redis-server 127.0.0.1:6379
Nov 13 09:11:49 ubuntu-s-1vcpu-1gb-sgp1-01 systemd[1]: redis-server.service: Succeeded.
Nov 13 09:11:49 ubuntu-s-1vcpu-1gb-sgp1-01 systemd[1]: Stopped Advanced key-value store.
Nov 13 09:11:49 ubuntu-s-1vcpu-1gb-sgp1-01 systemd[1]: Starting Advanced key-value store...
Nov 13 09:11:49 ubuntu-s-1vcpu-1gb-sgp1-01 systemd[1]: redis-server.service: Can't open PID file /run/redis/redis-serve>
Nov 13 09:11:49 ubuntu-s-1vcpu-1gb-sgp1-01 systemd[1]: Started Advanced key-value store.
- redis-cli
127.0.0.1:6379> ping
PONG
ecosystem.config.cjs
module.exports = {
apps : [{
name: 'Laravel Horizon',
script: 'php',
args: 'artisan horizon',
}],
}
- pm2 start ecosystem.config.cjs
[PM2][WARN] Applications Laravel Horizon not running, starting...
[PM2] App [Laravel Horizon] launched (1 instances)
┌────┬────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬─────────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ restart │ status │ cpu │ mem │ user │ watching │
├────┼────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼─────────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ Laravel Horizon │ default │ N/A │ fork │ 1808674 │ 0s │ 0 │ online │ 0% │ 20.5mb │ root │ disabled │
└────┴────────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴─────────┴───────────┴──────────┴──────────┴──────────┴──────────┘