Docker Support

This commit is contained in:
Alex Orid 2021-05-07 16:35:43 -04:00
parent 373c398306
commit d78e6bc7b4
6 changed files with 65 additions and 3 deletions

View File

@ -0,0 +1,11 @@
FROM python:3.10.0a7-alpine3.13
WORKDIR /Praxis
COPY requirements_sa_command.txt requirements_sa_command.txt
RUN apk add --update gcc libc-dev linux-headers && rm -rf /var/cache/apk/*
RUN pip3 install -r requirements_sa_command.txt
COPY . .
CMD [ "python3", "standalone_eventLog.py"]

View File

@ -1,5 +1,13 @@
version: '3.7'
services:
standalone_eventlog:
image: standalone_eventlog
volumes:
- "./:/Praxis/"
ports:
- 42008:42008
environment:
- ISDOCKER=cat
standalone_command:
image: standalone_command
volumes:

View File

@ -1,3 +1,4 @@
docker build --file Dockerfile_standalone_eventlog.Dockerfile --tag standalone_eventlog .
docker build --file Dockerfile_standalone_command.Dockerfile --tag standalone_command .
docker build --file Dockerfile_standalone_channelRewards.Dockerfile --tag standalone_channelrewards .
docker build --file Dockerfile_standalone_lights.Dockerfile --tag standalone_lights .

View File

@ -203,6 +203,27 @@ class Discord_Module(discord.Client):
#tts.tts(text_to_say)
#FINISH THIS EVENT LOG
async def send_EventLog(self, eventName, eventTime, eventType, eventData):
params = urlencode(
{'event_name': eventName,
'event_time': eventTime,
'event_type': eventType,
'event_data': eventData})
url = "http://standalone_eventlog:42008/api/v1/event_log/add_event?%s" % params
resp = requests.get(url)
if resp.status_code == 200:
print("Got the following message: %s" % resp.text)
data = loads(resp.text)
msg = data['message']
if msg is not None:
return msg
# todo send to logger and other relevent services
else:
# todo handle failed requests
pass

View File

@ -199,6 +199,27 @@ class Twitch_Pubsub():
# todo handle failed requests
pass
#FINISH THIS EVENT LOG
def send_EventLog(self, eventName, eventTime, eventType, eventData):
params = urlencode(
{'event_name': eventName,
'event_time': eventTime,
'event_type': eventType,
'event_data': eventData})
url = "http://standalone_eventlog:42008/api/v1/event_log/add_event?%s" % params
resp = requests.get(url)
if resp.status_code == 200:
print("Got the following message: %s" % resp.text)
data = loads(resp.text)
msg = data['message']
if msg is not None:
return msg
# todo send to logger and other relevent services
else:
# todo handle failed requests
pass
if __name__ == "__main__":
testModule = Twitch_Pubsub()

View File

@ -92,7 +92,7 @@ class Twitch_Module():
def is_command(self, word: str) -> bool:
# todo need to url-escape word
clean_param = urlencode({'name': word})
url = "http://localhost:42010/api/v1/command?%s" % clean_param
url = "http://standalone_command:42010/api/v1/command?%s" % clean_param
resp = requests.get(url)
return resp.status_code == 200
@ -105,7 +105,7 @@ class Twitch_Module():
'rest': rest,
'bonus_data': realMessage})
#standalone_command
url = "http://localhost:42010/api/v1/exec_command?%s" % params
url = "http://standalone_command:42010/api/v1/exec_command?%s" % params
resp = requests.get(url)
if resp.status_code == 200:
print("Got the following message: %s" % resp.text)
@ -144,7 +144,7 @@ class Twitch_Module():
'event_time': eventTime,
'event_type': eventType,
'event_data': rest})
url = "http://localhost:42008/api/v1/event_log/add_event?%s" % params
url = "http://standalone_eventlog:42008/api/v1/event_log/add_event?%s" % params
resp = requests.get(url)
if resp.status_code == 200: