Is it possible to use Argon2 on Google App Engine Standard environment? - google-app-engine

I'm in the process of migrating an application to Google App Engine. If possible I want to use the standard environment. My application uses Argon2 to hash passwords. Neither on PHP 7.2, 7.3 nor 7.4 Argon2 is available with a basic app.yaml file.
app.yaml:
runtime: php72|php73|php74
Is there any configuration I can adjust to get the support for Argon2?

In order to use Argon2 it is necessary to install 3rd party libraries that are not included in the php distributions (to install you do sudo apt install argon2 ). Based on this information, the best solution for you would be to use Cloud Run[1].
Follow the tutorial in the Cloud Run Quickstart [2], taking into account that you have to edit your Dockerfile to make sure that Argon2 is installed.
[1] https://cloud.google.com/serverless-options
[2] https://cloud.google.com/run/docs/quickstarts/build-and-deploy#php

Related

How to do AppEngine Go 1.16 local development?

AppEngine supports Go 1.16 for a year now. But dev_appengine.py still doesn't:
RuntimeError: Unknown runtime 'go116'; supported runtimes are 'custom', 'go', 'go111', 'go112', 'go113', 'go114', 'go115', 'java', 'java7', 'java8', 'php55', 'php72', 'php81', 'python', 'python-compat', 'python27', 'python310', 'python37', 'python38', 'python39'.
The official documentation is unhelpful.
How can I do local Go 1.16 development of my AppEngine app?
I assume you meant dev_appserver.py and not dev_appengine.py. If so, then
It looks like you're using GAE Standard env in which case, gcloud CLI version 409.0.0 (which seems to be the latest, at least for Mac) doesn't support go 1.1.6. The go runtimes supported in it are
go, go111, go112, go113, go114, go115
You can find the list of supported runtimes in the file
{{path to gcloud sdk_installation}}/platform/google_appengine/google/appengine/tools/devappserver2/runtime_factories.py
If you switch to GAE Flex, I believe you'll be able to use go 1.1.6 since you'll then be using a custom runtime
You can also just run your App as you would a standard go App e.g using command go run <go_package>

Go app engine dev_appserver.py doesn't support runtime go112

I am trying to migrate my Go app to runtime go112, but dev_appserver.py throw the following error:
RuntimeError: Unknown runtime 'go112'; supported runtimes are 'custom', 'go', 'go111', 'java', 'java7', 'java8', 'php55', 'php72', 'python', 'python-compat', 'python27', 'python37'.
Current Go version is 1.12.11
Edit: I used apt-get to install the SDK.
apt-get update && apt-get install google-cloud-sdk google-cloud-sdk-app-engine-python\
google-cloud-sdk-app-engine-python-extras\
google-cloud-sdk-app-engine-java\
google-cloud-sdk-app-engine-go\
google-cloud-sdk-datalab\
google-cloud-sdk-datastore-emulator\
google-cloud-sdk-pubsub-emulator\
google-cloud-sdk-cbt\
google-cloud-sdk-cloud-build-local\
google-cloud-sdk-bigtable-emulator\
kubectl -y
That way it seems I can't use gcloud components update and the packages are not up-to-date in the repos.
Now my questions is: Does google-cloud-sdk-app-engine-go support go runtime 1.12? If not, when will it support runtime 1.12?
Update: I installed cloud SDK and run gcloud components update successfully on another computer, dev_server.py still throw the same error. Does the local SDK actually support rumtime 1.12?
go112 runtime is not available on local dev_appserver.py. This has been discussed on the App Engine Go forum at
https://groups.google.com/forum/#!topic/google-appengine-go/kHxZ9zIb_QE
The expectation is that starting from go112 runtime, there is no "appengine" way of running the go server and works normally like any go server outside GAE. There are a few open issues like dispatching urls though.
It sounds like you gcloud SDK is an old version and not recognize "runtime: go112", please run this command in order to update your SDK.
gcloud components update
After the update you can be able to deploy an app engine service using GO 1.12 runtime, check the changes that you need to perform in you App.yaml in this link

Get latest version number of the Google App Engine SDK

I am writing a script to automatically download and update the installed version of the Google App Engine SDK. I can determine the installed version.
I currently need to make a wget request and check to see if it returns a 404 error; actually this is at least 2 requests, one to check for a bug fix update and a second to check for a minor version update.
I would like to avoid making these wget requests. To do this I need to determine the latest (stable not pre-release) version of the SDK. Is this info available via an API or other queryable source?
The python SDK checks for the current SDK when running the dev server. The launcher also has this facility.
This would be the method I would use.
For the command line sdk the python code that implements the check is https://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/tools/sdk_update_checker.py and as you pointed out the code for the launcher is https://code.google.com/p/google-appengine-wx-launcher/source/browse/trunk/launcher/app.py
The code performs an api RPC to http://appengine.google.com/api/updatecheck and gets a yaml response. So you can either use that code, or even just import and SDKUpdateChecker from sdk_checker.
The accepted answer has recently broken. http://appengine.google.com/api/updatecheck now returns a response like this with the latest release version set to 0.0.0:
$ curl -LSfs https://appengine.google.com/api/updatecheck
release: "0.0.0"
timestamp: 1586242881
api_versions: ['1']
supported_api_versions:
python:
api_versions: ['1']
python27:
api_versions: ['1']
go:
api_versions: ['go1', 'go1.9']
java7:
api_versions: ['1.0']
go111:
api_versions: [null]
The latest available version is 1.9.90 at
https://storage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.90.zip
It is possible that there will be future versions (1.9.91, etc.) provided at a similar URL, but that remains to be seen. It looks like gcloud components install and gcloud components update can be used to install the SDK, though it may be more difficult to script it.
UPDATE:
https://cloud.google.com/appengine/docs/standard/python/sdk-gcloud-migration
As of July 30, 2019, the standalone App Engine SDK is deprecated. It will become unavailable for download on July 30, 2020.
gcloud is the way forward here, though I'm not sure of a good way to automate gcloud updates. If I find a good suggestion or come up with one, I'll update here.

Is scrapy supported on google app engine?

It has following dependencies:
- Twisted 2.5.0, 8.0 or above
- lxml or libxml2 (if using libxml2, version 2.6.28 or above is highly recommended)
- simplejson
- pyopenssl
You cannot use C extensions on App Engine, which rules out lxml and (I believe) libxml2 and pyopenssl.
I doubt most of what Twisted does is possible in the App Engine sandbox either; you can't directly open sockets or spawn threads.
EDIT (January 2013): The Python 2.7 runtime does include some C extensions, including lxml. However, it's still not possible to use C extensions that aren't provided by Google with the runtime; most likely scrapy is still unusable at this time.
No but you could try AWS (http://dev.scrapy.org/wiki/AmazonEC2)
Update for 2019:
Scrapy indeed works on GAE. I can confirm that Scrapy can be deployed on GAE Python 3 standard environment using ScrapyRT.
Your scrapy.cfg file must be in the same directory as app.yaml to be picked up accordingly and a minimal setup would look like this:
runtime: python37
instance_class: F2
env_variables:
PORT: 8080
entrypoint: scrapyrt -i 0.0.0.0 -p $PORT -s LOG_DIR=/tmp
Note how LOG_DIR is set to /tmp which is most likely not what anyone would want for production environment. I might extend this answer once i figured out how to approach this appropriately.

How do I add PHP support to Apache 2 without breaking my current installation?

I run Apache 2 with WSGI (for a Django-app) on a Ubuntu box. I want to use Nagios for server monitoring, and for this purpose it seems I have to add PHP support to Apache.
When I installed Apache 2, I did this:
apt-get install apache2 apache2.2-common apache2-mpm-worker apache2-threaded-dev libapache2-mod-wsgi python-dev
Available modules for apache2 are these:
/etc/apache2/mods-available$ ls
actions.conf authn_default.load cache.load deflate.conf filter.load
mime.conf proxy_ftp.load suexec.load actions.load authn_file.load
cern_meta.load deflate.load headers.load mime.load proxy_http.load
unique_id.load alias.conf authnz_ldap.load cgi.load dir.conf
ident.load mime_magic.conf rewrite.load userdir.conf alias.load
authz_dbm.load cgid.conf dir.load imagemap.load mime_magic.load
setenvif.conf userdir.load asis.load authz_default.load cgid.load
disk_cache.conf include.load negotiation.conf setenvif.load usertrack.load
auth_basic.load authz_groupfile.load charset_lite.load disk_cache.load info.conf
negotiation.load speling.load version.load auth_digest.load authz_host.load
dav.load dump_io.load info.load proxy.conf ssl.conf
vhost_alias.load authn_alias.load authz_owner.load dav_fs.conf env.load
ldap.load proxy.load ssl.load wsgi.conf authn_anon.load
authz_user.load dav_fs.load expires.load log_forensic.load proxy_ajp.load
status.conf wsgi.load authn_dbd.load autoindex.conf dav_lock.load
ext_filter.load mem_cache.conf proxy_balancer.load status.load authn_dbm.load
autoindex.load dbd.load file_cache.load mem_cache.load proxy_connect.load
substitute.load
What is the best way for me to add PHP support to Apache 2 without breaking my current installation and configuration?
IS the issue your referring to the Python WSGi.
if so take a look here to see if this helps you, Im not fully update with Python so not sure but hope it can help.
--
This module allows you to run PHP processes inside of Python, using a WSGI gateway. This way PHP applications can appear like normal Python WSGI applications, and WSGI middleware routing and filters can all be applied in front of them. For instance, WSGI middleware-based authentication or authorization, routing, deployment, or styling filters (like WSGIOverlay).
http://pythonpaste.org/wphp/

Resources