Member Counts is a Go-based application designed to fetch and process member data from Redash and send total member counts to a Google Chat using a Webhook.
- βοΈ Configuration
- π Deployment
- π§βπ» Usage
- π οΈ Tech Stack
- π Community
- π License
Environment variables are used to configure the application. They can be set in a .env
file placed in the project directory or directly in the environment:
REDASH_BASE_URL
: The base URL of your Redash instance.REDASH_API_KEY
: The API key for accessing the Redash API.REDASH_QUERY_ID
: The ID of the Redash query to fetch.GOOGLE_CHAT_WEBHOOK_URL
: The URL of the Google Chat Webhook.SENDGRID_API_KEY
: Your SendGrid API key.SENDER_EMAIL
: The From: address of the email.EMAIL_SUBJECT
: The Subject: of the email.RECIPIENT_EMAILS
: The comma-separated list of email recipients.SCHEDULE_HOUR
: The hour to trigger the action.SCHEDULE_MINUTE
: The minute to trigger the action.TIMEZONE
: Your timezone.
git clone https://github.com/RAHB-REALTORS-Association/member-counts-go.git
cd member-counts-go
go build
Before running, ensure that the environment variables are correctly set, either in your environment or in a .env
file in the project directory.
docker pull ghcr.io/rahb-realtors-association/member-counts-go:latest
docker run --env-file .env ghcr.io/rahb-realtors-association/member-counts-go:latest
Ensure that the .env
file containing the environment variables is present in the directory from which you are running the Docker command.
git clone https://github.com/RAHB-REALTORS-Association/member-counts-go.git
cd member-counts-go
docker build -t member-counts-go .
docker run --env-file .env member-counts-go
Again, ensure the .env
file is present in your project directory and contains the necessary environment variables before running the Docker image.
To run the application in a scheduled manner, use the following command:
./member-counts-go
Or, when using Docker:
docker run --env-file .env ghcr.io/rahb-realtors-association/member-counts-go:latest
In these scenarios, the application will remain idle until it reaches the specified hour and minute in your environment or .env
file. Once the specified time is hit, the application will:
- Refresh the specified Redash query.
- Fetch the newly generated data.
- Process the data to calculate the total member counts.
- Send this count to the specified Google Chat Webhook.
For FaaS environments or testing purposes, if you prefer to run the application immediately without waiting for the scheduled time, use the --now
flag:
./member-counts-go --now
Or, when using Docker:
docker run --env-file .env ghcr.io/rahb-realtors-association/member-counts-go:latest --now
With the --now
flag, the application bypasses the scheduler and executes the aforementioned steps immediately. This is especially useful for testing or when deploying in environments that are ephemeral, like certain FaaS platforms.
Before running the application in any environment, ensure that the environment variables are correctly set, either in your environment or in a .env
file in the project directory or the directory from which you are running the Docker command.
The technologies used in this project include:
- Go 1.17+ πΏ
- Redash API π
- Google Chat API π¬
Contributions to Member Counts are warmly welcomed. Please feel free to submit pull requests or open issues to discuss potential modifications or improvements. See our Code of Conduct for community guidelines.
Encountered a bug or have a feature suggestion? Please raise an issue on GitHub with relevant details.
This project is open sourced under the MIT license. See the LICENSE file for more info.