Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dsampaolo's avatar

Problem when provisioning a custom VPS

Hi,

I'm trying to provision a Forge server using a custom VPS, using Ubuntu 18.04 LTS. I have a PHP script (using phpseclib) that connects to the server and launch the provision command, so it must be 100% non-interactive.

I have two problems.

[solved] NON-INTERACTIVE and redis

The pecl command which install redis can't be run in non-interactive mode, I had to modify the provision command as follow :

wget -O forge.sh https://forge.laravel.com/servers/337750/vps?forge_token=nOFdTasHQj2P8Dmi0RY3oCpc4Ns7OBWaq2DCRjm5; sed s/"pecl install redis"/"yes '' |pecl install redis"/ forge.sh |bash forge.sh

Script blocks after a while

My provision script stops after a while.

I dumped its output to a log file, here are the last lines :

Setting up libhttp-parser2.7.1:amd64 (2.7.1-2) ...
Setting up libc-ares2:amd64 (1.14.0-1) ...
Setting up nodejs (8.10.0~dfsg-2ubuntu0.4) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Reading package lists...
Building dependency tree...
Reading state information...

It looks like something is broken when it tries to install node/npm.

The relevant part of the provisioning script is this :

usermod -a -G www-data forge
id forge
groups forge

curl --silent --location https://deb.nodesource.com/setup_10.x | bash -

apt-get update

sudo apt-get install -y --force-yes nodejs

npm install -g pm2
npm install -g gulp
npm install -g yarn

On my server, the forge user is correctly added to the www-group, nodejs is installed (v8.10.0), but npm isn't.

I didn't find any error in my syslog.

If someone as a lead on this, it would be greatly appreciated.

0 likes
0 replies

Please or to participate in this conversation.