Skip to content
KalanyuZ edited this page May 18, 2021 · 3 revisions

Before you proceed

This project is intended for personal use only. Please carefully review the source code before running it on any service. Unattended usage or exposing your api keys and secrets to 3rd party could result in loss of funds. We are not responsible for any consequences occurred from using/running this source code. Use it at your own risk.

How to prepare a docker image before deploying to GCP

Build an image

gcloud auth configure-docker
docker build . [TAG_NAMES]

Push the image to Google Cloud Image Repository

docker push [IMAGE_NAME] --all-tags

Running the image

when receiving indicator signals from 3rd party services

gcloud run deploy [SERVICE_NAME] --image=[IMAGE_NAME]:[TAG] \
          --concurrency=1 --max-instances=1 --timeout=60 --region=us-central1 --memory=128Mi --port=8080 \
          --set-env-vars=GUARD=[GUARD],EXCHANGE=[EXCHANGE],CONFIGFILE=[CONFIGFILE] \
          --allow-unauthenticated
          --platform=managed

when receiving commands from Cloud Scheduler

# don't forget to configure IAM for the scheduler so that it can invoke the service
gcloud run deploy [SERVICE_NAME] --image=[IMAGE_NAME]:[TAG] \
          --concurrency=1 --max-instances=1 --timeout=60 --region=us-central1 --memory=128Mi --port=8080 \
          --set-env-vars=GUARD=[GUARD],EXCHANGE=[EXCHANGE],CONFIGFILE=[CONFIGFILE] \
          --no-allow-unauthenticated
          --platform=managed