Compare commits

...

2 Commits

Author SHA1 Message Date
DataHearth 0f317b5256
add cmd to generate schema.json
Docker / Build and push builder images (push) Successful in 1m35s Details
Rust / Run tests (push) Failing after 12m30s Details
Docker / Build and push service images (web) (push) Successful in 3m49s Details
Docker / Build and push service images (bot) (push) Successful in 5m46s Details
Docker / Build and push service images (database) (push) Successful in 5m56s Details
2023-08-14 11:25:01 +02:00
DataHearth 6f3856d2a4
update doc 2023-08-14 11:24:46 +02:00
2 changed files with 29 additions and 13 deletions

View File

@ -2,7 +2,7 @@ set shell := ["zsh", "-uc"]
base_img_name := "datahearth/tech-bot" base_img_name := "datahearth/tech-bot"
gitea_img_name := "gitea.antoine-langlois.net/" + base_img_name gitea_img_name := "gitea.antoine-langlois.net/" + base_img_name
all_targets := "rust-builder web-dependencies bot web database" all_targets := "web-dependencies bot web database"
alias b := build alias b := build
alias p := push alias p := push
@ -11,7 +11,7 @@ alias pa := push-all
gen-graphql: gen-graphql:
@graphql-client introspect-schema http://localhost:8080/graphql > ./bot/graphql/schema.json @graphql-client introspect-schema http://localhost:8080/graphql > ./bot/graphql/schema.json
@echo "GrahQL schema generated. Don't forget to update \"./bot/graphql/query.graphql\"!"
build TARGET: build TARGET:
@docker build -t {{base_img_name}}:{{TARGET}}-latest \ @docker build -t {{base_img_name}}:{{TARGET}}-latest \

View File

@ -12,33 +12,38 @@ Save technologies you want to share/remember in a simple way inside Discord.
```bash ```bash
# BOT # BOT
export DISCORD_TOKEN=TOKEN cat << EOF > .env
export GRAPHQL_ENDPOINT="http://host/graphql" DISCORD_TOKEN=TOKEN
GRAPHQL_ENDPOINT="http://database/graphql"
EOF
# DATABASE # DATABASE
export DB_PATH="/path/to/db/database.db" cat << EOF > .env
DB_PATH="/path/to/db/database.db"
EOF
# FRONTEND # FRONTEND
export FRONT_VOLUME cat << EOF > $DOTENV_CONFIG_PATH # <==== Default to "/app/config/.env" in the image
cat << EOF > $FRONT_VOLUME/.env
PORT=3000 PORT=3000
HOST=127.0.0.1 HOST=127.0.0.1
PUBLIC_GRAPHQL_ENDPOINT="$GRAPHQL_ENDPOINT" PUBLIC_GRAPHQL_ENDPOINT="http://database/graphql"
CLIENT_ID="DISCORD_APP_ID" CLIENT_ID="DISCORD_APP_ID"
CLIENT_SECRET="DISCORD_APP_SECRET" CLIENT_SECRET="DISCORD_APP_SECRET"
ORIGIN="http://host" ORIGIN="http://host"
EOF EOF
# Side note: ".env" file for "bot" and "database" are not mandatory, but if you don't use them, you will need to pass the environment variables to the container. Default path for ".env" is "/.env"
docker run -d \ docker run -d \
--name tech-bot-bot \ --name tech-bot-bot \
-e DISCORD_TOKEN=$DISCORD_TOKEN \ -v $PWD/.env:/.env \
-e GRAPHQL_ENDPOINT=$GRAPHQL_ENDPOINT \
--restart unless-stopped \ --restart unless-stopped \
gitea.antoine-langlois.net/datahearth/tech-bot:bot-latest gitea.antoine-langlois.net/datahearth/tech-bot:bot-latest
docker run -d \ docker run -d \
--name tech-bot-database \ --name tech-bot-database \
-v $DB_PATH:/app/database.db \ -v $PWD/.env:/.env \
-v $DATABASE_VOLUME:/app \
--restart unless-stopped \ --restart unless-stopped \
gitea.antoine-langlois.net/datahearth/tech-bot:database-latest gitea.antoine-langlois.net/datahearth/tech-bot:database-latest
@ -62,6 +67,17 @@ cd tech-bot
cargo build --release cargo build --release
# Run # Run
# BOT
cat << EOF > .env
DISCORD_TOKEN=TOKEN
GRAPHQL_ENDPOINT="http://database/graphql"
EOF
# DATABASE
cat << EOF > .env
DB_PATH="/path/to/db/database.db"
EOF
. ./target/release/tech-bot/database . ./target/release/tech-bot/database
. ./target/release/tech-bot/bot . ./target/release/tech-bot/bot
@ -75,7 +91,7 @@ pnpm build
## Run ## Run
export PORT=3000 export PORT=3000
export HOST=127.0.0.1 export HOST=127.0.0.1
export PUBLIC_GRAPHQL_ENDPOINT="$GRAPHQL_ENDPOINT" export PUBLIC_GRAPHQL_ENDPOINT="http://database/graphql"
export CLIENT_ID="DISCORD_APP_ID" export CLIENT_ID="DISCORD_APP_ID"
export CLIENT_SECRET="DISCORD_APP_SECRET" export CLIENT_SECRET="DISCORD_APP_SECRET"
export ORIGIN="http://host" export ORIGIN="http://host"
@ -98,7 +114,7 @@ To list all technologies, just type:
To search for a technology, just type: To search for a technology, just type:
/search <technology> /search <technology> <options> <tags>
To remove a technology, you need to have the permission to remote a tech from the list. To remove a technology, you need to have the permission to remote a tech from the list.