Skip to content

Commit

Permalink
[Player] Prefers Google Cloud for text-to-speech
Browse files Browse the repository at this point in the history
Uses OpenAI as a fallback, but Google Cloud has a free tier
* Adds GOOGLE_APPLICATION_CREDENTIALS environment variable
* Adds documentation for Google application service account credentials

References #70
  • Loading branch information
mikeyaworski committed Jun 21, 2024
1 parent 514d2ef commit 26e0ff2
Show file tree
Hide file tree
Showing 7 changed files with 938 additions and 188 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ DISCORD_BOT_CLIENT_ID=...
DISCORD_BOT_CLIENT_SECRET=...
DISCORD_BOT_TOKEN=...

GOOGLE_APPLICATION_CREDENTIALS=./.data/google-application-service-account.json

YOUTUBE_API_KEY=...
YOUTUBE_COOKIES="..."
SPOTIFY_CLIENT_ID=...
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ DISCORD_BOT_CLIENT_ID=...
DISCORD_BOT_CLIENT_SECRET=...
DISCORD_BOT_TOKEN=...
GOOGLE_APPLICATION_CREDENTIALS=./.data/google-application-service-account.json
YOUTUBE_API_KEY=...
YOUTUBE_COOKIES="..."
Expand Down Expand Up @@ -80,6 +82,12 @@ UI_ROOT=http://localhost:8080

If you are creating these environment variables for a cloud VM, make sure to change `ENVIRONMENT` to `production`, and replace `DATABASE_URL` with your production database URL (either the one from Heroku, or another service that you have set up).

If you are using text-to-speech or otherwise using Google Applications, create a service account and place the JSON file here:

```
.data/google-application-service-account.json
```

## Player Cookies

Cookies are messy. Right now, there are three possible libraries used for the player (each can fail, so there are fallbacks):
Expand Down
1 change: 1 addition & 0 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ services:
DISCORD_BOT_CLIENT_SECRET: ${DISCORD_BOT_CLIENT_SECRET}
DISCORD_BOT_TOKEN: ${DISCORD_BOT_TOKEN}
DATABASE_URL: ${DATABASE_URL}
GOOGLE_APPLICATION_CREDENTIALS: ${GOOGLE_APPLICATION_CREDENTIALS}
YOUTUBE_API_KEY: ${YOUTUBE_API_KEY}
YOUTUBE_COOKIES: ${YOUTUBE_COOKIES}
SPOTIFY_CLIENT_ID: ${SPOTIFY_CLIENT_ID}
Expand Down
5 changes: 5 additions & 0 deletions docs/DO-Instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ These instructions describe a process for manually hosting the bot on a Digital

You can use something like nano instead of vim if you struggle with the instructions above.

1. (Optional) If you are using text-to-speech or otherwise using Google Applications, create a service account and place the JSON file here:

```
.data/google-application-service-account.json
```
1. (Optional) If you want to expose your app to the outside world over HTTPS and a custom domain, then generate an SSL certificate and run the nginx server:
1. Create a DNS A Record for your domain, and point it to the public IP address of your Digital Ocean Droplet.
1. `npm run dhparam`
Expand Down
Loading

0 comments on commit 26e0ff2

Please sign in to comment.