-
-
Save sadikaya/d02e009014a29696413f2bebb78f2723 to your computer and use it in GitHub Desktop.
DigitalOcean snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update | |
sudo apt-get install nginx | |
# default website |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update | |
sudo apt-get install build-essential libssl-dev | |
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh -o install_nvm.sh | |
bash install_nvm.sh | |
source ~/.profile | |
nvm ls-remote | |
nvm install [version] | |
nvm use [version] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install nginx as described in nginx-on-digitalocean.sh | |
# install Node.js as described in node-on-digitalocean.sh | |
npm install -g verdaccio | |
-- | |
replace /etc/nginx/sites-available/default with this content | |
-- | |
server { | |
listen 80; | |
server_name example.com; | |
location / { | |
proxy_pass http://localhost:4873; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; | |
proxy_set_header Host $host; | |
proxy_cache_bypass $http_upgrade; | |
} | |
} | |
-- | |
sudo service nginx restart | |
-- | |
run verdaccio to create config.yaml, exit verdaccio instance | |
-- | |
update the config.yaml on your verdaccio box | |
-- | |
disable registration for new anon users: | |
max_users: -1 | |
restrict access to everthing for authenticated users only: | |
packages: | |
'@*/*': | |
# scoped packages | |
access: $authenticated | |
publish: $authenticated | |
'*': | |
# allow all users (including non-authenticated users) to read and | |
# publish all packages | |
# | |
# you can specify usernames/groupnames (depending on your auth plugin) | |
# and three keywords: "$all", "$anonymous", "$authenticated" | |
access: $authenticated | |
# allow all known users to publish packages | |
# (anyone can register by default, remember?) | |
publish: $authenticated | |
# if package is not available locally, proxy requests to 'npmjs' registry | |
proxy: npmjs | |
'prefixed-*': | |
access: $authenticated | |
publish: $authenticated | |
-- | |
Make your registry run forever: | |
npm install -g pm2 | |
pm2 startup ubuntu | |
which verdaccio | |
/root/.nvm/versions/node/v8.10.0/bin/verdaccio | |
pm2 start /root/.nvm/versions/node/v8.10.0/bin/verdaccio | |
-- | |
add your user from your local npm: | |
npm adduser --registry http://<publicip> | |
-- | |
access the registry on your local machine: | |
npm set registry <publicip> | |
npm login | |
npm install something | |
npm publish something | |
-- | |
Enable SSL | |
sudo add-apt-repository ppa:certbot/certbot | |
sudo apt-get update | |
sudo apt-get install python-certbot-nginx | |
sudo certbot --nginx -d www.example.com | |
sudo certbot renew --dry-run (to check if autorenew works) | |
-- | |
update verdaccio config.yaml | |
https: | |
key: /etc/letsencrypt/live/www.example.com/privkey.pem | |
cert: /etc/letsencrypt/live/www.example.com/cert.pem | |
ca: /etc/letsencrypt/live/www.example.com/fullchain.pem | |
url_prefix: https://example.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment