Merge pull request #79 from agnosticeng/docker

chore: docker image and compose
This commit is contained in:
Didier Franc
2025-02-25 22:32:03 +01:00
committed by GitHub
9 changed files with 1916 additions and 2 deletions

40
.dockerignore Normal file
View File

@@ -0,0 +1,40 @@
# Node artifact files
node_modules/
dist/
build/
# Local development
*.env
*.dev
.DS_Store
# Docker
Dockerfile
docker-compose.yml
*.dockerignore
# Debug log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# IDE files
.idea/
.vscode/
*.swp
*.swo
# Build results
out/
*.tsbuildinfo
.next/
# SvelteKit
.svelte-kit/
# Tauri
src-tauri/
#Clickhouse
conf/

16
Dockerfile Normal file
View File

@@ -0,0 +1,16 @@
FROM node:23 AS builder
WORKDIR /app
COPY . .
RUN npm install
ENV NODE_ENV=production
ENV PLATFORM=WEB
ARG CLICKHOUSE_URL
RUN npm run build
RUN ls /app/build
FROM nginx
COPY --from=builder /app/build /usr/share/nginx/html

View File

@@ -19,6 +19,29 @@
## Getting Started
### → Live
https://agx.app
### → Local
1. Clone the repository:
```bash
git clone https://github.com/agnosticeng/agx
cd agx
```
2. Run with docker compose:
```bash
docker compose up
```
3. Access the application via https://localhost:8080
### → Native
1. Clone the repository:
```bash

1794
conf/config.xml Normal file

File diff suppressed because it is too large Load Diff

10
conf/users.xml Normal file
View File

@@ -0,0 +1,10 @@
<clickhouse>
<users>
<default>
<networks>
<ip>::/0</ip>
</networks>
<password></password>
</default>
</users>
</clickhouse>

29
docker-compose.yaml Normal file
View File

@@ -0,0 +1,29 @@
version: '3'
services:
agx_app:
build:
context: .
dockerfile: Dockerfile
args:
- CLICKHOUSE_URL=http://localhost:8123?default_format=JSON
ports:
- '8080:80'
depends_on:
clickhouse:
condition: service_healthy
clickhouse:
image: clickhouse/clickhouse-server:latest
ports:
- '8123:8123'
- '9000:9000'
volumes:
- clickhouse_data:/var/lib/clickhouse
- ./conf/config.xml:/etc/clickhouse-server/config.d/config.xml
- ./conf/users.xml:/etc/clickhouse-server/users.d/users.xml
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:8123/ping || exit 1
interval: 3s
timeout: 5s
retries: 5
volumes:
clickhouse_data:

View File

@@ -9,8 +9,7 @@ export class RemoteEngine extends InternalEventEmitter<Events> implements OLAPEn
async exec(query: string, _emit = true) {
try {
const proxy =
new URLSearchParams(window.location.search).get('proxy') ?? 'https://proxy.agx.app/query';
const proxy = new URLSearchParams(window.location.search).get('proxy') ?? CLICKHOUSE_URL;
const response = await fetch(proxy, { method: 'POST', body: query });
const r = await response.text();

2
src/vite-env.d.ts vendored
View File

@@ -1,3 +1,5 @@
declare const PLATFORM: 'NATIVE' | 'WEB';
declare const BUILD: string;
declare const CLICKHOUSE_URL: string;
type MaybePromise<T> = T | Promise<T>;

View File

@@ -22,6 +22,7 @@ export default defineConfig(async () => ({
exclude: ['@sqlite.org/sqlite-wasm']
},
define: {
CLICKHOUSE_URL: JSON.stringify(process.env.CLICKHOUSE_URL || 'https://proxy.agx.app/query'),
PLATFORM: JSON.stringify(process.env.PLATFORM || 'NATIVE'),
BUILD: JSON.stringify(
(process.env.CF_PAGES_COMMIT_SHA || process.env.COMMIT_SHA || 'dev').slice(0, 7)