Skip to content

Instantly share code, notes, and snippets.

@AlexZeitler
Last active March 21, 2018 13:22
Show Gist options
  • Save AlexZeitler/7759244264ed01eb3dfb to your computer and use it in GitHub Desktop.
Save AlexZeitler/7759244264ed01eb3dfb to your computer and use it in GitHub Desktop.
DigitalOcean snippets
sudo apt-get update
sudo apt-get install nginx
#default website
locale-gen en_US.UTF-8
echo LC_ALL=en_US.UTF-8 >> /etc/enviroment
echo LANG=en_US.UTF-8 >> /etc/environment
locale-gen
sudo apt-get update
sudo apt-get install git
echo . ~/.nvm/nvm.sh >> ~/.bashrc
. ~/.bashrc
nvm install 0.12.7
# install Node.js as described in nodeondigitalocean.sh
# install nginx as described in nginxondigitalcoean.sh
npm install -g sinopia
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
add your user from your local npm:
npm adduser --registry http://<publicip>
change the config.yml on your sinopia 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
access the registry on your local machine:
npm set registry <publicip>
npm login
npm install something
npm publish something
Make your registry run forever:
npm install -g pm2
pm2 startup ubuntu
which sinopia
/root/.nvm/versions/node/v0.12.7/bin/sinopia
pm2 start /root/.nvm/versions/node/v0.12.7/bin/sinopia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment