Rig up chat to be suitable for a Doge election. (Hopefully.) (#692)
* Integrate chat from upstream Substantially borrowed from upstream ref: 13a208ee88e55 (before they started editing generated artefacts instead of source). Integrated, including: - Remove previously removed features: emoji, hats, and name colors - Compensate for lack of unified root template - Add React build process to Dockerfile and `bootstrap/init.sh` - Preliminary integration of chat websocket workers For testing, modify `supervisord.conf.dev` to put chat on port 80 and the site service on some other port. Then visit: http://localhost/chat Still to do: - Access control for specific small-groups (and admins probably): Set the values somewhere (site_settings.json? Redis?) and use for authorization in `chat_is_allowed`. - Proxying only /chat to the websocket workers - Chat persistance across restarts: either Redis devops or to DB * Add nginx server to do appropriate redirection. * Add necessary columns to User. * Wire up chat permissions. * Reload chat on source change. * Add a better structure for slash commands and add/remove functionality. * Stop putting up previews of slash commands. * We require more whitespace. * Strip DMs out entirely, I currently do not want to deal with them. * Change "Users Online" to just "Users". * Clean up a little more DM detritus. * Save chat history in database. * Remove unnecessary hefty query to the DB. * Clean up optimistic messages. * Initial implementation of notification icon. * Update readme a little bit. * Fix notification highlight (mostly). * Remove chat version number that will never be updated. * Fix: Errors on logged-out users. * Add function to nuke the chat state. * Update DB. * Add a dedicated deployable docker image. * Fix: init_build.sh execute bit not set. * Whoops, screwed up the abort() call. * Relax chat rate limiter. * Remove a somewhat silly comment. * Remove an unnecessary g.db.add(). --------- Co-authored-by: TLSM <duolsm@outlook.com>
This commit is contained in:
parent
7032d0680d
commit
310c6c4424
62 changed files with 3018 additions and 435 deletions
49
Dockerfile
49
Dockerfile
|
@ -23,8 +23,23 @@ CMD [ "bootstrap/init.sh" ]
|
|||
|
||||
|
||||
###################################################################
|
||||
# Release container
|
||||
FROM base AS release
|
||||
# Environment capable of building React files
|
||||
FROM base AS build
|
||||
|
||||
# Chat compilation framework
|
||||
ENV NODE_VERSION=16.13.0
|
||||
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
|
||||
ENV NVM_DIRECTORY=/root/.nvm
|
||||
RUN . "$NVM_DIRECTORY/nvm.sh" && nvm install ${NODE_VERSION}
|
||||
RUN . "$NVM_DIRECTORY/nvm.sh" && nvm use v${NODE_VERSION}
|
||||
RUN . "$NVM_DIRECTORY/nvm.sh" && nvm alias default v${NODE_VERSION}
|
||||
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
|
||||
RUN npm i -g yarn
|
||||
|
||||
|
||||
###################################################################
|
||||
# Release-mimicking environment
|
||||
FROM build AS release
|
||||
|
||||
RUN poetry install --without dev
|
||||
|
||||
|
@ -32,8 +47,8 @@ COPY bootstrap/supervisord.conf.release /etc/supervisord.conf
|
|||
|
||||
|
||||
###################################################################
|
||||
# Dev container
|
||||
FROM release AS dev
|
||||
# Dev environment
|
||||
FROM build AS dev
|
||||
|
||||
RUN poetry install --with dev
|
||||
|
||||
|
@ -53,3 +68,29 @@ CMD sleep infinity
|
|||
|
||||
# Turn off the rate limiter
|
||||
ENV DBG_LIMITER_DISABLED=true
|
||||
|
||||
|
||||
###################################################################
|
||||
# Deployable standalone image
|
||||
|
||||
# First, use the `build` container to actually build stuff
|
||||
FROM build AS build_built
|
||||
COPY . /service
|
||||
RUN bootstrap/init_build.sh
|
||||
|
||||
# Now assemble our final container
|
||||
# Gotta start from base again so we don't pick up the Node framework
|
||||
FROM base AS deploy
|
||||
|
||||
RUN poetry install --without dev
|
||||
COPY bootstrap/supervisord.conf.release /etc/supervisord.conf
|
||||
|
||||
# All the base files
|
||||
COPY . /service
|
||||
|
||||
# Our built React files
|
||||
COPY --from=build_built /service/files/assets/css/chat_done.css files/assets/css/chat_done.css
|
||||
COPY --from=build_built /service/files/assets/js/chat_done.js files/assets/js/chat_done.js
|
||||
|
||||
# Flag telling us not to try rebuilding React
|
||||
RUN touch prebuilt.flag
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue