How to download a file/folder from remote (openshift) to local system - openshift

How to download or backup or to save a copy of a file from openshift remote folder into my local-system folder using rhc client tool? or is there any other way other than rhc client tool to make a backup of it to my local system?
Also, Is there a way to copy an entire folder from remote(openshift) to local?

First, tar and gzip your folder on the server within a ssh session, the syntax is:
rhc ssh <app_name>
tar czf <name_of_new_file>.tar.gz <name_of_directory>
Second, after you have disconnected from the openshift server (with CTRL-D), download this file to your local system:
rhc scp <app_name> download <local_destination> <absolute_path_to_remote_file>
Then on your local machine you can extract the file and perform your actions.

Use winscp (if on windows) to ssh into your openshift app. Navigate to your folder. Drag and drop folder or files to local machine.
Filezilla - using filezilla and sftp with openshift

теперь можно так
copy a pod directory to a local directory:
oc rsync <pod-name>:/opt/app-root/src /c/source
https://docs.okd.io/3.11/dev_guide/copy_files_to_container.html

Related

Access file from chrome node docker

I am using selenium grid docker to run my automation testsuites.
I hv configured chrome node docker to run my testcases on the browser.
In my testcases I am downloading some file from the web. It is getting downloaded in "/home/seluser/Downloads/". I need the content of the file as the content is dynamic. How I can access file downloaded on the docker image from machine where my automation is running.
One way to do this would be to mount the /home/seluser/Downloads path somewhere on your host machine. Change your docker run command to add something like -v /path/on/host:/home/seluser/Downloads and all of the saved files will be accessible on your host machine.
You can use docker cp command
docker cp <name of the container>:/home/seluser/Downloads copied_files
where copied_files is a directory where files will be copied

AWS Elastic Beanstalk application folder on EC2 instance after deployed?

My context
I'm having errors in my deployment using AWS EB with my Flask application.
Now I'm inside the EC2 instance via eb ssh and need to explore the deployed source code of the application.
My problem
Where is the deployed application folder?
The source code is zipped and placed in the following directory:
/opt/elasticbeanstalk/deploy/appsource/source_bundle
There is no file extension but it is in the zip file format:
[ec2-user#ip ~]$ file /opt/elasticbeanstalk/deploy/appsource/source_bundle
/opt/elasticbeanstalk/deploy/appsource/source_bundle: Zip archive data, at least v1.0 to extract
Find for a specific/unique filename in source code folder, we will find the location of our application folder which, in AWS EB, to be
/opt/python/current
/opt/python/bundle/2/app
p.s.
Search for YOUR_FILE.py
find / -name YOUR_FILE.py -print

OpenShift: How to upload a directory?

I am using OpenShift with Tomcat 7. I am trying to scp a directory into webapps. I search online and the recursion option is -r. However, when I type rhc help scp, the -r option is
-r, --remote-path file_path Remote filesystem path
So is there a recursion option for scp in OpenShift? How can I upload a directory in OpenShift?
Any help would be much appreciated. Thank you.
scp localfile gearnumber#myapp.rhcloud.com:app-root/data
scp localdir -r gearnumber#myapp.rhcloud.com:app-root/data
The only directory where your user has write permission is app-root/data, you can reference it from your code with the environment variable OPENSHIFT_DATA_DIR

Unable to Deploy War file on OpenShipt using git

Please help me how to deploy war on openshift app.I have put our war file in webapps folder and push code but my war is not deployed.
after this default page will be open on app url.Please help me.
If you would like to deploy pre compiled java applications to your OpenShift gear, but you don't want to waste space by storing them in your git repository, then these directions are for you!
Create an application on OpenShift and select either the Tomcat 6 (JBoss EWS 1.0) or Tomcat 7 (JBoss EWS 2.0) cartridges.
Use the git clone command to download the source code for your application to your computer.
Remove the src directory and the pom.xml file from your application that you cloned to your computer.
DO NOT place your WAR files into the webapps directory.
Next, you need to do a git commit -am "some message here" to make sure that your changes are committed. Lastly, you need to do a git push to deploy your changes to your OpenShift gear.
Now comes the fun part, you need to use SCP or SFTP (with public key authentication of course) to upload your files to the correct location on your gear.
You need to place your WAR files into this folder: app-root/dependencies/jbossews/webapps on your gear.
If you run rhc tail $appname, shortly after the transfer is done you will see entries appear in the logs showing that your WAR file has been deployed and at what context.
The WAR files that you add into the webapps directory will be deployed at a context that matches the name of the WAR file.
For Example:
If you add a file called mywebsite.war, it will be available at app-domain.rhcloud.com/mywebsite. If there is an application that you would like to be available at app-domain.rhcloud.com/ (also known as the root context) then you should name that file ROOT.war.
If you need to replace them, just upload a new copy, or if you want to remove them, just ssh into your server and delete the file you uploaded and it will be un-deployed.

"No system SSH available" error on OpenShift rhc snapshot save on Windows 8

Steps To Replicate
On Windows 8.
In shell (with SSH connection active):
rhc snapshot save [appname]
Error
No system SSH available. Please use the --ssh option to specify the path to your SSH executable, or install SSH.
Suggested Solution
From this post:
Usage: rhc snapshot-save <application> [--filepath FILE] [--ssh path_to_ssh_executable]
Pass '--help' to see the full list of options
Question
The path to keys on PC is:
C:\Users\[name]\.ssh
How do I define this in the rhc snaphot command?
Solution
rhc snapshot save [appname] --filepath FILE --ssh "C:\Users\[name]\.ssh"
This will show the message:
Pulling down a snapshot of application '[appname]' to FILE ...
... then after a while
Pulling down a snapshot of application '[appname]' to FILE ... DONE
Update
That saved the backup in a file called "FILE" without an extension, so I'm guessing in the future I should define the filename as something like "my_app_backup.tar.gz" ie:
rhc snapshot save [appname] --filepath "my_app_backup.tar.gz" --ssh "C:\Users\[name]\.ssh"
It will save in the repo directory, so make sure you move it out of this directory before you git add, commit, push etc, otherwise you will upload your backup too.