Skip to main content

Iṣeto Olupese

This is mostly basic Linux server configuration stuff but I felt it important to document and share the steps I took to get Verdaccio running permanently on my server. You will need root (or sudo) permissions for the following steps.

Nṣiṣẹ gẹgẹbi olumulo ti o yatọ

Kọkọ ṣẹda olumulo verdaccio naa:

$ sudo adduser --system --gecos 'Verdaccio NPM mirror' --group --home /var/lib/verdaccio verdaccio

Tabi, toba sẹlẹ pe o ko ni adduser:

$ sudo useradd --system --comment 'Verdaccio NPM mirror' --create-home --home-dir /var/lib/verdaccio --shell /sbin/nologin verdaccio

O ṣẹda ikarahun gẹgẹbi olumulo verdaccio nipa lilo aṣẹ wọnyi:

$ sudo su -s /bin/bash verdaccio
$ cd

The cd command sends you to the home directory of the Verdaccio user. Make sure you run Verdaccio at least once to generate the config file. Edit it according to your needs.

Gbigbọ lori gbogbo awọn adirẹsi

Ti o ba fẹ lati tẹtisi gbogbo adirẹsi itagbangba ṣeto ilana igbọran ninu iṣeto naa lati:

# o le se adirẹsi itẹtisi ni pato (tabi ibudo kan nìkan)
gbọ: 0.0.0.0:4873

Ti o ba n mu verdaccio ṣiṣẹ ninu Ilana Amazon EC2 kan, o ma nilo lati ṣeto itẹtisi naa ni aaye ayipada faili iṣeto rẹ bi a ti salaye loke.

Configure Apache or nginx? Please check out the Reverse Proxy Setup

Mimu verdaccio ṣiṣẹ titilailai

O le lo akopọ oju ipade ti a n pe ni 'forever' lati mu ki verdaccio ma ṣiṣẹ ni gbogbo igba.

Kọkọ fi forever sori ẹrọ kaakiri agbaye:

$ sudo npm install -g forever

Make sure you've run Verdaccio at least once to generate the config file and write down the created admin user. You can then use the following command to start Verdaccio:

$ forever start `which verdaccio`

O le ṣayẹwo awọn iwe akọsilẹ fun alaye diẹ sii lori bi o ṣe le lo forever.

Olupese ti o ye ti n bẹrẹ lẹẹkansi

O le lo crontab ati forever papọ lati bẹrẹ verdaccio lẹhin atunbẹrẹ olupese. Nigba ti o ba wọle gẹgẹbi olumulo verdaccio naa ṣe awọn wọnyii:

Eyi le beere lọwọ rẹ lati yan olusatunkọ kan. Mu ayanfẹ rẹ ki o si tẹsiwaju. Se afikun awọn atẹwọle wọnyii si faili naa:

$ crontab -e

This might ask you to choose an editor. Pick your favorite and proceed. Add the following entry to the file:

@reboot /usr/bin/forever start /usr/lib/node_modules/verdaccio/bin/verdaccio

The locations may vary depending on your server setup. If you want to know where your files are you can use the 'which' command:

$ which forever
$ which verdaccio

Using systemd

Instead of forever you can use systemd for starting Verdaccio and keeping it running. Verdaccio installation has systemd unit, you only need to copy it:

$ sudo cp /usr/lib/node_modules/verdaccio/systemd/verdaccio.service /lib/systemd/system/ && sudo systemctl daemon-reload

This unit assumes you have configuration in /etc/verdaccio/config.yaml and store data in /var/lib/verdaccio, so either move your files to those locations or edit the unit.