Chat rework deployment infra fixes.

master
Snakes 2022-09-24 00:26:44 -04:00
parent 9242269bac
commit 1fe02b7743
Signed by: Snakes
GPG Key ID: E745A82778055C7E
5 changed files with 26 additions and 18 deletions

8
.gitignore vendored
View File

@ -13,6 +13,12 @@ flask_session/
site_settings.json
/files/test.py
tags
# Chat environment
chat/node_modules
chat/build
chat/.env
chat/.env
# Chat artefacts
files/assets/css/chat_done.css
files/assets/js/chat_done.js

View File

@ -39,18 +39,6 @@ def chat(v):
return render_template("chat.html", v=v, messages=messages)
@app.get('/chat.js')
def chatjs():
resp = make_response(send_from_directory('assets', 'js/chat.js'))
return resp
@app.get('/chat_done.js')
def chatbuiltjs():
resp = make_response(send_from_directory('assets', 'js/chat_done.js'))
return resp
@socketio.on('speak')
@limiter.limit("3/second;10/minute")
@limiter.limit("3/second;10/minute", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
@ -161,4 +149,4 @@ def close_running_threads():
cache.set(f'{SITE}_chat', messages)
cache.set(f'{SITE}_total', total)
cache.set(f'{SITE}_muted', muted)
atexit.register(close_running_threads)
atexit.register(close_running_threads)

View File

@ -36,7 +36,7 @@
data-themecolor="{{v.themecolor}}">
</div>
<script>window.global = window</script>
<script defer src="/assets/js/lite-youtube.js?v=4000"></script>
<script defer src="/chat_done.js"></script>
<script defer src="{{asset('js/lite-youtube.js')}}"></script>
<script defer src="{{asset('js/chat_done.js')}}"></script>
</body>

View File

@ -2,6 +2,7 @@
set CACHE_VER = {
'css/main.css': 4036,
'css/catalog.css': 4007,
'css/4chan.css': 4007,
'css/classic.css': 4031,
'css/classic_dark.css': 4031,
@ -25,6 +26,7 @@ set CACHE_VER = {
'js/submission_listing.js': 4000,
'js/emoji_modal.js': 4004,
'js/formatting.js': 4000,
'js/lite-youtube.js': 4000,
'js/lottery.js': 4000,
'js/marked.js': 4006,
'js/search.js': 4000,
@ -33,6 +35,9 @@ set CACHE_VER = {
'js/userpage_v.js': 4002,
'js/lozad.js': 4000,
'js/sort_table.js': 4001,
'css/chat_done.css': 1001,
'js/chat_done.js': 1001,
}
-%}

View File

@ -1,5 +1,14 @@
#!/bin/bash
cd /rDrama
git pull
cd ./chat && yarn chat && cd ../
. /env
gunicorn files.__main__:app load_chat -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 -b 0.0.0.0:5001 --max-requests 30000 --max-requests-jitter 30000
PATH="${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}"
cd ./chat
yarn install
yarn chat
cd ..
gunicorn files.__main__:app load_chat -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 -b 0.0.0.0:5001 --max-requests 30000 --max-requests-jitter 30000