How to use CHE_EXTRA_VOLUME_MOUNT? - eclipse-che

Use Case
The code that I wish to edit in che is downloaded from a private SVN repository and uses a private nexus repository for maven dependencies. Due to this I need to use my custom settings.xml from "C:\Users\.m2".
It would be good to use the local maven repository too, hence the approach of creating a custom dockerfile that adds settings.xml was not used.
Setup
I created a user environment variable "CHE_EXTRA_VOLUME_MOUNT" with the value "~/.m2:/home/user/.m2".
I can see the env variable from "Docker Quickstart Terminal".
Environment
OS: Windows 7
Docker version: 1.12.6, build 78d1802
Docker image: eclipse/che-server:5.0.0
Problem
Can't see the mount path "/home/user/.m2" in any workspace.
Can someone please help me with this use case?

I see a couple issues. First, in the che.env file, you should be modifying CHE_WORKSPACE_VOLUME. The CHE_EXTRA_VOLUME_MOUNT is an older name that applied to the 4.x releases.
Second, the mount path you are using. The value that you provided on the mount path is likely not going to work well if it's on Windows 7. This is because you are using Boot2Docker on that system, and so VirtualBox limits files that can be mounted to those that exist as a subfolder of %userprofile%.
So:
1. First make sure that c:\Users\.m2 is part of this subfolder, and then:
2. Use the absolute path to your .m2 folder in the mount in the che.env:
CHE_WORKSPACE_VOLUME=/C/Users/<user_name>/.m2:/home/user/.m2
This funky path naming for volume mounts is a limitation in how the Docker client can understand volume mounts if you are using it on the batch shell.
A matching answer is posted on Che's support site - https://github.com/eclipse/che/issues/3888

Looks like it is a bug in eclipse che. You can create an issue at https://github.com/eclipse/che/issues

Related

FileNotFoundError: [Errno 2] No such file or directory selenium\\webdriver\\remote\\getAttribute.js'

I'm working with selenium. The script is in :
C:\Users\User\Desktop\Data Analytics Arg\Proyectos\datademia\Py_install\py_ejemplo.py . Venv is activated and chromedriver.exe is in C:\Users\User\Desktop\Data Analytics Arg\Proyectos\datademia\Py_install\chromedriver.exe
The script runs perfectly. Then I created an only .exe-file via terminal :
pyinstaller --add-data "chromedriver.exe;." --windowed --onefile py_ejemplo.py
Folders are created correctly (build and dist). The .exe file (py_ejemplo.exe) was created, but when I try to run it, I get this message:
I've been looking and still can't solve it... I've tried these solutions :
filenotfound
but didn't work for me...Could someone help me? I don´t know what's wrong...
Thanks in advance
I got the same problem but I was working with Firefox and geckodriver.
In my case, I copied the selenium folder from the virtual environment to the dist folder and it worked.
There are a few things you should ensure when packing a script with pyinstaller build with selenium web driver.
It may require to add driver executable when building. I.e. chromedriver.exe
It may also require to add some package files related to selenium such as getattributes.js file when building. It was required at my project.
pyinstaller will extract those files to temp folder in AppData for windows users. So in your code, your relative paths may require to be resolved with a sample function as below (if you are running your code in vs code or you are running through pyinstaller executable the paths should be resolved by function).
For item 1 and 2, you can use --add-binary and --add-data features of pyinstaller for each of them. It is also possible to do this in *.spec file with add-files list, following your first running of pyinstaller (see this explanation) I preferred command-line option as below.
pyinstaller ./app.py --onefile --noconsole --add-binary "./driver/chromedriver.exe;./driver" --add-data "C:\Users\YOUR_USER_NAME\.conda\pkgs\selenium-3.141.0-py38h2bbff1b_1000\Lib\site-packages\selenium\webdriver\remote;selenium\webdriver\remote"
For item 3, to resolve relative paths in your source code, you can use below function in related places (for example when accessing chromedriver.exe)
def resource_path(relative_path):
try:
base_path = sys._MEIPASS
except Exception:
base_path = os.path.dirname(__file__)
return os.path.join(base_path, relative_path)
Use above function once you need to access packaged executables and files in your source code. In below example, my chromedriver is inside driver folder in my workspace. But when it is accessed through pyinstaller executable, it will be extracted to temp folder in AppData, yet function will access it through sys._MEIPASS variable set by pyinstaller.
driver = webdriver.Chrome(executable_path = resource_path('./driver/chromedriver.exe'))
Hope it works.

Set up kenlm for Windows

The official website makes it pretty clear that there is no support for kenlm in Windows. There is a Windows tag at the github repository but it seems to be maintained by few random contributors then and there.
How to set up kenlm for Windows then?
The new DeepSpeech PlayBook also includes instructions for setting up a Docker image and running training from within a Docker container. If you have Docker on Windows, this might be another solution.
The information for building a new Scorer is still in a PR, but may also be useful.
The solution is to use Ubuntu in Windows through Windows Subsystem for Linux
Get WSL for Windows
From your ubuntu bash navigate to the folder where you want to do the setup. You can access the Windows file system from the /mnt/c/ folder, which you can find at the root directory.
From there simply follow the official instructions, that is clone the git repo, and run cmake .. & make -j2 in order to build the project (after first making the necessary installations in your Ubuntu system).
Obviously, you must train the models or scorers using the Linux bash. You can also use these models from Windows using the kenlm python library.
E.g.
The two steps to build a scorer for the deepspeech-model as described here should be executed from your Ubuntu system. But after you have the scorer you should be able to run the command
deepspeech --model deepspeech-0.9.3-models.pbmm --scorer kenlm.scorer --audio audio.wav
from Windows. However, once you have WSL there's no need to do this work from Windows. Things will work nicely #your Ubuntu system.
I've faced the same problem and solved it by building kenlm wheel from Cygwin terminal as home page advices (pip wheel pypi-kenlm).
I've also uploaded wheel to pypi called kenlm-cygwin, but it's only python3.7.

Docker File No such file or directory - Absolute Path issue

Writing because I have a stranger problem with Docker File process
The problem is regarding Docker File Context. As far as I understood the directory context that I can access from Dockerfiles is one directory up and one directory down
Example Directory Tree
A - B - C - D - E
If my docketfile is on C
I can access B D
But I can’t access A E
I have a problem because this is my case
My Docker file is on C
And I need to access files from B D E
And I really don’t know how to do it
I need to access it
Becaiuse my target jar is on E
And I need to do an ADD to this file to implementing docket hot deploy with Spring Dev Tools
Somenthing like on Docker
ADD .\D\E\jar.file jar.file
ENtrypoint xxx
Expose xxx
And I still need to access B to get some other files.
Was Clear?
Sorry I know is strange
If you can do something it does not mean it is right or if is something not recommended so it means the issue can arise.
If you read General guidelines and recommendations, It will recommend keeping the thing in context, then why you need to copy thing from the different drive? Btw it is not possible in Linux as docker need to copy from the context so better to keep your jar file in dockerfile context.
Understand build context
When you issue a docker build command, the current working directory
is called the build context. By default, the Dockerfile is assumed to
be located here, but you can specify a different location with the
file flag (-f). Regardless of where the Dockerfile actually lives, all
recursive contents of files and directories in the current directory
are sent to the Docker daemon as the build context.

How do I run dev_appserver.py from within my feature file in behave python?

dev_appserver.py starts a local deployement of my appengine service. I want to run my tests on behave on this local service. I want to start the server within my tests first. How to run the dev_appsrrver.py app.yaml command in my behave feature file in the start ?
I have tried subprocess.run("python","dev_appserver.py") but it says couldnt find the file dev_appserver.py. I'm trying on windows.
When you're attempting to launch executables using subprocess methods typically you're not getting by default the same environment (execution path and current working directory) you're getting yourself in a shell/terminal. Which means you may need to reference files (both executables and regular files) using full paths in the list of arguments you pass to those methods.
Since the subprocess.run() execution complaints about the dev_appserver.py location it means it's finding python OK (you may still want to check that's it's the 2.7 version) and you need to provide the full path for dev_appserver.py, which depends on your OS and the SDK you use. On Linux, for example (sorry, I'm not a windows guy), the path is:
<GAE_SDK_dir>/dev_appserver.py if using the GAE SDK
<gcloud_SDK_dir>/bin/dev_appserver.py if using the gcloud SDK
You'll most likely need to pass the path to your GAE app's app.yaml file, too - as an argument to dev_appserver.py, otherwise you'll see it complain about inability to locate the app or its files (or just having things run badly - if the app.yaml file isn't specified dev_appserver.py attempt to auto-detect it and that doesn't work in all cases). I'd avoid complications and just specify the app.yaml file(s).
Also note that the subprocess.run() args should be a list. Something like this:
subprocess.run(['python', '<sdk_path_to>/dev_appserver.py', '<app_path_to>/app.yaml'])
See also appcfg.py not working in command line - the post is about a different executable, but the answers are equally applicable to dev_appserver.py.
Quoting the App Engine documentation:
To start the local development server:
Run the dev_appserver.py command as follows from the directory that
contains your app's app.yaml configuration file:
Specify the directory
path to your app, for example:
dev_appserver.py [PATH_TO_YOUR_APP].
Alternatively, you can specify the
configuration file of a specific service, for example:
dev_appserver.py app.yaml.
To change the port, you include the --port
option:
dev_appserver.py --port=9999 [PATH_TO_YOUR_APP]

How to fix SERVICE_PAUSED error on starting nssm server

So I need to run a custom server. It worked on other machines, but not on mine (all of them are on Windows).
My input:
nssm start custom-server
Error message:
custom-server: Unexpected status SERVICE_PAUSED in response to START control.
I tried to re-start it, but got the same message.
Use the following instructions to change I/O redirects:
nssm set [SERVICE_NAME] AppStdout [APP_PATH_INSTALL]\logs\service.log
nssm set [SERVICE_NAME] AppStderr [APP_PATH_INSTALL]\logs\service-error.log
Check the service log files to find the failure.
In my case, the failure was caused by a dependency on Python libraries.
As Garric15 states it is probably your install command.
This could be for example a StdOut redirect to a path / file that does not exist on your local machine.
Look in the Application event log for errors where the source is nssm around the time you installed the service.
The reason is because firewall is blocking the software which you are running as a service, start first software separately, it will ask you to add to firewall exclusions , then you can use it via nssm
Some scenario
App directory not provided or doesn't exist
nssm nssm set xyz-service AppDirectory "D:\Work\ShoppingKart"
File which is given for service may be corrupted (rebuild code)
The application trying to run is not proper or corrupted. Try to run without windows service once.
Program (.exe) file path not found (in this case look for the solution, or else give full path, if java not found even if it is there in env, just add full path)
I solved it by using no mws (Managed Windows Service?) release,
ex.
gogs_0.12.10_windows_amd64 works
gogs_0.12.10_windows_amd64_mws not working
The issue for me was there had been a Java update on my machine. The JAVA_HOME environment variable was now pointing to an invalid directory (i.e. the old Java version). Just needed to update the JAVA_HOME path and restart the solr services to fix it.
I was attempting to configure rclone as a windows 10 service. I fixed it including the rclone.conf archive inside the rclone folder.
In my case, the problem was that after the service was installed using nssm.exe, the program name was changed. This caused service to always go to paused state after start or restart the service, using either services.msc or nssm.exe command line.
Editing service nssm.exe startup parameters solved the problem for me.

Resources