Yes, that is a simple opinion.
Do it with one simple file:
const spawnSync = require('node:child_process').spawnSync;
const http = require('node:http');
const pullScript = `cd project1-folder && git pull && php artisan optimize && cd ../project2-folder && git pull && php artisan optimize && cd ../project3-folder && git pull && npm i && npm run build && supervisorctl restart project3:`;
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer(async (req, res) => {
const result = spawnSync('su', ["-l","user1",'bash', '-c', pullScript], { encoding: 'utf-8' });
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
const allLines = result.output
? result.output
.filter(Boolean) // remove null or undefined
.map((output) => res.write(output.toString()))
.join('\n')
: '';
console.log(allLines)
res.end('Done\n');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
Now, you can write an API to call http://localhost:3000 to pull 3 project. You can `composer update` or something more.