sequenceDiagram
autonumber
actor User
User ->> FormSG: Fill in Form
FormSG -->> User: Form Acknowledge
FormSG-->>Code: Encrypted form data
activate Code
Note over Code: Code decrypt FormSG data
Note over Code: Code updates internal DB
Code-->>Telegram: Send message
deactivate Code
Telegram -->> User: Notify users
Google Cloud Platform is recommended for its generous free tier.
- 2 million requests per month
- 360,000 GB-seconds of memory, 180,000 vCPU-seconds of compute time
- 1 GB of outbound data transfer from North America per month
- Ensure you have Docker installed
docker image build -t ims .
docker run -p 8080:8080 -d ims
- Navigate to localhost:8080.
- You should expect an "Online" response
- In the Google Cloud console, on the project selector page, create a Google Cloud project named
ims-project
. - Make sure that billing is enabled for your Google Cloud project.
- Install the Google Cloud CLI.
- To initialize the gcloud CLI, run the following command:
gcloud init
gcloud config set project ims-project
gcloud builds submit --tag gcr.io/ims-project/ims-image
-
gcloud run deploy ims-instance \ --image gcr.io/ims-project/ims-image \ --platform managed --region "us-west1" \ --allow-unauthenticated \ --update-env-vars BOT_API_KEY=<YOUR_BOT_API_KEY>,MY_CHANNEL_NAME=<YOUR_CHANNEL_ID>,SECRET_KEY=<YOUR_FORMSG_SECRET_KEY>
- When the command completes, you should see something like:
-
Service [ims-instance] revision [ims-instance-00001] has been deployed and is serving traffic at https://sample-flask-example-x5yqob7qaq-uc.a.run.app
-
- Make a note of the endpoint in the message. Open a new browser and enter the URL. Expect an "Online" response.
- Using this URL, edit your FormSG webhook to point to this URL.
- If you did not manage to include the environment variables during deployment, you can change it in
service.yaml
and rungcloud run services replace service.yaml
.
- When the command completes, you should see something like: