Skip to content

Commit

Permalink
Merge pull request #94 from somakeit/develop
Browse files Browse the repository at this point in the history
V 1.0.0 - State space API and smibhid
  • Loading branch information
sjefferson99 authored May 15, 2024
2 parents cc0dc1a + dc4c755 commit 0fd0167
Show file tree
Hide file tree
Showing 63 changed files with 3,192 additions and 474 deletions.
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
syntax: glob
.idea/
.idea/
*.pyc
**/__pycache__/
smib/log/
.vscode/
.micropico
*.pyi
.env
/package-lock.json
/node_modules/
25 changes: 25 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# How to contribute
## Read the documentation
Ensure you have read any appropriate documentation for using or developing S.M.I.B. in the [readme](https://github.com/somakeit/S.M.I.B./blob/develop/README.md)

## Bugs
Open our [issue tracker](https://github.com/somakeit/S.M.I.B./issues) and create a new issue giving us much detail about the bug as possible, how to recreate it, what outcome you expected vs what outcome you got. You can label this issue with the "bug" label.

## Enhancement ideas
If you have a new idea, create an [issue](https://github.com/somakeit/S.M.I.B./issues) with details of what you would like to see and why it would be helpful and tag the issue with the "enhancement" label.

## Writing patches
If you would like to contribute some code back to the project you are welcome to make a pull request. Ensure an issue exists for your proposed patch and drop a comment in there to let us know you are working on it. Create a fork of the repository, create a new branch for your patch and use that branch to raise a pull request. See the [github documentation](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) for more information.

### Code conventions
In general we follow [pep8 guidelines](https://peps.python.org/pep-0008/).

Code should be clear in its intent with minimal comments, ensure you use helpful variable and function names and keep functions and methods simple in their scope. More well named simple functions are better than monolithic complex functions with short and cryptic names.

A code update should almost always trigger an update or creation of new documentation; Ensure associated documentation is updated whenver possible with new code patches.

### Tests
We haven't got tests yet, but if we do it will be pytest, feel free to provide pytetss for your patch.

### Pull request approval
Pull requests will be reviewed by repo admins (code club) at SoMakeIt and providing at least one repo admin approves a review, the code can be merged into the develop branch ahead of a release into master (and production environment) once fully tested.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## Docker deployment
### Installation
- Clone the repository to your target server host
- Install docker if not already present
- Set the slack tokens and DB Web UI Credentials as environment variables using either method below:
- Linux
- `export SLACK_APP_TOKEN=<app-token>`
- `export SLACK_BOT_TOKEN=<bot-token>`
- `export ME_CONFIG_BASICAUTH_USERNAME=<mongo-express-basicauth-username>`
- `export ME_CONFIG_BASICAUTH_PASSWORD=<mongo-express-basicauth-password>`
- .env File
- Create a file called `.env` alongside the docker-compose.yml file (see `template.env` in the repo)
- Issue one of the following commands:
- Local Build: `docker compose up -d --build`
- Develop Branch Build: `docker compose -f docker-compose-develop.yml up -d --build`
- Master Branch Build: `docker compose -f docker-compose-master.yml up -d --build`


### Configuration
The host ports mapped for the slack server and webserver should be configured in the docker compose file, however it is also possible to override the ports in the server configs directly if you are not using docker.

## SMIBHID
[SMIBHID](smibhid/README.md) is the So Make It Bot Human Interface Device and definitely not a mispronunciation of any insults from a popular 90s documentary detailing the activites of the Jupiter Mining Core.

This device run on a Raspberry Pi Pico W and provides physical input and output to humans for the SMIB project; Buttons, LEDs, that sort of thing.

Further documentation can be found [in the smibhid folder](smibhid/).

## Legacy SMIB Commands
Currently, the old [SMIB Commands](https://github.com/somakeit/smib-commands) do not work with the new SMIB.

The old [SMIB](https://github.com/somakeit/smib) worked using the Slack RTM api. This API has been replaced with the Events API.

Previously, SMIB Commands were created as the only way to interact with SMIB.

I think some form of backwards compatibility or similar functionality would be good. Work on a `ShellPluginLoader` was started but parked as it was not the main focus of the new amped up SMIB [MVP](https://en.wikipedia.org/wiki/Minimum_viable_product)

An [issue](https://github.com/somakeit/S.M.I.B./issues/83) has been created to track the progress and gather ideas.


Binary file added assets/so-make-it-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions docker-compose-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
services:
smib-slack:
container_name: smib-slack
build:
context: https://github.com/somakeit/S.M.I.B..git#develop
dockerfile: smib-fast.Dockerfile
ports:
- "4123:4123"
depends_on:
- smib-db
environment:
- WEBSERVER_HOST=smib-webserver
- WEBSOCKET_ALLOWED_HOSTS=smib-webserver,smib-webserver.smib-bridge-network
- MONGO_DB_HOST=smib-db

# Passed in from HOST
- SLACK_APP_TOKEN
- SLACK_BOT_TOKEN
networks:
- smib-bridge-network
command: "python -m smib.slack"

smib-webserver:
container_name: smib-webserver
build:
context: https://github.com/somakeit/S.M.I.B..git#develop
dockerfile: smib-fast.Dockerfile
ports:
- "80:80"
depends_on:
- smib-slack
environment:
- WEBSOCKET_HOST=smib-slack

# Passed in from HOST
- SLACK_APP_TOKEN
- SLACK_BOT_TOKEN
networks:
- smib-bridge-network
command: "python -m smib.webserver"

smib-db:

# Specific version - latest that works on a pi
image: mongo:4.4.18
container_name: smib-db
restart: always
ports:
- 27017:27017
networks:
- smib-bridge-network

smib-db-ui:
image: mongo-express
container_name: smib-db-ui
depends_on:
- smib-db
restart: always
ports:
- 8082:8081
environment:
ME_CONFIG_MONGODB_URL: mongodb://smib-db:27017/
ME_CONFIG_BASICAUTH: true

networks:
- smib-bridge-network

networks:
smib-bridge-network:
name: smib-bridge-network
driver: bridge
71 changes: 71 additions & 0 deletions docker-compose-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
services:
smib-slack:
container_name: smib-slack
build:
context: https://github.com/somakeit/S.M.I.B..git#master
dockerfile: smib-fast.Dockerfile
ports:
- "4123:4123"
depends_on:
- smib-db
environment:
- WEBSERVER_HOST=smib-webserver
- WEBSOCKET_ALLOWED_HOSTS=smib-webserver,smib-webserver.smib-bridge-network
- MONGO_DB_HOST=smib-db

# Passed in from HOST
- SLACK_APP_TOKEN
- SLACK_BOT_TOKEN
networks:
- smib-bridge-network
command: "python -m smib.slack"

smib-webserver:
container_name: smib-webserver
build:
context: https://github.com/somakeit/S.M.I.B..git#master
dockerfile: smib-fast.Dockerfile
ports:
- "80:80"
depends_on:
- smib-slack
environment:
- WEBSOCKET_HOST=smib-slack

# Passed in from HOST
- SLACK_APP_TOKEN
- SLACK_BOT_TOKEN
networks:
- smib-bridge-network
command: "python -m smib.webserver"

smib-db:

# Specific version - latest that works on a pi
image: mongo:4.4.18
container_name: smib-db
restart: always
ports:
- 27017:27017
networks:
- smib-bridge-network

smib-db-ui:
image: mongo-express
container_name: smib-db-ui
depends_on:
- smib-db
restart: always
ports:
- 8082:8081
environment:
ME_CONFIG_MONGODB_URL: mongodb://smib-db:27017/
ME_CONFIG_BASICAUTH: true

networks:
- smib-bridge-network

networks:
smib-bridge-network:
name: smib-bridge-network
driver: bridge
72 changes: 72 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
services:
smib-slack:
container_name: smib-slack
build:
context: .
dockerfile: smib-fast.Dockerfile
ports:
- "4123:4123"
depends_on:
- smib-db
environment:
- WEBSERVER_HOST=smib-webserver
- WEBSOCKET_ALLOWED_HOSTS=smib-webserver,smib-webserver.smib-bridge-network
- MONGO_DB_HOST=smib-db

# Passed in from HOST
- SLACK_APP_TOKEN
- SLACK_BOT_TOKEN
networks:
- smib-bridge-network
command: "python -m smib.slack"

smib-webserver:
container_name: smib-webserver
build:
context: .
dockerfile: smib-fast.Dockerfile
ports:
- "80:80"
depends_on:
- smib-slack
environment:
- WEBSOCKET_HOST=smib-slack

networks:
- smib-bridge-network
command: "python -m smib.webserver"

smib-db:

# Specific version - latest that works on a pi
image: mongo:4.4.18
container_name: smib-db
restart: always
ports:
- 27017:27017
networks:
- smib-bridge-network

smib-db-ui:
image: mongo-express
container_name: smib-db-ui
depends_on:
- smib-db
restart: always
ports:
- 8082:8081
environment:
ME_CONFIG_MONGODB_URL: mongodb://smib-db:27017/
ME_CONFIG_BASICAUTH: true
ME_CONFIG_OPTIONS_READONLY: true

ME_CONFIG_BASICAUTH_USERNAME:
ME_CONFIG_BASICAUTH_PASSWORD:

networks:
- smib-bridge-network

networks:
smib-bridge-network:
name: smib-bridge-network
driver: bridge
26 changes: 26 additions & 0 deletions manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
display_information:
name: S.M.I.B.
description: So Make It BOT
background_color: "#005056"
features:
app_home:
home_tab_enabled: true
messages_tab_enabled: false
messages_tab_read_only_enabled: false
bot_user:
display_name: SMIB
always_online: true
oauth_config:
scopes:
bot:
- chat:write
- chat:write.public
settings:
event_subscriptions:
bot_events:
- app_home_opened
interactivity:
is_enabled: true
org_deploy_enabled: false
socket_mode_enabled: true
token_rotation_enabled: false
Loading

0 comments on commit 0fd0167

Please sign in to comment.