This project implements a cron job using Google App Engine and Firestore. The cron job is scheduled to run every night at 00:00 GMT+7 (Asia/Jakarta) and resets some fields in user data stored in Firestore.
Cloud Computing
The cron job performs the following tasks:
- Connects to Firestore using the Google Cloud Firestore Go library.
- Queries the Firestore collection to identify user documents that need to be reset.
- Updates specific fields in the identified user documents to their default/reset values.
- Logs the execution of the cron job.
-
Make sure you have the following prerequisites installed:
- Go (version 1.20+)
- Google Cloud SDK (
gcloud
) command-line tool
-
Clone this repository and navigate to the project directory.
-
Set up your Google Cloud project:
- Create a new project in the Google Cloud Console.
- Enable the Firestore API for your project.
- Set up authentication and generate a service account key file for your project. Download the JSON key file and save it securely as serviceAccountKey.json in cloned project.
-
Replace configuration in
app.yaml
andcron.yaml
(if you want to) -
Update the code in
main.go
with the logic to reset the specific fields in user data according to your requirements (if you want to). -
Deploy the application to Google App Engine by running the following command:
gcloud app deploy
-
Wait until 00:00, and see the result
This project is licensed under the MIT License.