Merge pull request #8 from janhq/dev

Add gitsubmodule for web-client, mobile-client, and app-backend
This commit is contained in:
hiento09 2023-08-29 10:09:44 +07:00 committed by GitHub
commit 1d016d5a9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 2555 additions and 26 deletions

9
.gitmodules vendored
View File

@ -1,3 +1,12 @@
[submodule "web-client"]
path = web-client
url = git@github.com:janhq/jan-web.git
[submodule "app-backend"]
path = app-backend
url = git@github.com:janhq/app-backend.git
[submodule "mobile-client"]
path = mobile-client
url = git@github.com:janhq/jan-react-native.git
[submodule "jan-inference/sd/sd_cpp"]
path = jan-inference/sd/sd_cpp
url = https://github.com/leejet/stable-diffusion.cpp

1
app-backend Submodule

@ -0,0 +1 @@
Subproject commit 11d66335f19c6379566524742cf588959c49676f

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
## postgres database to store Hasura metadata
HASURA_GRAPHQL_METADATA_DATABASE_URL=postgres://postgres:postgrespassword@postgres:5432/postgres
## this env var can be used to add the above postgres database to Hasura as a data source. this can be removed/updated based on your needs
PG_DATABASE_URL=postgres://postgres:postgrespassword@postgres:5432/postgres
## enable the console served by server
HASURA_GRAPHQL_ENABLE_CONSOLE="true" # set to "false" to disable console
## enable debugging mode. It is recommended to disable this in production
HASURA_GRAPHQL_DEV_MODE="true"
HASURA_GRAPHQL_ENABLED_LOG_TYPES=startup, http-log, webhook-log, websocket-log, query-log
## uncomment next line to run console offline (i.e load console assets from server instead of CDN)
# HASURA_GRAPHQL_CONSOLE_ASSETS_DIR: /srv/console-assets
## uncomment next line to set an admin secret
HASURA_GRAPHQL_ADMIN_SECRET=myadminsecretkey
HASURA_GRAPHQL_UNAUTHORIZED_ROLE="public"
HASURA_GRAPHQL_METADATA_DEFAULTS='{"backend_configs":{"dataconnector":{"athena":{"uri":"http://data-connector-agent:8081/api/v1/athena"},"mariadb":{"uri":"http://data-connector-agent:8081/api/v1/mariadb"},"mysql8":{"uri":"http://data-connector-agent:8081/api/v1/mysql"},"oracle":{"uri":"http://data-connector-agent:8081/api/v1/oracle"},"snowflake":{"uri":"http://data-connector-agent:8081/api/v1/snowflake"}}}}'
HASURA_GRAPHQL_JWT_SECRET={"jwk_url": "http://keycloak:8088/realms/hasura/protocol/openid-connect/certs"}
# Environment variable for auto migrate
HASURA_GRAPHQL_MIGRATIONS_DIR=/migrations
HASURA_GRAPHQL_METADATA_DIR=/metadata
HASURA_GRAPHQL_ENABLE_CONSOLE='true'
HASURA_ACTION_STABLE_DIFFUSION_URL=http://stablediffusion:8087
HASURA_EVENTS_HOOK_URL="http://worker:8787"

View File

@ -0,0 +1 @@
POSTGRES_PASSWORD=postgrespassword

View File

@ -0,0 +1,17 @@
NEXT_PUBLIC_ENV=development
NEXT_PUBLIC_WEB_URL=
NEXT_PUBLIC_DISCORD_INVITATION_URL=
NEXT_PUBLIC_GLEAP_API_KEY=
NEXT_PUBLIC_DOWNLOAD_APP_IOS=
NEXT_PUBLIC_DOWNLOAD_APP_ANDROID=
NEXT_PUBLIC_POSTHOG_API_KEY=
NEXT_PUBLIC_SENTRY_DNS=
KEYCLOAK_CLIENT_ID=hasura
KEYCLOAK_CLIENT_SECRET=oMtCPAV7diKpE564SBspgKj4HqlKM4Hy
AUTH_ISSUER=http://localhost:8088/realms/hasura
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=my-secret
END_SESSION_URL=http://localhost:8088/realms/hasura/protocol/openid-connect/logout
REFRESH_TOKEN_URL=http://localhost:8088/realms/hasura/protocol/openid-connect/token
HASURA_ADMIN_TOKEN=myadminsecretkey
NEXT_PUBLIC_GRAPHQL_ENGINE_URL=localhost:8080

View File

@ -1,13 +1,14 @@
# docker version
version: "3"
volumes:
keycloak_postgres_data:
# volumes:
# keycloak_postgres_data:
# db_data:
services:
keycloak:
image: quay.io/keycloak/keycloak:${KEYCLOAK_VERSION-22.0.0}
command: start-dev
command: ["start-dev", "--import-realm", "--http-port", "8088"]
environment:
KC_DB: postgres
KC_DB_URL_HOST: keycloak_postgres
@ -15,18 +16,22 @@ services:
KC_DB_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
KC_DB_USERNAME: ${POSTGRES_USERNAME:-postgres}
KC_DB_SCHEMA: ${KC_DB_SCHEMA:-public}
KC_HEALTH_ENABLED: 'true'
KEYCLOAK_ADMIN: ${KEYCLOAK_ADMIN-admin}
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD-admin}
volumes:
- ./conf/keycloak_conf:/opt/keycloak/data/import
ports:
- "8080:8080"
- "8088:8088"
depends_on:
keycloak_postgres:
condition: service_healthy
networks:
jan_community:
ipv4_address: 172.20.0.9
keycloak_postgres:
image: postgres:13
image: postgres:15
command: postgres -c 'max_connections=200' && postgres -c 'shared_buffers=24MB'
environment:
# Environment Variables expecially for Postgres
@ -37,27 +42,187 @@ services:
PGPORT: ${POSTGRES_PORT:-5432}
healthcheck:
test: "exit 0"
volumes:
- keycloak_postgres_data:/data/postgres
# volumes:
# - keycloak_postgres_data:/data/postgres
ports:
- ${POSTGRES_PORT:-5432}:${POSTGRES_PORT:-5432}
networks:
jan_community:
ipv4_address: 172.20.0.10
keycloak_config_cli:
image: adorsys/keycloak-config-cli:latest
depends_on:
- keycloak
postgres:
image: postgres:15
restart: always
# volumes:
# - db_data:/var/lib/postgresql/data
env_file:
- conf/sample.env_app-backend-postgres
networks:
jan_community:
ipv4_address: 172.20.0.11
graphql-engine:
image: hasura/graphql-engine:v2.31.0.cli-migrations-v3
ports:
- "8080:8080"
restart: always
env_file:
- conf/sample.env_app-backend
volumes:
- ./conf/keycloak_conf:/config
- ./app-backend/hasura/migrations:/migrations
- ./app-backend/hasura/metadata:/metadata
depends_on:
data-connector-agent:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/healthz"]
interval: 30s
timeout: 10s
retries: 10
networks:
jan_community:
ipv4_address: 172.20.0.12
hasura-seed-apply:
image: hasura/graphql-engine:v2.31.0.cli-migrations-v3
entrypoint: [""]
command: ["/bin/sh", "-c", "hasura-cli seed apply --all-databases"]
env_file:
- conf/sample.env_app-backend
volumes:
- ./app-backend/hasura/config.yaml:/config.yaml
- ./app-backend/hasura/seeds:/seeds
depends_on:
graphql-engine:
condition: service_healthy
extra_hosts:
- "localhost:172.20.0.12"
networks:
jan_community:
worker:
build:
context: ./app-backend/worker
dockerfile: ./Dockerfile
restart: always
environment:
KEYCLOAK_URL: http://keycloak:8080
KEYCLOAK_USER: ${KEYCLOAK_ADMIN-admin}
KEYCLOAK_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD-admin}
KEYCLOAK_AVAILABILITYCHECK_ENABLED: 'true'
KEYCLOAK_AVAILABILITYCHECK_TIMEOUT: 120s
IMPORT_FILES_LOCATIONS: '/config/*'
DEBUG: 'true'
- "NODE_ENV=development"
volumes:
- ./app-backend/worker:/worker
ports:
- "8787:8787"
networks:
jan_community:
ipv4_address: 172.20.0.13
data-connector-agent:
image: hasura/graphql-data-connector:v2.31.0
restart: always
ports:
- 8081:8081
environment:
QUARKUS_LOG_LEVEL: ERROR # FATAL, ERROR, WARN, INFO, DEBUG, TRACE
## https://quarkus.io/guides/opentelemetry#configuration-reference
QUARKUS_OPENTELEMETRY_ENABLED: "false"
## QUARKUS_OPENTELEMETRY_TRACER_EXPORTER_OTLP_ENDPOINT: http://jaeger:4317
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8081/api/v1/athena/health"]
interval: 5s
timeout: 10s
retries: 5
start_period: 5s
networks:
jan_community:
ipv4_address: 172.20.0.14
web:
build:
context: ./web-client
dockerfile: ./dev.Dockerfile
container_name: jan_web
restart: always
volumes:
- ./web-client/:/app
- /app/node_modules
- /app/.next
env_file:
- conf/sample.env_web-client
ports:
- "3000:3000"
environment:
NODE_ENV: development
extra_hosts:
- "localhost:172.20.0.9"
networks:
jan_community:
ipv4_address: 172.20.0.15
# Service to download a model file.
downloader:
image: busybox
# The command extracts the model filename from MODEL_URL and downloads it if it doesn't exist.
command: /bin/sh -c "LLM_MODEL_FILE=$(basename ${MODEL_URL}); if [ ! -f /models/$LLM_MODEL_FILE ]; then wget -O /models/$LLM_MODEL_FILE ${MODEL_URL}; fi"
# Mount a local directory to store the downloaded model.
volumes:
- ./jan-inference/llm/models:/models
networks:
jan_community:
ipv4_address: 172.20.0.16
# Service to wait for the downloader service to finish downloading the model.
wait-for-downloader:
image: busybox
# The command waits until the model file (specified in MODEL_URL) exists.
command: /bin/sh -c "LLM_MODEL_FILE=$(basename ${MODEL_URL}); echo 'Waiting for downloader to finish'; while [ ! -f /models/$LLM_MODEL_FILE ]; do sleep 1; done; echo 'Model downloaded!'"
# Specifies that this service should start after the downloader service has started.
depends_on:
downloader:
condition: service_started
# Mount the same local directory to check for the downloaded model.
volumes:
- ./jan-inference/llm/models:/models
networks:
jan_community:
ipv4_address: 172.20.0.17
# Service to run the Llama web application.
llm:
image: ghcr.io/abetlen/llama-cpp-python:latest
# Mount the directory that contains the downloaded model.
volumes:
- ./jan-inference/llm/models:/models
ports:
- 8000:8000
environment:
# Specify the path to the model for the web application.
MODEL: /models/llama-2-7b-chat.ggmlv3.q4_1.bin
PYTHONUNBUFFERED: 1
# Health check configuration
# healthcheck:
# test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8000"]
# interval: 30s
# timeout: 10s
# retries: 3
# start_period: 30s
# Restart policy configuration
restart: on-failure
# Specifies that this service should start only after wait-for-downloader has completed successfully.
depends_on:
wait-for-downloader:
condition: service_completed_successfully
# Connect this service to two networks: inference_net and traefik_public.
networks:
jan_community:
ipv4_address: 172.20.0.18
networks:
jan_community:
jan_community:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.20.0.0/16

1
mobile-client Submodule

@ -0,0 +1 @@
Subproject commit ccb78d1ee050f7029f19587ac1b84d6c46fc52e3

View File

@ -1,11 +1,11 @@
KEYCLOAK_VERSION=22.0.0
POSTGRES_DB_NAME=your_db_name
POSTGRES_PASSWORD=your_db_pw
POSTGRES_USERNAME=your_db_username
POSTGRES_PORT=your_db_port
POSTGRES_DB_NAME=keycloak
POSTGRES_PASSWORD=postgres
POSTGRES_USERNAME=postgres
POSTGRES_PORT=5432
KC_DB_SCHEMA=public
KEYCLOAK_ADMIN=your_keycloak_admin_username
KEYCLOAK_ADMIN_PASSWORD=your_keycloak_admin_password
KEYCLOAK_ADMIN=admin
KEYCLOAK_ADMIN_PASSWORD=admin
# Inference
## LLM

1
web-client Submodule

@ -0,0 +1 @@
Subproject commit 6337306c54e735a4a5c2132dcd1377f21fd76a33