Docker Support
This commit is contained in:
parent
373c398306
commit
d78e6bc7b4
11
Dockerfile_standalone_eventlog.Dockerfile
Normal file
11
Dockerfile_standalone_eventlog.Dockerfile
Normal 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"]
|
||||||
@ -1,5 +1,13 @@
|
|||||||
version: '3.7'
|
version: '3.7'
|
||||||
services:
|
services:
|
||||||
|
standalone_eventlog:
|
||||||
|
image: standalone_eventlog
|
||||||
|
volumes:
|
||||||
|
- "./:/Praxis/"
|
||||||
|
ports:
|
||||||
|
- 42008:42008
|
||||||
|
environment:
|
||||||
|
- ISDOCKER=cat
|
||||||
standalone_command:
|
standalone_command:
|
||||||
image: standalone_command
|
image: standalone_command
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@ -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_command.Dockerfile --tag standalone_command .
|
||||||
docker build --file Dockerfile_standalone_channelRewards.Dockerfile --tag standalone_channelrewards .
|
docker build --file Dockerfile_standalone_channelRewards.Dockerfile --tag standalone_channelrewards .
|
||||||
docker build --file Dockerfile_standalone_lights.Dockerfile --tag standalone_lights .
|
docker build --file Dockerfile_standalone_lights.Dockerfile --tag standalone_lights .
|
||||||
|
|||||||
@ -203,6 +203,27 @@ class Discord_Module(discord.Client):
|
|||||||
|
|
||||||
#tts.tts(text_to_say)
|
#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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -199,6 +199,27 @@ class Twitch_Pubsub():
|
|||||||
# todo handle failed requests
|
# todo handle failed requests
|
||||||
pass
|
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__":
|
if __name__ == "__main__":
|
||||||
testModule = Twitch_Pubsub()
|
testModule = Twitch_Pubsub()
|
||||||
|
|
||||||
|
|||||||
@ -92,7 +92,7 @@ class Twitch_Module():
|
|||||||
def is_command(self, word: str) -> bool:
|
def is_command(self, word: str) -> bool:
|
||||||
# todo need to url-escape word
|
# todo need to url-escape word
|
||||||
clean_param = urlencode({'name': 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)
|
resp = requests.get(url)
|
||||||
return resp.status_code == 200
|
return resp.status_code == 200
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ class Twitch_Module():
|
|||||||
'rest': rest,
|
'rest': rest,
|
||||||
'bonus_data': realMessage})
|
'bonus_data': realMessage})
|
||||||
#standalone_command
|
#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)
|
resp = requests.get(url)
|
||||||
if resp.status_code == 200:
|
if resp.status_code == 200:
|
||||||
print("Got the following message: %s" % resp.text)
|
print("Got the following message: %s" % resp.text)
|
||||||
@ -144,7 +144,7 @@ class Twitch_Module():
|
|||||||
'event_time': eventTime,
|
'event_time': eventTime,
|
||||||
'event_type': eventType,
|
'event_type': eventType,
|
||||||
'event_data': rest})
|
'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)
|
resp = requests.get(url)
|
||||||
|
|
||||||
if resp.status_code == 200:
|
if resp.status_code == 200:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user