This folder contains the mandatory files to deploy HWID Service on AppEngine. Most of the files are porting from HWID Server with modifications to adapt to factory repository.
The origin HWID Server Arch Overview and Design Doc.
app.yaml
: Config file for deploying service on AppEngine.cron.yaml
: Config file for deploying cronjob on AppEngine.${factory_dir}/deploy/cros_hwid_service.sh
: The main script to deploy and test HWID Service. Run cros_hwid_service.sh
for more usage.appengine_config.py
: The very first loading file on AppEngine.app.py
: The API entry point. It defines the API handlers.hwid_api.py
: The HWID API function implementation.There are three environments to deploy to:
Normally, we would use ToT: Run repo sync .
in each repo.
prod
, you have to deploy to staging
:# If you use Google Cloud Platform for the first time, you may have to # install gcloud sdk (https://cloud.google.com/sdk/install). gcloud may ask you # to register or loging your account. Please enter your google domain acount. # It may also ask you to register or login a GCP project account, you can # use 'chromeos-factory'. The deploy script will choose the right GCP project # to deploy. deploy/cros_hwid_service.sh deploy staging
# In chroot: unittest make test # Out of chroot: integration test and e2e test # - Integration test creates a docker image, which may take a long time for the # first time running this script. # - e2e test list is placed at go/factory-private-git deploy/cros_hwid_service.sh test
prod
:deploy/cros_hwid_service.sh deploy prod
Example request for local environment:
# Before invoking local API, you have to deploy local env deploy/cros_hwid_service.sh deploy local # Now you can test HWID Service locally. curl http://localhost:8080/_ah/api/chromeoshwid/v1/boards curl --data '{ "hwidConfigContents": "\n\nchecksum: test\n\n" }' \ --dump-header - http://localhost:8080/_ah/api/chromeoshwid/v1/validateConfig
Example request for staging/prod environment, using HWID CHROMEBOOK B2A-M5N
:
curl "${ENDPOINT_URL}/bom/CHROMEBOOK%20B2A-M5N?key=${APIKEY}"
Where ${APIKEY} can be created from AppEngine Management Page -> APIs & Services -> Credentials.
cros_sdk make -C ../platform/factory test # factory unittests ./deploy.sh test # integration tests and e2e tests
To view the logs, you have to go to AppEngine Management Page -> Versions -> Diagnose -> Logs
The ingestion pipeline helps AppEngine get access to the HWID Database on Gerrit, there are two stages of the pipeline.
[bucket]/staging
every day. (code: https://go/chromeos-hwid-ingestion)[bucket]/staging
. If the file is validated, move the file from [bucket]/staging
to [bucket]/live
.The borgcron job is to periodically(every 24h) upload the latest HWID Database from git(via git/gerrit-on-borg) to the cloud buckets. Since it is a borgcron job, we don't port this part to the factory repository. To modify the code and deploy, please refers to http://go/hwid-server-arch -> Run & deploy -> Deploying the borgcron job.
APIary publishes chromeoshwid API from AppEngine to google domain. The APIary configuration file is stored in the google3. To change the config, please refers to https://go/hwid-server-arch -> Run & deploy -> Changing the Apiary Configuration.