Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/johnpertoft/text-to-image-slack-bot


https://github.com/johnpertoft/text-to-image-slack-bot

generative-art slack-bot stable-diffusion

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

# Text to Image Slack Bot (Stable-diffusion)

![Lint status](https://github.com/johnPertoft/text-to-image-slack-bot/actions/workflows/lint.yaml/badge.svg?branch=main)
![Test status](https://github.com/johnPertoft/text-to-image-slack-bot//actions/workflows/test.yaml/badge.svg?branch=main)

**Slack application home**: https://api.slack.com/apps/A03U9439A5U/

## Setup

Click to expand

### Local environment secrets
Put secrets in `.envrc`, they will be automatically loaded by `direnv`.

### Create secrets
```bash
gcloud secrets create john-test-slack-bot-token
gcloud secrets create john-test-slack-signing-secret
```

### Update secret versions
```bash
echo -n $SLACK_BOT_TOKEN | gcloud secrets versions add john-test-slack-bot-token --data-file=-
echo -n $SLACK_SIGNING_SECRET | gcloud secrets versions add john-test-slack-signing-secret --data-file=-
```

### Allow default service account to access secrets
```bash
gcloud secrets add-iam-policy-binding john-test-slack-bot-token \
--role roles/secretmanager.secretAccessor \
--member serviceAccount:[email protected]

gcloud secrets add-iam-policy-binding john-test-slack-signing-secret \
--role roles/secretmanager.secretAccessor \
--member serviceAccount:[email protected]
```

## How to run locally

Click to expand

1. ```bash
python -m src.app
```
2. ```bash
# ngrok config add-authtoken

ngrok http 3000
```
3. Update request url for event subscription: https://api.slack.com/apps/A03U9439A5U/event-subscriptions?

## Deploying
Currently the app is deployed by
- Building and pushing the new image to gcr, just run `./deploy.sh` in the project root
- Manually deleting the pod to have it automatically restart and use the new image