Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
Install NPM packages from http or https:
npm config set registry https://registry.npmjs.org/

Sometimes because of filtering issues you need to download node packages from http so make sure to make it http:
npm config set registry http://registry.npmjs.org/

#node #npm #shit #installation #config
Preventing installation of devDependencies node modules:

npm install in the package directory installs the dependencies in the local node_modules folder.

In global mode (ie, with -g or --global appended to the command), it installs the current package context (ie, the current working directory) as a global package.

By default, npm install will install all modules listed as dependencies in package.json.

With the --production flag (or when the NODE_ENV environment variable is set to production`), `npm will not install modules listed in devDependencies.

#node #npm #package_json #devDependencies #NODE_ENV
In docker swarm mode you can list nodes with docker node ls. If you want to assign a label to each node you can use the below command to update node labels. For example you can assign a key=value pair like role=storage to one of your node listed with the first command:

docker node update --label-add role=storage YOUR_HOSTNAME

Read more here:
- https://docs.docker.com/engine/swarm/manage-nodes/#update-a-node

The great thing about this labeling is in docker compose file that you can tell docker which server should get deployed on which server (node):

deploy:
replicas: 4
placement:
constraints:
- node.labels.role == storage

NOTE: role is something that we ourselves have been defined. You can define your own as requirements vary.


#docker #node #swarm #label #role