From 572817a006d39ae8977281ec24bc30d4e81985b1 Mon Sep 17 00:00:00 2001 From: Alex Orid Date: Mon, 3 May 2021 17:24:39 -0400 Subject: [PATCH] Updated Websources --- Dockerfile_standalone_websource.Dockerfile | 11 ++++ docker-compose.yaml | 8 +++ makedockerimages.bat | 1 + standalone_webSource.py | 67 ++++++++++++---------- 4 files changed, 56 insertions(+), 31 deletions(-) create mode 100644 Dockerfile_standalone_websource.Dockerfile diff --git a/Dockerfile_standalone_websource.Dockerfile b/Dockerfile_standalone_websource.Dockerfile new file mode 100644 index 0000000..4ebe018 --- /dev/null +++ b/Dockerfile_standalone_websource.Dockerfile @@ -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_websource.py"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index b99d496..c2f18d4 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -32,6 +32,14 @@ services: - 60809:60809 environment: - ISDOCKER=cat + standalone_websource: + image: standalone_websource + volumes: + - "./:/Praxis/" + ports: + - 5500:5500 + environment: + - ISDOCKER=cat standalone_twitchscript: image: standalone_twitchscript volumes: diff --git a/makedockerimages.bat b/makedockerimages.bat index 1fc4229..62863fd 100644 --- a/makedockerimages.bat +++ b/makedockerimages.bat @@ -2,6 +2,7 @@ docker build --file Dockerfile_standalone_command.Dockerfile --tag standalone_co 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_tts_core.Dockerfile --tag standalone_tts_core . +docker build --file Dockerfile_standalone_websource.Dockerfile --tag standalone_websource . docker build --file Dockerfile_standalone_DiscordScript.Dockerfile --tag standalone_discordscript . docker build --file Dockerfile_standalone_TwitchScript.Dockerfile --tag standalone_twitchscript . docker build --file Dockerfile_standalone_Twitch_Pubsub.Dockerfile --tag standalone_twitch_pubsub . \ No newline at end of file diff --git a/standalone_webSource.py b/standalone_webSource.py index 54a7dce..d7116d8 100644 --- a/standalone_webSource.py +++ b/standalone_webSource.py @@ -20,46 +20,51 @@ import utilities_script as utility import chyron_module -class webSource_Module(): - webSources:Flask = Flask('webSources') - def __init__(self): - super().__init__() - self.dbCredential: credentials.DB_Credential +api:Flask = Flask(__name__) +api.config["DEBUG"] = True - def main(self, port_=5000): - print("starting up on port: ", port_) - self.webSources.run(host="0.0.0.0", port= port_) - - @webSources.route('/') - def hello_world(): - return 'I can see your Ghost!' - - @webSources.route('/chyron') - def textSource_chyron(): - tempModule = chyron_module.Chyron_Module() - return tempModule.getChyronFile() - - @webSources.route('/temptext//') - def textSource_tempText(filename): - print("trying file: ", filename) - tempModule = tempText_Module.tempText_Module() - return tempModule.getTempTextFile(filename) +def init(): + print("starting up... ",) +@api.route('/') +def hello_world(): + return 'I can see your Ghost!' + +@api.route('/chyron') +def textSource_chyron(): + tempModule = chyron_module.Chyron_Module() + return tempModule.getChyronFile() + +@api.route('/text//') +def textSource_tempText(filename): + print("trying file: ", filename) + tempModule = tempText_Module.tempText_Module() + return tempModule.getTempTextFile(filename) + +@api.route('/timer//') +def textSource_timers(filename): + #print("trying file: ", filename) + #tempModule = tempText_Module.tempText_Module() + #tempModule.getTempTextFile(filename) + return "Coming Soon" if __name__ == "__main__": - testModule = webSource_Module() - testModule_2 = webSource_Module() - threads = [] + init() + api.run(host="0.0.0.0", port = 5500) + + + #testModule_2 = webSource_Module() + #threads = [] #credentials_manager = credentials.Credentials_Module() #credentials_manager.load_credentials() #testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname) - thread_ = threading.Thread(target=testModule.main(port_=5000)) - threads.append(thread_) - thread_.start() + #thread_ = threading.Thread(target=testModule.main(port_=6000)) + #threads.append(thread_) + #thread_.start() - for t in threads: - t.join() \ No newline at end of file + #for t in threads: + #t.join() \ No newline at end of file