update doc
This commit is contained in:
parent
b08c4fffa2
commit
20ff50e5af
|
@ -21,7 +21,7 @@ jobs:
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
target: [DATABASE, BOT, WEB]
|
target: [database, bot, web]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
26
Dockerfile
26
Dockerfile
|
@ -2,7 +2,7 @@
|
||||||
# * Build the bot and database *
|
# * Build the bot and database *
|
||||||
# ********************************
|
# ********************************
|
||||||
|
|
||||||
FROM rust:1 as RUST-BUILDER
|
FROM rust:1 as rust-builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@ RUN cargo build --release
|
||||||
# * Deploy the bot *
|
# * Deploy the bot *
|
||||||
# ********************************
|
# ********************************
|
||||||
|
|
||||||
FROM gcr.io/distroless/cc as BOT
|
FROM gcr.io/distroless/cc as bot
|
||||||
|
|
||||||
COPY --from=RUST-BUILDER /app/target/release/bot /bot
|
COPY --from=rust-builder /app/target/release/bot /bot
|
||||||
|
|
||||||
CMD [ "/bot" ]
|
CMD [ "/bot" ]
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ CMD [ "/bot" ]
|
||||||
# * Deploy the database *
|
# * Deploy the database *
|
||||||
# ********************************
|
# ********************************
|
||||||
|
|
||||||
FROM gcr.io/distroless/cc as DATABASE
|
FROM gcr.io/distroless/cc as database
|
||||||
|
|
||||||
COPY --from=RUST-BUILDER /app/target/release/database /database
|
COPY --from=rust-builder /app/target/release/database /database
|
||||||
|
|
||||||
ENV DB_PATH=/app/tech-bot.db
|
ENV DB_PATH=/app/tech-bot.db
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ CMD [ "/database" ]
|
||||||
# * Build the web *
|
# * Build the web *
|
||||||
# ********************************
|
# ********************************
|
||||||
|
|
||||||
FROM node:18-slim as WEB-BUILDER
|
FROM node:18-slim as web-builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
@ -54,21 +54,15 @@ RUN corepack enable
|
||||||
RUN pnpm install --prod --frozen-lockfile
|
RUN pnpm install --prod --frozen-lockfile
|
||||||
RUN pnpm build
|
RUN pnpm build
|
||||||
|
|
||||||
FROM node:18-alpine3.18 as WEB
|
FROM node:18-alpine3.18 as web
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=WEB-BUILDER /app/build ./build
|
COPY --from=web-builder /app/build ./build
|
||||||
COPY --from=WEB-BUILDER /app/node_modules ./node_modules
|
COPY --from=web-builder /app/node_modules ./node_modules
|
||||||
COPY --from=WEB-BUILDER /app/package.json /app/pnpm-lock.yaml ./
|
COPY --from=web-builder /app/package.json /app/pnpm-lock.yaml ./
|
||||||
|
|
||||||
ENV PORT=3000
|
|
||||||
ENV HOST=127.0.0.1
|
|
||||||
ENV DOTENV_CONFIG_PATH=/app/config/.env
|
ENV DOTENV_CONFIG_PATH=/app/config/.env
|
||||||
ENV ORIGIN="http://localhost:3000"
|
|
||||||
ENV PUBLIC_GRAPHQL_ENDPOINT="http://localhost:8080/graphql"
|
|
||||||
|
|
||||||
EXPOSE ${PORT}
|
|
||||||
|
|
||||||
VOLUME [ "/app/config" ]
|
VOLUME [ "/app/config" ]
|
||||||
|
|
||||||
|
|
108
README.md
108
README.md
|
@ -11,50 +11,110 @@ Save technologies you want to share/remember in a simple way inside Discord.
|
||||||
#### Docker
|
#### Docker
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# BOT
|
||||||
export DISCORD_TOKEN=TOKEN
|
export DISCORD_TOKEN=TOKEN
|
||||||
export ADMIN_USERS=123456789,987654321
|
export GRAPHQL_ENDPOINT="http://host/graphql"
|
||||||
|
|
||||||
|
# DATABASE
|
||||||
|
export DB_PATH="/path/to/db/database.db"
|
||||||
|
|
||||||
|
# FRONTEND
|
||||||
|
export FRONT_VOLUME
|
||||||
|
cat << EOF > $FRONT_VOLUME/.env
|
||||||
|
PORT=3000
|
||||||
|
HOST=127.0.0.1
|
||||||
|
PUBLIC_GRAPHQL_ENDPOINT="$GRAPHQL_ENDPOINT"
|
||||||
|
CLIENT_ID="DISCORD_APP_ID"
|
||||||
|
CLIENT_SECRET="DISCORD_APP_SECRET"
|
||||||
|
ORIGIN="http://host"
|
||||||
|
EOF
|
||||||
|
|
||||||
docker run -d \
|
docker run -d \
|
||||||
--name tech-bot \
|
--name tech-bot-bot \
|
||||||
-e DISCORD_TOKEN=$DISCORD_TOKEN \
|
-e DISCORD_TOKEN=$DISCORD_TOKEN \
|
||||||
-e ADMIN_USERS=$ADMIN_USERS \
|
-e GRAPHQL_ENDPOINT=$GRAPHQL_ENDPOINT \
|
||||||
-v /path/to/tech-bot/data:/data \
|
|
||||||
--restart unless-stopped \
|
--restart unless-stopped \
|
||||||
gitea.antoine-langlois.net/datahearth/tech-bot
|
gitea.antoine-langlois.net/datahearth/tech-bot:bot-latest
|
||||||
|
|
||||||
|
docker run -d \
|
||||||
|
--name tech-bot-database \
|
||||||
|
-v $DB_PATH:/app/database.db \
|
||||||
|
--restart unless-stopped \
|
||||||
|
gitea.antoine-langlois.net/datahearth/tech-bot:database-latest
|
||||||
|
|
||||||
|
docker run -d \
|
||||||
|
--name tech-bot-front \
|
||||||
|
-v $FRONT_VOLUME:/app/config \
|
||||||
|
-p ${EXTERNAL_PORT}:${INTERNAL_PORT} \
|
||||||
|
--restart unless-stopped \
|
||||||
|
gitea.antoine-langlois.net/datahearth/tech-bot:front-latest
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Manually
|
#### Manually
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export DISCORD_TOKEN=TOKEN
|
# Setup
|
||||||
export ADMIN_USERS=123456789,987654321
|
|
||||||
export DB_PATH=database.db
|
|
||||||
|
|
||||||
git clone https://gitea.antoine-langlois.net/datahearth/tech-bot.git
|
git clone https://gitea.antoine-langlois.net/datahearth/tech-bot.git
|
||||||
cd tech-bot
|
cd tech-bot
|
||||||
|
|
||||||
|
# Database & Bot
|
||||||
|
## Build
|
||||||
cargo build --release
|
cargo build --release
|
||||||
./target/release/tech-bot
|
|
||||||
|
# Run
|
||||||
|
. ./target/release/tech-bot/database
|
||||||
|
. ./target/release/tech-bot/bot
|
||||||
|
|
||||||
|
# Frontend
|
||||||
|
cd frontend
|
||||||
|
|
||||||
|
## Build
|
||||||
|
pnpm install --prod --frozen-lockfile
|
||||||
|
pnpm build
|
||||||
|
|
||||||
|
## Run
|
||||||
|
export PORT=3000
|
||||||
|
export HOST=127.0.0.1
|
||||||
|
export PUBLIC_GRAPHQL_ENDPOINT="$GRAPHQL_ENDPOINT"
|
||||||
|
export CLIENT_ID="DISCORD_APP_ID"
|
||||||
|
export CLIENT_SECRET="DISCORD_APP_SECRET"
|
||||||
|
export ORIGIN="http://host"
|
||||||
|
node -r dotenv/config build
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```bash
|
```text
|
||||||
/tech help
|
Hello fellow human! I am a bot that can help you adding new technologies to a git repository.
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
To add a new technology, just type:
|
||||||
/tech add <Technology name> <Technology link> <OPTIONAL: Technology tags (comma separated)>
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
/add <technology> <link>
|
||||||
/tech list
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
To list all technologies, just type:
|
||||||
/tech search <Technology name> <OPTIONAL: Regex> <OPTIONAL: Technology tags (comma separated)>
|
|
||||||
```
|
/list
|
||||||
|
|
||||||
|
|
||||||
|
To search for a technology, just type:
|
||||||
|
|
||||||
|
/search <technology>
|
||||||
|
|
||||||
|
|
||||||
|
To remove a technology, you need to have the permission to remote a tech from the list.
|
||||||
|
If so, just type:
|
||||||
|
|
||||||
|
/remove <technology>
|
||||||
|
|
||||||
|
|
||||||
|
To update a technology, you need to have the permission to update a tech from the list.
|
||||||
|
If so, just type:
|
||||||
|
|
||||||
|
/update <UUID> <technology> <link> <tags>
|
||||||
|
|
||||||
|
|
||||||
|
To get help, just type:
|
||||||
|
|
||||||
|
/help
|
||||||
|
|
||||||
```bash
|
|
||||||
/tech remove <tech-name>
|
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue