Skip to main content

A Slack bot that understands the Emojirades game!

Project description

emojirades

Slack bot that understands the emojirades game and handles score keeping

Build Status PyPI version

Installation Guide

# Preferably run on a virtualenv

Install the dependencies

pip3 install --upgrade pip wheel

pip3 install -r requirements.txt --upgrade

# If you're developing locally
pip3 install -r test_requirements.txt --upgrade

Install the module ( For Dev )

cd emojirades
pip3 install -e .

Run the tests

black .
pytest

Set environment variables

If you're using the built in AWS functionality to persist your data, you'll need to set the appropriate AWS_ environment variables.

Run the daemon for a single workspace

This command uses locally stored files to keep the game state:

emojirades single --score-file scores.csv --state-file state.json --auth-file auth.json

This command uses S3 stored files to keep the game state:

`emojirades single --score-file s3://bucket/scores.csv --state-file s3://bucket/state.json --auth-file s3://bucket/auth.json

Run the daemon for multiple workspaces

Here we provide a local folder of workspaces and an optional set of workspace ids (will load all in folder by default):

emojirades mulitple --workspaces-dir path/to/workspaces [--workspace-id A1B2C3D4E]

Here we provide an S3 path of workspaces and an optional set of workspace ids (will load all in folder by default):

emojirades multiple --workspaces-dir s3://bucket/path/to/workspaces [--workspace-id A1B2C3D4E]

Here we provide an S3 path of workspaces and an AWS SQS queue to listen to for new workspaces:

emojirades multiple --workspaces-dir s3://bucket/path/to/workspaces --onboarding-queue workspace-onboarding-queue

The workspaces directory must be in the following format (local or s3):

./workspaces

./workspaces/shards
./workspaces/shards/0
./workspaces/shards/0/A1B2C3D4E.json
./workspaces/shards/0/Z9Y8X7W6V.json

./workspaces/directory
./workspaces/directory/A1B2C3D4E
./workspaces/directory/A1B2C3D4E/state.json
./workspaces/directory/A1B2C3D4E/scores.json
./workspaces/directory/A1B2C3D4E/auth.json
./workspaces/directory/Z9Y8X7W6V
./workspaces/directory/Z9Y8X7W6V/state.json
./workspaces/directory/Z9Y8X7W6V/scores.json
./workspaces/directory/Z9Y8X7W6V/auth.json

The concept above with the two different directories is shards to allow for the bot to scale out horizontally. As the bot(s) get busier, the operator can increase the shard (bot instance) count and new onboarded workspaces are allocated to the next available shard with capacity.

The emojirades bot will take care of running multiple games across different channels in a single workspace.

Service configuration

cp emojirades.service /etc/systemd/system/
sudo chmod 0664 /etc/systemd/system/emojirades.service

# Edit the /etc/systemd/system/emojirades.service file and update the user and group

cp emojirades.config /etc/emojirades
sudo chmod 0400 /etc/emojirades

# Edit the /etc/emojirades config file with your configuration for the bot

sudo systemctl daemon-reload
sudo systemctl enable emojirades
sudo systemctl start emojirades

Release process (for master branch)

  1. Create release branch containing new version in setup.py and Dockerfile
  2. Perform a PR into master
  3. Perform release in GitHub
  4. TravisCI will automatically build and deploy on a tagged commit into master (the release does this)
  5. Docker Hub will automatically build and deploy on a tagged commit into master (the release does this)

Building the Container Image

docker build --pull --no-cache -t emojirades/emojirades:X.Y.Z -t emojirades/emojirades:latest .

Running the Container

In this example we run the game with S3 hosted configuration for a single workspace.

docker run -d \
  --name emojirades \
  --restart=always \
  -v "/path/to/your/.aws/:/root/.aws/:ro" \
  -e "AWS_PROFILE=emojirades" \
  emojirades/emojirades:X.Y.Z \
    --score-file s3://bucket/path/to/scores.json \
    --state-file s3://bucket/path/to/state.json \
    --auth-file s3://bucket/path/to/auth.json \
    -vv

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Emojirades-0.13.3.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

Emojirades-0.13.3-py3-none-any.whl (45.1 kB view details)

Uploaded Python 3

File details

Details for the file Emojirades-0.13.3.tar.gz.

File metadata

  • Download URL: Emojirades-0.13.3.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.3

File hashes

Hashes for Emojirades-0.13.3.tar.gz
Algorithm Hash digest
SHA256 67ec5743d9dc53604bb96d8c9f8ab0c6f658dd7561c57e6150e201c92c968f7f
MD5 8293549c7c7c709c66c1388385bbe442
BLAKE2b-256 d3ba8a42553d17c7e362b65f9dbb61027ca793bd2c7f0ec8e35b7c59fa600121

See more details on using hashes here.

File details

Details for the file Emojirades-0.13.3-py3-none-any.whl.

File metadata

  • Download URL: Emojirades-0.13.3-py3-none-any.whl
  • Upload date:
  • Size: 45.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.3

File hashes

Hashes for Emojirades-0.13.3-py3-none-any.whl
Algorithm Hash digest
SHA256 839fec5ef5a964b64dcc2ba45673f46b1e81647ddbbd90b3ab4a8d72ae24790f
MD5 c6c40b9e2a805f6d42a5df1574d132a2
BLAKE2b-256 6c123fdc48afa97d5b3f9142c84d436f0dbadb2b6e71ebad3633d281676f2b5f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page