Free Verdaccio Private Registry Setup On AWS
Verdaccio registry is a free private npm proxy registry which made in NodeJS. We can setup our private NPM application / libraries with free of cost. The benefit of this registry is privacy, only authorized persons can access this registry and can use published libraries or applications. I hope, This may help you to start learning and utilizing free Verdaccio private registry for your company, organization or individuals.
Click here for more details (https://verdaccio.org/)
In this tutorial, I will just explain you the simple steps to setup Verdaccio private registry on Amazon Web Services platform using EC2 service. I am assuming you already created EC2 Amazon Linux instance, if not then please check below tutorial first.
AWS CLI Commands For AWS EC2 (Amazon Elastic Compute Cloud) (https://tinyurl.com/y2ozksyc)
So lets start with Verdaccio private registry setup and configuration.
Step 1: Open SSH & Login in using your EC2 key.
Step 2: Install Node Version Manager (nvm) first
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
Step 3: Install Node using Node Version Manager (nvm)
>> nvm install node
Step 4: Install Verdaccio & pm2, will require to run Verdaccio service in background
>> npm i -g verdaccio pm2
Step 5: Set the verdaccio registry as a source. By default original NPM registry set.
>> npm set registry http://localhost:4873
>> npm set ca null
Step 6: Run Verdaccio and stop it. It will create a config file we will use.
>> verdaccio
Step 7: Now do below configuration for listening to all addresses on that server machine / EC2 instance.
Click here for more details: https://github.com/verdaccio/verdaccio/blob/master/conf/full.yaml
Open and edit config.yaml file:
>> nano .config/verdaccio/config.yaml
Add below lines at the end. Click here for more details. https://github.com/verdaccio/verdaccio/blob/ff409ab7c05542a152100e3bc39cfadb36a8a080/conf/full.yaml#L113
listen:
- 0.0.0.0:4873
Change below line so that only authenticated person can access our registry
Replace "access: $all" with "access: $authenticated"
There are some more parameters available to configure it. Like storage, proxy, default port change. Click here for more details. https://github.com/verdaccio/verdaccio/blob/ff409ab7c05542a152100e3bc39cfadb36a8a080/conf/full.yaml#L113
Step 8:Run Verdaccio in background using PM2:
pm2 start verdaccio
Step 9: Now, You can access your Verdaccio web UI.
The URL will look like something:
http://ec2-
{or}
http://your-ec2-public-ip-address:4873 (You can check your EC2 instance public ip from AWS console)
To confirm verdaccio running status, run the command below
>> pm2 list
Step 10: Registering a user in verdaccio registry
>> npm set always-auth true
>> npm adduser
It will ask for username, password and valid email id to be entered. Make a note of this details that will use later to login in verdaccio registry to publish our library.
Step 11: Now we are ready to use our AWS server instance work as a private registry.
Login into verdaccio registry. Enter the same username, password and email id set in above Step.
>> npm set registry http://your-ec2-public-ip-address:4873
>> npm login
Step 12: Go to your custom library package path. In my case this is my Angular 7 package path -> /libraries/dist/your-library-name/your-library-name-0.0.1.tgz
If you like to know how to create angular 7 library/package then click here (link)
>> cd [custom library package path]
Step 9: Finally publish our library your-library-name-0.0.1.tgz on verdaccio registry
[custom library package path] >> npm publish your-library-name-0.0.1.tgz
{or}
[custom library package path] >> npm publish
{or}
[custom library package path] >> npm publish --registry http://your-ec2-public-ip-address:4873
Now browse http://your-ec2-public-ip-address:4873 and you will see new our library package there.
Conclusion:
That's It Guys! I loved to share my knowledge with you whatever I experienced while learning. If you have any opinions or suggestion related to this tutorial, Please feel free to comment and share your suggestions.
Check Recommended Articles:
How to create your first angular 7 library
How To Publish Angular 7 Library To Verdaccio Private Registry On Localhost
How To Uninstall Verdaccio From Angular 7 Workspace
Free Verdaccio Private Registry Setup On AWS
Reviewed by Web Technology Funda
on
7:17:00 AM
Rating:
No comments