https://github.com/jzwood/scrabble-oracle-api
API for Scrabble Oracle app (Server)
https://github.com/jzwood/scrabble-oracle-api
ai bot docker haskell scrabble
Last synced: 2 months ago
JSON representation
API for Scrabble Oracle app (Server)
- Host: GitHub
- URL: https://github.com/jzwood/scrabble-oracle-api
- Owner: jzwood
- License: mit
- Created: 2020-10-10T23:31:35.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-23T14:41:15.000Z (over 5 years ago)
- Last Synced: 2026-03-06T08:39:53.750Z (4 months ago)
- Topics: ai, bot, docker, haskell, scrabble
- Language: Haskell
- Homepage:
- Size: 754 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE
Awesome Lists containing this project
README
# Scrabble-Scotty Web App
API wrapper for [Scrabble AI](https://github.com/jzwood/ScrabbleOracle).
# local
```haskell
stack install
scrabble-scotty-app-exe
```
hit api via CURL or Postman:
```haskell
localhost:3000/ask-the-scrabble-oracle
body:
- board:
* 225 characters of scrabble board (left to right and top to bottom)
* uppercase
* empty space = '_'
- rack
* 7 characters of rack
* uppercase
- rcpt:
* recipient email address
```
# run locally
### outside docker
```
set -a
source app.env && source db.env
set +a
stack install
scrabble-scotty-app-exe
```
### with docker
### with docker-compose
# deploy
## Docker
### Build
`docker build -t "scrabble-scotty-app:Dockerfile" .`
or better
`docker build -t jzwood/scrabble-oracle-api:v0.0.0 .`
### Run
set the following environment variables
```
export MAIL_FROM=
export MAIL_APP_KEY=
export PRODUCTION=
```
`docker run -p 5000:3000 -it /bin/bash`
```
docker run -p 5000:3000 -e PORT=3000 \
-e MAIL_FROM= \
-e MAIL_APP_KEY= \
-e PRODUCTION=TRUE \
-it
```
or
`docker run -p 5000:3000 --env-file secrets -it `
you can now hit the api at `localhost:5000/board//rack/`
## Deploy to Heroku
either make a new app called "scrabble-oracle-api" in heroku web UI or via CLI: `$ heroku create -a scrabble-oracle-api`, then,
```
$ heroku container:login
$ heroku container:push web -a scrabble-oracle-api
$ heroku container:release web -a scrabble-oracle-api
```
Make sure to set the env variables defined in the `secrets` file.
check the logs:
```
$ heroku logs --app scrabble-oracle-api
```
**Postgres**
```
heroku pg:psql postgresql-flexible-80984 --app scrabble-oracle-api
```
## Publishing to docker hub (not required for deployment)
### update tag for remote repo
`docker tag scrabble-scotty-app:Dockerfile jzwood/scrabble-oracle-api:v0.0.0`
### publish
`docker push jzwood/scrabble-oracle-api:v0.0.0`
### PostgreSQL
```
docker-compose exec postgres bash
psql -U oracle scrabble-oracle-db
```