why can't i run meteor in root mode? - linux

I am installing meteor by shell script in root mode. When I try to build app it is prompting
*You are attempting to run Meteor as the "root" user. If you are developing, this is almost certainly not what you want to do and will likely result in incorrect file
permissions. However, if you are running this in a build process (CI, etc.) or you are absolutely sure you know what you are doing, add the --unsafe-perm flag to
this command to proceed.*
I am running other things with shell script which needs root mode. Any help appreciated

You are attempting to run Meteor as the "root" user.
If you are developing, this is almost certainly not what you want to do and will likely result in incorrect file permissions.
However, if you are running this in a build process (CI, etc.) or you are absolutely sure you know what you are doing, add the
--unsafe-perm
flag to this command to proceed.

Related

ALWAYS RUN VSCODE AS ROOT

Currently, I'm running vscode from the terminal with the following command:
sudo code --user-data-dir="~/.vscode-root"
(I'm using POP OS) However, how can I perhaps add it to PATH, so instead of the command above, I can issue the following command:
vscode
In order to always run it as root?
You can edit your 'visudo' file and add the full path to the application:
<YOURUSERID> ALL = NOPASSWD:<FULLPATHTOVSCODE>
But this is really a great way to do something bad. Sudo should be used rarely and if you are using it frequently there is a better way to do what you are doing.

Autostart a node.js script using init.d in Debian

I have a little node application on a server (node mailer) that I run by going to its source folder and executing npm start. I figured the best way to run this automatically would be to create a my_script.sh file and drop it in the init.d directory of my debian box. Inside the file (below the !#/bin/bash line), the code to execute is
'/opt/mycode/source/npm start'
I save the line to the .sh file and restarted the machine, but so far haven't got it to work. My question is: is this even how you start a script like this (using that command and an .sh file)? It does start normally when I do it manually (when I navigate to it and run npm start in the terminal). I included the single quotes around it because of the space between npm start. Also, if I want to verify that it worked, which process would I look for other than just pinging my smtp mailer? Finally, I know I need to run:
update-rc.d my_script.sh defaults
but I was also confused at to whether I had done this correctly either (is it just the name of the file that goes there or the file plus the extension)?
The script that you leave on the init.d folder should not have any extension and should have functions to start, stop and get the status of the service (your application).
I'll leave a link with an example as well as with some basis in order to build the Linux service script.
I would suggest reloading the daemon with systemctl daemon-reload in order to refresh the Linux service files once you add a new one.

Can't run Chef as root

I've recently returned to Linux after a 2-year hiatus. I'm trying to
learn Chef in order to automate some application deployments. In the Chef tutorial, it states that sudo is required to run a command that installs a package, which makes sense.
webserver.rb
package 'httpd'
shell command
sudo chef-apply webserver.rb
Tutorial excerpt:
sudo is required because this command installs a package and therefore must be run with root privileges. If you're running as root on your own machine, you can omit sudo from the command.
I googled the issue I was having and found a "solution" that didn't work, along with an SO question that stated you shouldn't run Chef as root. I'm not sure if I buy it.
First of all, chef is not intended to be run as root. A lot of resources assume they're run as root, and need it. They will fail if not running as root.
He also states that you should use sudo, which conflicts with his previous statement.
use sudo to run chef client with a test user (need an entry in sudoers file)
I think that he meant to say that you shouldn't run Chef as root 100% of the time. I am failing to run Chef as root, which seems to be the opposite of what the OP was trying to solve.
The error I am getting
/opt/rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'chef' (>= 0) among 13 total gem(s) (Gem::LoadError)
from /opt/rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:309:in `to_spec'
from /opt/rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:53:in `gem'
from /opt/rvm/gems/ruby-2.1.5/bin/chef-apply:22:in `<main>'
from /opt/rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
from /opt/rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
If the tutorial says that you CAN run Chef as root, and root is required to execute certain recipes, then I would think that Chef should run as root in certain cases.
My biggest question is how do I fix this error and run Chef as root? It runs fine as any other user, but fails when I try to sudo.
Well rvm reset worked after all.
So the "solution" post that I mocked earlier was actually the solution I was looking for. Karma.
DO NOT INSTALL CHEF BY GEM. (plenty of good reason too long to explain, but trust me, use omnibus package)
What happened here is that your rvm has override the path search order and the ruby call, thus the chef launcher was searching in the rvm path and not in the embedded ruby chef path. Calling rvm reset fix the problem by removing the override/path addition.
For the 'to be or not to be root' part, my answer on the question you linked had a typo. The not was forget after a rewording, (the remaining of the sentence made clear root is needed I hope). Thanks for the head up anyway.
Chef is mean to be run as root, but it's highly discouraged to connect remotely to a machine as root.
So you should use sudo to launch chef-client with root permissions 100% of time. Chef will fail on some operations if run as a normal user as it is intended to manage a whole system.
Note: I say 'should' and not 'must' as someone can probably find an edge case where it's advisable to run chef in a limited environment, but I really think it's an edge case and maybe chef is not the correct tool in this case.

NodeJS installation to jenkins : npm not found

Maybe someone can tell me what I missed installing nodeJS to jenkins, because when I want to execute shell script npm update I get error npm: not found.
I installed jenkins nodejs plugin then added installer:
After I created job with prams:
What I need to do more, to have accessible npm in any jenkins job?
It works for me. The only difference is that where you have a text box that reads "0.12.7", I have a popup menu that reads "Node.js 0.12.7". Maybe something has gone wrong and you should delete the installer and add it back?
Windows users, did you restart?
Do keep in mind that you need to restart active processes after installing npm.
During installation the folder of your npm.cmd is added to the PATH variable. However, active applications don't refresh their PATH variable automatically. That also holds for your active Jenkins service (and its child processes). They are still running with an old version of your PATH variable.
In other words, you need to restart the Jenkins service (or restart your entire system). Once restarted, Jenkins will have an updated PATH variable, and it will be able to find the npm.cmd processes and others.
What's wrong with using absolute paths?
Using the full path is not a solid solution. A package.json file can contain references to other cli processes (e.g. node, ng, react-scripts, npm-run-all, ...). You will probably have similar issues there. There is no way to keep up and reference all of them with full paths.

how to run npm/grunt command from jenkins

I'm new to this area and was trying to run the following commands from jenkins:
npm install
grunt quickStart
So far I've a jenkins running on a window machine as a window service and I've also installed NodeJs plugin for jenkins.
However, I'm stuck and quit confused following instructions here, its asking me to to add one or mode nodeJs installation and I could not find those setting and not even sure if I even need them in the first place.
Here is the bit that's asking me to do:
I cannot see this setting for the jenkins job I create. Is there an easy way to run those command in jenkins from a .bat or .sh script, a .bat would be recomended since I'm on window machine.
Note : I've already checked out a project using git in jenkins!!!
Thanks
"its asking me to to add one or mode nodeJs installation and I could not find those setting and not even sure if I even need them in the first place."
I don't think you need that I have pointed jenkins to the node installation folder an nothing more.., for this you go to Manage Jenkins->Configure System->NodeJS->NodeJS installations.. type in any name you like and point to where the node home folder is.
...cannot see this setting for the jenkins job I create...
Once you have configure that in your jenkins configuration you should have that configuration available like so:
...Is there an easy way to run those command in jenkins from a .bat or .sh script, a .bat would be recomended since I'm on window machine
I'm sorry don't get what commands are you referring to...
so summarizing :
you have to tell jenkins where you have your node installation
use that configuration in your jobs
hope this helps...
The way I made it, was trough execute shell, as the build tool for nodejs is npm, I simply wrote a shell script that instructs jenkins to run npm install in the workspace directory inside jenkins where it clones the git repository and then to zip and move the package if successful to another folder.

Resources