Merge branch 'master' of github.com:Mintplex-Labs/vector-admin into change-frontend-tiktoken-import

This commit is contained in:
timothycarambat
2023-10-02 16:34:51 -07:00
6 changed files with 17 additions and 135 deletions
-3
View File
@@ -5,9 +5,6 @@ JWT_SECRET="your-random-string-here"
SYS_EMAIL="root@example.com"
SYS_PASSWORD="hunter2"
UID="1000"
GID="1000"
INNGEST_EVENT_KEY="background_workers"
INNGEST_SIGNING_KEY="random-string-goes-here"
INNGEST_LANDING_PAGE="true"
+12 -2
View File
@@ -11,8 +11,18 @@ Running VectorAdmin in Docker is the easily way to get a locally hosted option r
- `yarn dev:setup`
- `cd docker/`
- `cp .env.example .env` to create the `.env` file.
- Edit `.env` file and update the variables. **please** update `JWT_SECRET`,`SYS_PASSWORD`, and `INNGEST_SIGNING_KEY`.
- `docker-compose up -d --build` to build the image - this will take a few moments.
- Edit `.env` file and update the variables. **please** update `JWT_SECRET`,`SYS_PASSWORD`, and `INNGEST_SIGNING_KEY`
**Note** You must have a postgres DB running - the default ENV assumes a containerized PG instance running, but it can
be located anywhere (RDS, remote, local host machine). Failure to use a valid DB connection string prior to building
vector-admin will result in a build failure.
- `DATABASE_CONNECTION_STRING` should be a valid connection string. On boot the `vdbms` database will be created for the connection string.
**If running the included containerized Postgres DB**
Run this command first: `docker-compose up -d --build postgres`
**Boot up vector-admin**
- `docker-compose up -d --build vector-admin` to build the image - this will take a few moments.
Your docker host will show the image as online once the build process is completed. This will build the app to `http://localhost:3001`.
+3 -14
View File
@@ -2,8 +2,6 @@
FROM ubuntu:jammy-20230522 AS base
# Build arguments
ARG ARG_UID
ARG ARG_GID
ARG DATABASE_CONNECTION_STRING
# Install system dependencies
@@ -27,10 +25,8 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
dpkg-reconfigure -f noninteractive tzdata && \
python3 -m pip install --no-cache-dir virtualenv
# Create a group and user with specific UID and GID
RUN groupadd -g $ARG_GID anythingllm && \
useradd -u $ARG_UID -m -d /app -s /bin/bash -g anythingllm anythingllm && \
mkdir -p /app/frontend/ /app/backend/ /app/workers/ /app/document-processor/ && chown -R anythingllm:anythingllm /app
# Create folder struct
RUN mkdir -p /app/frontend/ /app/backend/ /app/workers/ /app/document-processor/
# Copy docker helper scripts
COPY ./docker/docker-entrypoint.sh /usr/local/bin/
@@ -40,9 +36,8 @@ COPY ./docker/docker-healthcheck.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
chmod +x /usr/local/bin/docker-healthcheck.sh
USER anythingllm
WORKDIR /app
USER root
# Install frontend dependencies
FROM base as frontend-deps
@@ -68,9 +63,6 @@ COPY --from=build-stage /app/frontend/dist ./backend/public
# Copy worker source files
COPY ./workers/ ./workers/
USER root
RUN chown -R anythingllm:anythingllm ./workers
USER anythingllm
# Install worker dependencies
RUN cd /app/workers && \
@@ -88,11 +80,8 @@ RUN cd /app/document-processor && \
pip install --no-cache-dir -r requirements.txt
# Reown files and init Prisma Client
USER root
RUN cd ./backend && DATABASE_CONNECTION_STRING=$DATABASE_CONNECTION_STRING npx prisma generate --schema=./prisma/schema.prisma
RUN cd ./backend && DATABASE_CONNECTION_STRING=$DATABASE_CONNECTION_STRING npx prisma migrate deploy --schema=./prisma/schema.prisma
RUN chown -R anythingllm:anythingllm ./backend/storage ./document-processor
USER anythingllm
# Setup the environment
ENV NODE_ENV=production
-112
View File
@@ -1,112 +0,0 @@
# Hey! Are you running Windows/WSL? You likely will have issues with the original Dockerfile which is built for *inx systems!
# So you should use this file instead by changing the `docker-compose.yml` to point at `DockerfileWSL` instead of the regular dockrfile.
# Setup base image
FROM ubuntu:jammy-20230522 AS base
# Build arguments
ARG ARG_UID
ARG ARG_GID
# Install system dependencies
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
curl libgfortran5 python3 python3-pip tzdata netcat \
libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 \
libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libx11-6 libx11-xcb1 libxcb1 \
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 \
libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release \
xdg-utils && \
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -yq --no-install-recommends nodejs && \
curl -LO https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn_1.22.19_all.deb \
&& dpkg -i yarn_1.22.19_all.deb \
&& rm yarn_1.22.19_all.deb && \
curl -LO https://github.com/jgm/pandoc/releases/download/3.1.3/pandoc-3.1.3-1-amd64.deb \
&& dpkg -i pandoc-3.1.3-1-amd64.deb \
&& rm pandoc-3.1.3-1-amd64.deb && \
rm -rf /var/lib/apt/lists/* /usr/share/icons && \
dpkg-reconfigure -f noninteractive tzdata && \
python3 -m pip install --no-cache-dir virtualenv
# Create a group and user with specific UID and GID
RUN groupadd -g $ARG_GID anythingllm && \
useradd -u $ARG_UID -m -d /app -s /bin/bash -g anythingllm anythingllm && \
mkdir -p /app/frontend/ /app/backend/ /app/workers/ /app/document-processor/ && chown -R anythingllm:anythingllm /app
# Copy docker helper scripts
COPY ./docker/docker-entrypoint.sh /usr/local/bin/
COPY ./docker/docker-healthcheck.sh /usr/local/bin/
# Ensure the scripts are executable
RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
chmod +x /usr/local/bin/docker-healthcheck.sh
USER root
WORKDIR /app
# Install frontend dependencies
FROM base as frontend-deps
COPY ./frontend/package.json ./frontend/yarn.lock ./frontend/
RUN chown -R anythingllm:anythingllm ./frontend
RUN cd ./frontend/ && yarn install && yarn cache clean
# Install server dependencies
FROM base as server-deps
COPY ./backend/package.json ./backend/yarn.lock ./backend/
RUN chown -R anythingllm:anythingllm ./backend
RUN cd ./backend/ && yarn install --production && yarn cache clean
# Build the frontend
FROM frontend-deps as build-stage
COPY ./frontend/ ./frontend/
RUN cd ./frontend/ && yarn build && yarn cache clean
# Setup the server
FROM server-deps as production-stage
COPY ./backend/ ./backend/
# Copy built static frontend files to the server public directory
COPY --from=build-stage /app/frontend/dist ./backend/public
# Copy worker source files
COPY ./workers/ ./workers/
RUN chown -R anythingllm:anythingllm ./workers
# Install worker dependencies
RUN cd /app/workers && \
yarn install --production && \
yarn cache clean && \
yarn add global inngest-cli
# # Copy the document-processor
COPY ./document-processor/ ./document-processor/
# # Install document-processor dependencies
RUN cd /app/document-processor && \
python3 -m virtualenv v-env && \
. v-env/bin/activate && \
pip install --no-cache-dir -r requirements.txt
# Create placeholder database files from .placeholderdb files in /storage.
USER root
COPY ./backend/storage/job_queue.placeholderdb ./backend/storage/job_queue.db
COPY ./backend/storage/vdbms.placeholderdb ./backend/storage/vdbms.db
# Force open files for docker on WSL :/
RUN chmod -R 777 ./backend ./document-processor
# Setup the environment
ENV NODE_ENV=production
ENV PATH=/app/document-processor/v-env/bin:$PATH
# Expose the server port
EXPOSE 3001
EXPOSE 3355
EXPOSE 8288
# Setup the healthcheck
HEALTHCHECK --interval=1m --timeout=10s --start-period=1m \
CMD /bin/bash /usr/local/bin/docker-healthcheck.sh || exit 1
# Run the server
ENTRYPOINT ["/bin/bash", "/usr/local/bin/docker-entrypoint.sh"]
+2 -3
View File
@@ -1,5 +1,7 @@
version: '3.9'
name: vectoradmin
networks:
vector-admin:
driver: bridge
@@ -25,10 +27,7 @@ services:
context: ../.
dockerfile: ./docker/Dockerfile
args:
ARG_UID: ${UID}
ARG_GID: ${GID}
DATABASE_CONNECTION_STRING: ${DATABASE_CONNECTION_STRING}
user: "${UID}:${GID}"
ports:
- "3001:3001"
- "3355:3355"
-1
View File
@@ -30,7 +30,6 @@ etelemetry==0.3.0
exceptiongroup==1.1.1
fake-useragent==1.2.1
filelock==3.12.4
fitz==0.0.1.dev2
Flask==2.3.2
frozenlist==1.3.3
future==0.18.3