che.openshift.io - Run the terminal as SUDO - eclipse-che

I am using the che.openshift.io - Eclipse Che from Red Hat. I have a workspace of PHP Laravel Stack. When I try to run commands as SUDO from the php terminal I am getting error.
SUDO - not a command /
SU - must be run from a terminal
Can someone help me to run as root user? I have to install the heroku CLI from the terminal which can be done only via root user.

In general, containers running as root is a significant security risk + containers are supposed to be immutable and installing anything inside the container is not recommended since after the restart all the packages will vanish.
Eclipse Che workspaces on che.openshift.io are running against Red Hat OpenShift Online clusters which do not support sudo and workspace containers are running using the Arbitrary User IDs (This provides additional security against processes escaping the container due to a container engine vulnerability and thereby achieving escalated permissions on the host node). So, Basically you can not execute sudo from the workspace terminal.
I have to install the heroku CLI from the terminal which can be done only via root user.
In order to support the Heroku CLI from the terminal you have 2 options:
Create your own custom php image with the Heroku CLI installed based on the default php image used in Eclipse Che - https://github.com/eclipse/che-dockerfiles/blob/master/recipes/php/7.1/Dockerfile (and then refer to this image from the custom devfile that will feet your needs)
Eclipse Che support vscode extensions and you can contribute support of the heroku-cli to the che-plugin-registry
Hope this helps.

Related

VSCode Create Dev Container - docker not found (worked before)

I seem to be unable to create any new dev containers on WSL2 Ubuntu (worked fine before) and I don't know how to debug this.
Environment
Windows 11
WSL2 with Ubuntu distribution
VSCode 1.75.1
Extension: Dev Containers 0.275.1 or 0.279.0 (no difference observed)
Extension: WSL 0.75.3
Docker on Windows: none
Docker on WSL Ubuntu: 20.10.22
Scenario
Open WSL2 Ubuntu terminal
Go to desired development folder
Start
code .
VSCode shows on Windows (Mentioning remote host "WSL:Ubuntu")
Command: Dev Containers: Create dev container (e.g. Python container)
Error shows:
Docker returned an error. Make sure the Docker daemon is running and select an option how to proceed.
Log shows:
Start: Run: docker version --format {{.Server.APIVersion}} [883 ms] findLocalWindowsExecutable: Exectuable 'docker' not found on PATH 'C:\Windows\system32;(...)'. [885 ms] Exectuable 'docker' not found on PATH 'C:\Windows\system32;(...)'. [890 ms] Docker returned an error code ENOENT, message: Exectuable 'docker' not found on PATH 'C:\Windows\system32;(...)'.
Already tried
Previous creation of such dev containers on this environment worked fine.
Executing the old dev containers on the current environment still works fine.
Question
I don't know where to get started to debug this. Probably something changed in my environment causing the creation of dev containers to fail, but I have no clue. I can't really reconstruct what would have changed to the setup.
I didn't expect devcontainers to go and look for docker on my Windows path... I read about docker cli being used under the hood, but I never had docker on this Windows system, so it mustn't be essential in the WSL2 setup since it worked before.
Thanks,
Johan

Launch Mongodb in AWS envirement after installation

During 3 days I have been trying to install mongo BD in AWS ec2 instance, today finally managed to install it in Ubuntu, now I can't launch it in AWS environment, after numerous attempts to check the status in aws environment terminal I get errors:
What I have already tried do:
installed mongodb on Ubuntu 16.04 (Xenial)
launch mongo as a service (Ubuntu)
sudo service mongod start
sudo service mongod status
Go to AWS environment and do attempts to check if I'm connected to DB, and get errors:
sudo: mongod: command not found
mongod: unrecognized service
sudo: apt-get: command not found
bash: mongo: command not found
Please help to set my environment
I am pretty sure that Шоира is dealing not with Ubuntu OS but Amazon Linux or so.
So, if she is dealing with Community Edition version of it, the actual docs for every *nix based OS can be found here (MongoDB Docs)
And if I remember this fact correctly, AWS instances comes with Amazon Linux by default, so the documentation guide should been read for Amazon Linux (here), not Ubuntu.
To ensure that she is using Amazon Linus, she must type command grep ^NAME /etc/*release in terminal. If so, the reply should be: Amazon Linux or Amazon Linux AMI
Also, I don't know does it matter or not, but MongoDB Atlas provides also free-tier (as EC2 instance) servers in (almost) every data centers from GCP / Azure / AWS, so sometimes it's better to dealing with Cloud Service (which includes Compass and Realms by default, out of the box) instead of using the Community edition of the -raw DB, and write code and https API for it, later.
I tried to recreate the issue on an EC2 instance with Ubuntu 16.04:
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
I followed the instructions from your link:
Install MongoDB Community Edition on Ubuntu
I had no issues and was able to install mangoDB as described in the link. The mongoDB is working fine on my instance:
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: active (running) since Sun 2020-07-19 08:21:41 UTC; 8s ago
Docs: https://docs.mongodb.org/manual
Main PID: 3214 (mongod)
Tasks: 24
Memory: 69.6M
CPU: 746ms
CGroup: /system.slice/mongod.service
└─3214 /usr/bin/mongod --config /etc/mongod.conf
Thus, please double check and ensure that you follow the instructions from the link. The instructions are correct.
Also please make sure to use Ubuntu 16.04:
This means that, you are trying to connect to the mongod process running on the local host which is binded on the default port of 27017

Can't find dev_appserver.py with gcloud installation

I've installed gcloud by following the instructions on:
https://cloud.google.com/sdk/docs/quickstart-debian-ubuntu
gcloud is in my path at /usr/bin/gcloud, but the package doesn't seem to have dev_appserver.py in my path. Is it installed? How do I run it?
Platform: Ubuntu 16.04
Edit: By running dpkg -L google-cloud-sdk I've found it at /usr/lib/google-cloud-sdk/bin/dev_appserver.py but when I try to run it I get:
This action requires the installation of components: [app-engine-
python]
You cannot perform this action because this Cloud SDK installation is
managed by an external package manager. If you would like to get the
Also not sure why it wasn't added to my path.
I know the original question concerns Ubuntu, but I just wanted to share some notes for macOS/OS X in case it's helpful for someone else.
I installed the google-cloud-sdk via Homebrew-Cask and overlooked the caveats note:
brew cask install google-cloud-sdk
After installing the SDK cask, I installed the Python App Engine component, as #Rodney Jonace mentioned:
gcloud components install -q app-engine-python
Going back to the caveats note mentioned above, I appended the following the my ~/.zshrc file:
source $(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc
source $(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc
Opening a new terminal tab, I was able to call the extra Python App Engine scripts (e.g., dev_appserver.py) and use the Zsh completions. Hope that helps!
The following articles were also useful:
http://www.javatronic.fr/tips/2014/10/17/installing_google_cloud_sdk_on_ubuntu_with_oh-my-zsh.html
http://www.rainbowbreeze.it/how-to-setup-a-google-app-engine-python-environment-on-mac-osx-using-homebrew/
The google-cloud-sdk deb package comes with the built-in component manager disabled, which is preventing that copy of dev_appserver.py from working through gcloud. If you update your apt-cache, you can install the google-cloud-sdk-app-engine-python and/or google-cloud-sdk-app-engine-java packages that have just started to be published. Directions here:
https://cloud.google.com/sdk/downloads#apt-get

DC/OS installation failure during preflight

I am using 5 cloud-based VMs to install DC/OS
1 mesos master
3 mesos agent
1 launching VM
I have installed Docker on my launching VM and start installing DC/OS. It is running successfully during install_prereqs stage without any errors. But it's failing during preflight with below errors for each of my VM system.
STDERR:
Connection to 129.114.18.235 closed.
STDOUT:
Running preflight checks /opt/dcos_install_tmp/dcos_install.sh: line 225: getenforce: command not found
Checking if docker is installed and in PATH: FAIL
Checking if unzip is installed and in PATH: FAIL
Checking if ipset is installed and in PATH: FAIL
Checking if systemd-notify is installed and in PATH: FAIL
/opt/dcos_install_tmp/dcos_install.sh: line 387: systemctl: command not found
Checking if systemctl is installed and in PATH: FAIL
Checking Docker is configured with a production storage driver: /opt/dcos_install_tmp/dcos_install.sh: line 285: docker: command not found
Do I need to install all the required software into my master and agents VMS? Please guide.
We have a similar setup but using straight vm's. We found docker needs to be running on all nodes, including masters, before running the install. Also, make sure you look at: /etc/sysconfig/docker-storageand have: DOCKER_STORAGE_OPTIONS= -s overlayset in the file on all nodes.
I don't believe this is the production setup but should get you running. You also may want to check the privilege of the user executing the install on the remote nodes, does it have permission to see/run systemctl?
I had the same error with the DC/OS web installer in version 1.9
I solved the error after double-checking the bootstraps machines's private key in the web form. To create the key, log into the bootstrap machine and run:
$ ssh-keygen -t rsa
$ for i in `cat dcos-ips.txt`; do ssh-copy-id root#$i; done
$ cat ~/.ssh/id_rsa

What are dronekit-python dependencies?

The dronekit Getting Started page suggests installing WinPython to use dronekit-Python on Windows because it includes the dependencies. I already have a working Python installation and I prefer not to risk messing it up with WinPython. What are the dependencies I need to install?
As of DKPY 2.0 this is outdated. Also, I might move to making a MavProxy module depending on whether or not the unpaid devs decide to stay when 3DR stops funding Dronekit
I've written a procedure to help with this problem which I've pasted. 3DR claims they're going to fix it, but in the mean time I hope this will help.
This setup is for Windows 64-bit systems only, although similar procedures will work with 32-bit.
Install MAVProxy and run it once before reaching step 5.
Install Notepad++.
Install Python v2.7.
Inside the Python folder, run WinPython Control Panel and select Advanced->Register Python.
Inside the same folder, run WinPython Command Prompt and input the following four commands:
• pip uninstall python-dateutil
• pip install droneapi
• pip install console
• echo module load droneapi.module.api >> %HOMEPATH%\AppData\Local\MAVProxy\mavinit.scr
Install WX Python. It should be the 64-bit Python 2.7 version.
Download and install OpenCV 2.4.11 to any folder
• Copy/paste the file cv2.pyd from OpenCV\build\python\2.7\x64\ to \python-2.7.6.amd64\Lib\site-packages.
Steps 8 through 11 apply to SITL only
Follow the online documentation for setting up Cygwin for SITL in Windows
Go to C:\cygwin\home\Your Username\ardupilot\Tools\autotest\
Open sim_vehicle.sh in Notepad++
• Change line 429 from…
cygstart -w "/cygdrive/c/Program Files (x86)/MAVProxy/mavproxy.exe" $options --cmd="$extra_cmd" $*
to...
cygstart -w "/cygdrive/c/Users/YOUR USERNAME HERE/Desktop/WinPython-64bit-2.7.6.4/python-2.7.6.amd64/Dronekit/Scripts/mavproxy.py" $options --cmd="$extra_cmd" $*
Note: This location changes depending on where you installed WinPython. For me, it was the desktop.
Start simulations as you would normally for SITL. To run Python scripts during the simulations, use the command
• api start Path to script\script_name
To use the code to connect to an actual copter, open WinPython Command Prompt
• Navigate to the folder which contains the scripts you wish to test
• Type mavproxy.py --master=”com##”,57600
• Run your script by typing into the MAVProxy terminal
o api start script_name

Resources