- how to develop and debug your application locally with functions-framework-python.
- how to automate the deployment of Cloud Functions with Cloud Build on Google Cloud Platform.
Check the complete tutorial here.
- ffmpeg:
brew install ffmpeg
-
Install Python 3.7+
-
Create and activate an isolated Python environment
virtualenv --python `which python3.7` venv source ./venv/bin/activate
-
Install the dependencies
pip install -r requirements-dev.txt pip install -r requirements.txt
Create {project_root}/.env from {project_root}/deployment/.envexample.
From inside root of the directory:
./scripts/run-local-pubsub.sh
From a different terminal window:
./scripts/test-local-pubsub.sh '{"call_id": "6fAoVoxkfCenkm2K6ejYGU", "partial_id": "bo6FTU5HbpsUmYn8TFofNq", "audio_partial_id": "a3HvzN9htW5H5j9i2X23mL"}'
test-local-pubsub.sh
does the following behind the scenes:
- encodes the message passed as parameter in base64 format;
- reads the contents of
./scripts/payloads/test-local-payload.json
and replaces itsdata
property with the base64 encoded message; - performs an HTTP post request to
http://localhost:8080
(the default address the application runs when you execute./scripts/run-local-pubsub.sh
from the other terminal window), sending the modified JSON from the previous step in the payload.
On the terminal window where you ran ./scripts/run-local-pubsub.sh
you should see some logs showing a message was received.
From inside root of the directory:
./scripts/run-local-http.sh
From a different terminal window:
./scripts/test-local-http.sh
test-local-http.sh
performs a GET
HTTP request to http://localhost:8080/?subject=FooBar
and prints the response:
$ ./test-local-http.sh
Hello, FooBar!
Run gcloud init
.
-
Re-initialize your default configuration
-
Set the project to the one you created (there can be a time delay for a newly created project to appear in the list of your organization's projects.)
-
Confirm your email login
-
Do you want to configure a default Compute Region and Zone?
- Hit
Y
and then enter - Set the zone to
us-west4-a
- Hit
-
Create an environment file
./deployment/<PROJECT_ID>.env
with the given project id.- Escape any funny characters in your
./deployment/<PROJECT_ID>.env
file that bash doesn't like with " " around the value after the=
sign. - Lay down ./deployment/peerlogic-api-dev.env
- Escape any funny characters in your
-
Uncomment all lines in this file if running for the first time
./deployment/gcloud_deploy.bash
and then run it from the root of this repository.