Is it possible to run e.g. a makefile or latex on files that are stored on Google Drive?
Consider the following scenario:
Google Drive App user (logged in on his own Google Drive) 'runs' a makefile or latex on a server e.g. using a php script.
It is (relatively) easy to download the makefile or latex file at the server side, and exec a specific command (e.g. 'make' or 'latex').
The problem is that the makefile or latex file needs other files that are stored locally on the user's Google Drive. However, I do not want to download all the files to the server 'just in case'.
Maybe a complete Google Drive folder can be mapped on the server for this session?
Or maybe symlinks can be made for the complete file tree, and when they are accessed, the actual file content can be downloaded on the server?
Does anybody have any ideas and practical tips how to implement this?
No turn key solution for PHP as far as I know.
If you have admin rights on the (Linux) server the PHP runs on, you can mount Google drive in an ordinary folder. If you are willing to do quite some programming, you could start out with vfs://Stream which is PHP only AFAIK.
If it is possible to ssh into your Google Drive (which I don't know) you could use the sshfs command to mount it and then execute whatever commands you desire.
Regarding Latex: CLSI (common latex service interface) seems to be a viable candidate, as it accepts urls to your resources. See the following links:
http://code.google.com/p/common-latex-service-interface/
https://github.com/scribtex/clsi
Public CLSI servers
The downloadUrl of the google drive resources can then be passed in the CLSI request.
See my answer in google drive: access webContentLink through javascript for getting the downloadUrl in javascript.
Related
We use a Flexible Environment with Google App Engine for our PHP Website (Laravel) and cannot figure out how to download current website image from Google App Engine with flexible environment setup. As I now have a new developer, we need this latest version for a backup purpose and for future improvement. The idea is to get the latest code from there and also the database, which is even more important, as website already has data and users on it (it is live now, in beta).
We also have a GitHub account setup. If we could load an image from the cloud to GitHub, that could work as well.
You may be able to find the source code here:
https://console.cloud.google.com/debug
Alternatively, since you are using GAE Flex, you could ssh into your instance to try to find it:
https://cloud.google.com/appengine/docs/flexible/php/debugging-an-instance#connecting_to_the_instance
As for the Database, the answer depends on 1) which database you are using (google datastore vs google cloud sql, etc) and 2) what you intend to do with it.
For example, Google datastore has datastore admin which can retrieve a snapshot of the database (https://console.cloud.google.com/datastore/settings), but the output is not something standard like csv. It's primarily used for backups & restores. But you can use this to clone your database into another app engine project
In order to copy anything from a VM on google Cloud platform, you first need to access the docker via SSH (command: sudo docker exec -it gaeapp /bin/bash). When inside of docker, you need to archive everything you need into TAR.GZ format (or try rar or zip, my server only supported TAR.GZ), once archived, you need to copy that outside of docker, which i already forgot how I have done that (oops). But google will help. Once done there will be a very non obvious gear icon on your SSH window top right where you can simply click download file and enter a file name. Choose your archive and vuala.
I have been trying to perform a simple write to my Google Cloud Bucket using the php sample that Google provides. My problem is that my remote Google Cloud VM Server does not seem to be functioning correctly. I followed all of the instructions on the website except creating a client ID because I have already created 2 so I used one of those. One of the problems I observed while trying to implement this is that php does not seem to including the google cloud storage libraries. I downloaded the git as the website instructed and I even included the path in the php.ini. This is what i included
include_path = ".:/usr/bin/php:/google-api-php-client/src" I find that even after I adding this, when I try to run
<?php file_put_contents('gs://myappid.appspot.com/hello.txt', 'Hello');?>
I get the error Unable to find wrapper 'gs//'. Even adding require_once(google-api-php-client/autoload.php) does not fix the problem. After I added require_once... my code does not run past this point. It does not throw an error, it just stops running. I am lost at how to store files into my bucket via php. I follow the instructions on Google strictly but nothing seems to work.
The gs:// wrapper is only provided on Google App Engine, not Google Compute engine.
As long as you have read and write allowed in your google compute engine, gcloud or gsutil should already be installed. Then try using normal gsutil commands like:
exec("/usr/bin/gsutil -m cp -R file.png gs://bucket/images/", $output, $image_return);
Log into your compute engine and try out like gsutil ls
) i am creating a php application in google appengine. Since i will have to pay for the cloud sql, i decided to use some files instead of the sql database and read/write from it. but the problem is i am not able to create or modify the existing files using php's standard file operations like 'fopen' and 'fwrite',etc. when i run the same code in 'localhost:8080' it is working properly. but not in the uploaded version in internet. i am getting errors while creating/writing to the files. please help. thank you
You should read the appengine php runtime docs https://developers.google.com/appengine/docs/php/#PHP_The_sandbox
Specifically the section about the sandbox. The crucial statement -
An App Engine application cannot:
write to the filesystem. PHP applications can use Google Cloud Storage
for storing persistent files. Reading from the filesystem is allowed,
and all application files uploaded with the application are available.
This was a while ago, but if you still want to write to file system, you can write to the gs cloud
https://cloud.google.com/appengine/docs/php/googlestorage/#writing_files_from_your_app
you need to add the bucket to your php.ini file
google_app_engine.allow_include_gs_buckets="yourapp.appspot.com"
and make sure your Service Account Name has permissions to edit the cloud storage
HTH
I start to use GAE with PHP. On documentation we can't find any information about Blobstore.
So the only way to upload image it's to upload image on PHP application is Cloud Storage ?
Thx
Samuel
Yes no blobstore - only persistent storage is Google Cloud Storage.
In the current PHP SDK (1.89), in the PHP libs directory (<path to>\Google\google_appengine\php\sdk\google\appengine\api\blobstore) you can see that there is a blobstore directory, and a single blobstore_service_pb.php file. It is missing the BlobstoreService.php and BlobstoreException.php files.
However, you can get pre-release version from googles git site:
https://chromium.googlesource.com/external/googleappengine/python/+/b90ec6c60be569887e4905737fc5b2fedd9fe336%5E/php/sdk/google/appengine/api/blobstore/
Download the two required files, stick it in your Google appengine SDK blobstore directory and use it.
require_once 'google/appengine/api/blobstore/BlobstoreService.php';
use google\appengine\api\blobstore
Works locally on the development server... Not sure if the files exist on the actual app engine service, as I haven't pushed a test app to the servers yet.
PHP in GAE is in experimental stage and for now not every API is available. There's no ETA. You can try to make for example python "backend" that will handle your blobs and call it from your PHP side.
I want to develop a website like file manager. Where user register and will get fix disk space lets say 20MB.
Now user can upload their pdf, doc, txt, jpeg etc files upto their disk limit.
I can develop upto this using PHP.
Now below is my issue:
1) If user's files are corrupted they can rollback their folders before 2-3 days.
Files must be secure and safe from viruses as users are uploading their important documents.
Is there any 3rd party storage server who provides such facility?
2) Also all files should be previewed from browser.
I am using Google doc viewer. Is is good and safe way to preview file in browser?
But google links are accessible from all, I need to add some restrictions as file can be viewed only by their owner.
I know it's a major task, but i just need some sort of logic. Please share your thoughts.
Thanks.
Any cloud storage service can be used for this. You'll get HDD space. There is not storage server who provides revision control system for this. You can use git, svn for this though. But as the files are binary you can not get full facility of these tools.
How file will be previewed depends on you. If you use PHP you make the site and at the backend you use the API to interact with the storage service. Google doc is not an option for this if you use PHP. Also note Google links can be made private.
I suggest you this,
Find a cloud storage service and use the storage in your server. Any will do.
Create UI using PHP and control the access using PHP too.
Manipulate files in your server directly or in 3rd party storage server via API
Use a revision control system to track the changes. And use its API in PHP end.
Some cloud storage service
Amazon S3. It also supports Versioning.
Google Cloud Storage
Microsoft Azure
Try Microsoft SkyDrive or Google Drive or Dropbox