Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arxiv/arxiv-announce
Collection of functions used for the announce process
https://github.com/arxiv/arxiv-announce
Last synced: about 4 hours ago
JSON representation
Collection of functions used for the announce process
- Host: GitHub
- URL: https://github.com/arxiv/arxiv-announce
- Owner: arXiv
- License: mit
- Created: 2024-05-14T16:15:47.000Z (6 months ago)
- Default Branch: develop
- Last Pushed: 2024-10-29T18:00:24.000Z (8 days ago)
- Last Synced: 2024-10-29T19:15:04.912Z (8 days ago)
- Language: Python
- Size: 107 KB
- Stars: 0
- Watchers: 8
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# arxiv-announce
Collection of functions used for the announce process# organization
For each function make a subfolder under cloud_functions.
In that folder include the source files, requirements.txt, tests, and cicd files it may need.The hello_world folder has a simple cloud_function you can make a copy of to get started
# running locally
for http driven functions:
to run your cloud function, run this in the src directory and name your target function
` functions-framework --target=hello_world_http`to trigger you can go to http://127.0.0.1:8080/ in your browser
for cloud event driven functions:
to run your cloud function
` functions-framework --target=hello_world --signature-type=cloudevent `to trigger run a curl command with a cloud event, heres an example you can use:
note that the data is base 64 encoded, and that return values from cloud functions seem to be useless
```
curl localhost:8080 \
-X POST \
-H "Content-Type: application/json" \
-H "ce-id: 123451234512345" \
-H "ce-specversion: 1.0" \
-H "ce-time: 2020-01-02T12:34:56.789Z" \
-H "ce-type: google.cloud.pubsub.topic.v1.messagePublished" \
-H "ce-source: //pubsub.googleapis.com/projects/MY-PROJECT/topics/MY-TOPIC" \
-d '{
"message": {
"data": "eyJmb28iOiJiYXIifQ==",
"attributes": {
"attr1":"attr1-value"
}
},
"subscription": "projects/MY-PROJECT/subscriptions/MY-SUB"
}'
```# deploying
in GCP your function will need a trigger to trigger the build of the function on deploy, a service account to run the build, a service account to run the function, as well as a pubsub subscriber (or some other event) to drive it. Each function needs its own subscriberthe dev project has a version of each of these for hello_world that can be used as a model.
build trigger: deploy-hello-world-cfunction
build service account: [email protected] which you can use for all cloud builds
function run account:[email protected] which can also be used for other function in this repositroy, or you can make your own if you want something special
pubsub subscriber: eventarc-us-central1-hello-world-932641-sub-590 (created automatically by the cloud build)you can test this whole setup by publishing a message like {"foo": "magic"} in the testing topic