mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-03-25 02:32:52 -05:00
commit
fbb98b1101
2 changed files with 79 additions and 8 deletions
13
README.md
13
README.md
|
@ -47,6 +47,19 @@ $ npm set ca null
|
|||
|
||||
When you start a server, it auto-creates a config file that adds one user (password is printed to stdout only once).
|
||||
|
||||
## Adding a new user
|
||||
|
||||
There is no utility to add a new user but you can at least use node on the command-line to generate a password. You will need to edit the config and add the user manually.
|
||||
|
||||
Start node and enter the following code replacing 'newpass' with the password you want to get the hash for.
|
||||
```bash
|
||||
$ node
|
||||
> crypto.createHash('sha1').update('newpass').digest('hex')
|
||||
'6c55803d6f1d7a177a0db3eb4b343b0d50f9c111'
|
||||
> [CTRL-D]
|
||||
```
|
||||
|
||||
|
||||
## Using private packages
|
||||
|
||||
You can add users and manage which users can access which packages.
|
||||
|
|
58
SERVER.md
Normal file
58
SERVER.md
Normal file
|
@ -0,0 +1,58 @@
|
|||
This is mostly basic linux server configuration stuff but I felt it important to document and share the steps I took to get sinopia running permanently on my server. You will need root (or sudo) permissions for the following.
|
||||
|
||||
## Running as a separate user
|
||||
First create the sinopia user:
|
||||
```bash
|
||||
$ sudo adduser --disabled-login --gecos 'Sinopia NPM mirror' sinopia
|
||||
```
|
||||
|
||||
You create a shell as the sinopia user using the following command:
|
||||
```bash
|
||||
$ sudo su sinopia
|
||||
$ cd ~
|
||||
```
|
||||
|
||||
The 'cd ~' command send you to the home directory of the sinopia user. Make sure you run sinopia at least once to generate the config file. Edit it according to your needs.
|
||||
|
||||
## Listening on all addresses
|
||||
If you want to listen to every external address set the listen directive in the config to:
|
||||
```
|
||||
# you can specify listen address (or simply a port)
|
||||
listen: 0.0.0.0:4873
|
||||
```
|
||||
|
||||
## Keeping sinopia running forever
|
||||
We can use the node package called 'forever' to keep sinopia running all the time.
|
||||
https://github.com/nodejitsu/forever
|
||||
|
||||
First install forever globally:
|
||||
```bash
|
||||
$ sudo npm install -g forever
|
||||
```
|
||||
|
||||
Make sure you've started sinopia at least once to generate the config file and write down the created admin user. You can then use the following command to start sinopia:
|
||||
```bash
|
||||
$ forever start `which sinopia`
|
||||
```
|
||||
|
||||
You can check the documentation for more information on how to use forever.
|
||||
|
||||
## Surviving server restarts
|
||||
We can use crontab and forever together to restart sinopia after a server reboot.
|
||||
When you're logged in as the sinopia user do the following:
|
||||
|
||||
```bash
|
||||
$ 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/sinopia/bin/sinopia
|
||||
```
|
||||
|
||||
The locations may vary depending on your server setup. If you want to know where your files are you can use the 'which' command:
|
||||
```bash
|
||||
$ which forever
|
||||
$ which sinopia
|
||||
```
|
Loading…
Add table
Reference in a new issue