How do I persist data within a Codenvy/Che Workspace? - eclipse-che

I have a workspace with the following config
{
"environments": {
"default": {
"machines": {
"db": {
"attributes": {
"memoryLimitBytes": "536870912"
},
"servers": {},
"agents": [
"org.eclipse.che.terminal",
"org.eclipse.che.exec"
]
},
"dev-machine": {
"attributes": {
"memoryLimitBytes": "2684354560"
},
"servers": {},
"agents": [
"org.eclipse.che.ssh",
"org.eclipse.che.ws-agent",
"org.eclipse.che.terminal",
"org.eclipse.che.exec"
]
}
},
"recipe": {
"type": "compose",
"content": "services:\n db:\n image: 'terrywbrady/dspacedb:latest'\n mem_limit: 1073741824\n dev-machine:\n image: 'terrywbrady/dspace:latest'\n mem_limit: 2147483648\n depends_on:\n - db\n",
"contentType": "application/x-yaml"
}
}
},
...
}
I can start my workspace, build code, and deploy to tomcat. Data is written to postgres.
When I halt my workspace and then restart it, all of my built content is gone.
How can I declare volumes that will persist from workspace session to workspace session?

It really depends on a Che flavor and version you are using.
Is it local Che?
Which version of Che?
Is it hosted at codenvy.com?
Is it on Docker or openshift or kubernetes?
Depending on this I can help you figuring out what to do.
So looks like there are couple of ppl that run different flavours of Che. And there are other flavors which could be interesting for other ppl.
For codenvy there are 2 solution (it runs enterprise grade modification of Che 5):
- snapshot workspaces
- configure software to persist data in /projects folder which is automatically synced
For local Che 6 (which has all the enterprise stuff and more out of the box) it is better to follow thread on GitHub. There is no snapshotting functionality but it allows to configure volumes for custom paths.
Depending on a platform that runs Che 6 (Docker, Kubernetes, Openshift) you might need to additionally configure Che to achieve persistence in a way that fit your needs best. To get more info it is better to ask on GitHub since all the maintainers track it.

Related

devcontainer.json. Breakpoints not working

I launch a debug session through the Module option and specifying a folder, the app starts up and responds to requests - and code changes are seen when other services interact with mine by calling into it (print statements show the change in the terminal output of the IDE), however, breakpoints are not hit. How come?
My devcontainer.json file looks like this:
{
"name": "Existing Dockerfile",
"build": {
"dockerfile": "../Dockerfile",
"context": "../.",
"target": "deploy"
},
}
My Dockerfile does the usual stuff and runs our app with python -m app:
FROM python:3.9.3-slim AS deploy
COPIES SOME FILES
CMD ["python", "-m", "app"]
My problem was the version of python that was pulled in.
In my Dockerfile, I had to change:
FROM python:3.9.3-slim AS base
to
FROM python:3.9.4-slim AS base
Then breakpoints started working.

Setting up VSCode with xdebug: pathMapping

I am trying to set up debugging in VSCode and have run into a bit of a challenge. I typed the path to the localSourceRoot but Intellisense is telling me that it is deprecated and I should use pathMapping instead.
I am a newbie and don't know how to properly set that up. If someone could explain to me the variables and/or attributes pathMapping is requesting I would be forever in your debt.
My system info is as follows:
PHP version: 5.524
xdebug version: 2.2.5
OS Windows 8.1
Using Desktop Server version: 3.8.5
I checked the phpinfo() and it shows Xdebug in the file so I know that it is installed. The launch.json file is pretty basic with port 9000 and all of that. I just need to get that darned pathMapping thing done.
Thanks for any and all help.
I guess you're using the PHP debug extension ?
https://github.com/felixfbecker/vscode-php-debug
The README.md says the following:
Remote Host Debugging
To debug a running application on a remote host, you need to tell XDebug to connect to a different IP than localhost. This can either be done by setting xdebug.remote_host to your IP or by setting xdebug.remote_connect_back = 1 to make XDebug always connect back to the machine who did the web request. The latter is the only setting that supports multiple users debugging the same server and "just works" for web projects. Again, please see the XDebug documentation on the subject for more information.
To make VS Code map the files on the server to the right files on your local machine, you have to set the pathMappings settings in your launch.json. Example:
// server -> local
"pathMappings": {
"/var/www/html": "${workspaceRoot}/www",
"/app": "${workspaceRoot}/app"
}
Please also note that setting any of the CLI debugging options will not work with remote host debugging, because the script is always launched locally. If you want to debug a CLI script on a remote host, you need to launch it manually from the command line.
Thus is as much a reference to myself as well as others who might find this helpful. I am running VSCODE with xdebug and drupalvm and the following works for me after setting the following in php.ini
php_xdebug_idekey: VSCODE
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"pathMappings": {
"/var/www/drupalvm/drupal": "${workspaceRoot}/drupal",
},
"log": true
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}

Connector Manifest not Validating in DataStudio

I am trying to test a connector I am building. I have created the manifest file (appsscript.json) and am trying to add this by Deployment ID to DataStudio. I keep getting an error that states:
The connector manifest could not be retrieved or is invalid. Check the connector and try again.
Here is a a copy/paste of my appsscripts.json file:
{
"timeZone": "America/New_York",
"dependencies": {
"libraries": [
{
"userSymbol": "OAuth2",
"libraryId": "1B7FSrk5Zi6L1rSxxTDgDEUsPzlukDsi4KGuTMorsTQHhGBzBkMun4iDF",
"version": "24"
}
]
},
"dataStudio": {
"name": "VALID NAME",
"company": "VALID NAME",
"logoUrl": "VALID LOGO",
"addonUrl": "VALID URL",
"supportUrl": "VALID URL",
"description": "VALID DESCRIPTION"
}
}
I would expect this to enable the workflow of enabling the connector and then allowing the OAuth flow to be tested.
Instead, I get this error:
The connector manifest could not be retrieved or is invalid. Check the connector and try again.
Can anyone advise why this is validating? I have followed these steps:
https://developers.google.com/datastudio/connector/use
Thanks!
Double check the permissions of your script. Especially if you are using corporate account (not from your #gmail.com address) the default sharing is corporate-only, therefore your script (and the manifest) is not available from outside.
Before Selecting the link, you need to select the Install add-on. It worked for me. I have enclosed the screenshot for reference
Check the installation URL if you are signed into multiple google accounts.
You may have to change to the u/0 section to u/1, or whichever number appears here for the relevant google account:
https://datastudio.google.com/**u/0**/datasources/create?connectorId=...

How to use safari technology preview in webdriver io tests (using wdio test runner)?

I tried running my tests on safari technology preview release 43 (Safari 11.1, WebKit 12605.1.12) using the below desired capabilities in wdio.conf.js.
capabilities: [{
browserName: 'safari',
'safari.options': {
technologyPreview: true
}
}]
Every time I run the tests, regular version of browser gets opened. Anybody facing similar issue?
Please find the logs below
[14:39:54] COMMAND POST "/wd/hub/session"
[14:39:54] DATA {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"browserName":"safari","safari.options":{"technologyPreview":true},"loggingPrefs":{"browser":"ALL","driver":"ALL"},"requestOrigins":{"url":"http://webdriver.io","version":"4.6.2","name":"webdriverio"}}}
[14:39:55] INFO SET SESSION ID EE19F81D-B054-4926-8235-B64387250665
[14:39:55] RESULT {"applicationCacheEnabled":true,"rotatable":false,"databaseEnabled":true,"handlesAlerts":true,"version":"12604.3.5.1.1","cleanSession":true,"platform":"macOS","nativeEvents":true,"locationContextEnabled":false,"webStorageEnabled":true,"browserName":"safari","javascriptEnabled":true,"platformName":"macOS","cssSelectorsEnabled":true}
[14:39:56] COMMAND POST "/wd/hub/session/EE19F81D-B054-4926-8235-B64387250665/url"
It appears as if this is a feature that may not "yet" be supported by Selenium in their Safari Driver implementation.
After researching a little I came across this issue with notes from a few days ago.
https://github.com/SeleniumHQ/selenium/issues/4537
Near the bottom per a member of the Selenium Organization:
Reading "technologyPreview" setting from the node config file is not
yet implemented, it's an independent issue, we're working on this
feature.
dont use safari, but maybe you can open the binary in the same way how you can do it with chrome canary with define the .exe in the binary.
"browserName": "chromeCanary",
"platform": "MAC",
"chromeOptions": {
"binary": "/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary"
},

Run AngularJS Tutorial with VSCode

I was hoping to try VSCode on the AngularJS tutorial, say step 1, and get debugging and building working.
I was able to get it running, but it's a bit of a hack and VSCode doesn't like it.
{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.
// ONLY "node" and "mono" are supported, change "type" to switch.
"configurations": [
{
// Name of configuration; appears in the launch configuration drop down menu.
"name": "Launch app.js",
// Type of configuration. Possible values: "node", "mono".
"type": "node",
// Workspace relative or absolute path to the program.
"program": "app\\js\\app.js",
// Automatically stop program after launch.
"stopOnEntry": true,
// Command line arguments passed to the program.
"args": [],
// Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.
"cwd": ".",
// Workspace relative or absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.
"runtimeExecutable": "run.bat",
// Environment variables passed to the program.
"env": { }
},
{
"name": "Attach",
"type": "node",
// TCP/IP address. Default is "localhost".
"address": "localhost",
// Port to attach to.
"port": 5858
}
]
}
I get an "Error Connection failed" even though it is actually running in a separate command prompt window.
Is there a way to for VSCode to debug a simple application like this that only uses package.json start like this:
"start": "http-server -a 0.0.0.0 -p 8000"
Thanks,
Derek
Visual Studio Code supports only Node and Mono debugging, it does not support debugging client JavaScript in the browser.
If you want debug Javascript in the browser, use the browser tools. If you want try out node.js debugging support in VSCode. Start with a sample node.js or express app, then follow the direction in Visual Studio Code website on setting up debugging.
If you would like to see Visual Studio Code supporting debugging, you can vote it up in user voice.

Resources