From ae2b60faf4763152f49eead3ff5af4cc9bfa6c04 Mon Sep 17 00:00:00 2001 From: Bailey Townsend Date: Thu, 29 May 2025 12:01:47 -0500 Subject: [PATCH] wip. mostly working depending on other prs and docs --- .gitignore | 5 +- apps/amethyst/Caddyfile | 5 ++ apps/amethyst/Dockerfile | 32 +++++++++++++ apps/amethyst/package.json | 2 +- compose.dev.yml | 94 +++++++++++++++++++++++++------------- 5 files changed, 102 insertions(+), 36 deletions(-) create mode 100644 apps/amethyst/Caddyfile create mode 100644 apps/amethyst/Dockerfile diff --git a/.gitignore b/.gitignore index a1f9273..465fe1c 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ yarn-error.log* .env.development.local .env.test.local .env.production.local +.env.air # vercel .vercel @@ -46,6 +47,4 @@ yarn-error.log* **/*.log package-lock.json **/*.bun -.idea - -apps/amethyst/buld \ No newline at end of file +.idea \ No newline at end of file diff --git a/apps/amethyst/Caddyfile b/apps/amethyst/Caddyfile new file mode 100644 index 0000000..ff458bd --- /dev/null +++ b/apps/amethyst/Caddyfile @@ -0,0 +1,5 @@ +{env.CLIENT_ADDRESS} { + try_files {path} /index.html + file_server +} + diff --git a/apps/amethyst/Dockerfile b/apps/amethyst/Dockerfile new file mode 100644 index 0000000..9bbdcbe --- /dev/null +++ b/apps/amethyst/Dockerfile @@ -0,0 +1,32 @@ +FROM node:22-slim AS builder +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" +RUN corepack enable +# Set working directory +WORKDIR /app + +# Copy root workspace files +COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./ + +# Copy turbo.json +COPY turbo.json ./ + +# Copy workspace packages +COPY packages/db/ ./packages/db/ +COPY packages/lexicons/ ./packages/lexicons/ +COPY packages/tsconfig/ ./packages/tsconfig/ + +# Copy the aqua app +COPY apps/amethyst/ ./apps/amethyst/ + +# Build the aqua app +WORKDIR /app/apps/amethyst +RUN pnpm install +RUN pnpm run build:web + +FROM caddy:2.1.0-alpine AS caddy +EXPOSE 80 +EXPOSE 443 +EXPOSE 443/udp +COPY /apps/amethyst/Caddyfile /etc/caddy/Caddyfile +COPY --from=builder /app/apps/amethyst/build /srv \ No newline at end of file diff --git a/apps/amethyst/package.json b/apps/amethyst/package.json index f0d604c..0b42458 100644 --- a/apps/amethyst/package.json +++ b/apps/amethyst/package.json @@ -9,7 +9,7 @@ "ios": "expo run:ios", "web": "expo start --web", "build": "expo export --output-dir ./build --platform all", - "build:web": "expo export --output-dir ./buld --platform web", + "build:web": "expo export --output-dir ./build --platform web", "test": "jest --watchAll", "lexgen": "lex gen-server ./lexicons/generated/server/ ./lexicons/src/" }, diff --git a/compose.dev.yml b/compose.dev.yml index 879e4eb..ba32b54 100644 --- a/compose.dev.yml +++ b/compose.dev.yml @@ -6,12 +6,31 @@ services: container_name: aqua-app ports: - "3000:3000" + extra_hosts: + - "host.docker.internal:host-gateway" networks: - app_network depends_on: - postgres env_file: - .env + environment: + DATABASE_URL: ${DOCKER_DB_URL} + amethyst: + build: + context: . + dockerfile: apps/amethyst/Dockerfile + ports: + - "80:80" + - "443:443" + - "443:443/udp" + volumes: + - caddy_data:/data + - caddy_config:/config + networks: + - app_network + environment: + CLIENT_ADDRESS: ${CLIENT_ADDRESS} postgres: image: postgres:latest container_name: postgres_db @@ -27,41 +46,52 @@ services: - "host.docker.internal:host-gateway" networks: - app_network - env_file: .env - # traefik: - # image: traefik:v2.10 - # container_name: traefik - # command: - # - "--api.insecure=true" - # - "--providers.file.directory=/etc/traefik/dynamic" - # - "--providers.file.watch=true" - # - "--entrypoints.web.address=:80" - # ports: - # - "80:80" # HTTP - # - "8080:8080" # Dashboard - # volumes: - # - ./traefik/dynamic:/etc/traefik/dynamic:ro - # networks: - # - app_network - # extra_hosts: - # - "host.docker.internal:host-gateway" # This allows reaching host machine - - - # redis: - # image: redis:latest - # container_name: redis_cache - # ports: - # - "6379:6379" - # volumes: - # - redis_data:/data - # command: redis-server --appendonly yes - # networks: - # - app_network + cadet: + image: ghcr.io/espeon/cadet + ports: + - "9000:9000" + env_file: + - .env + environment: + DATABASE_URL: ${DOCKER_DB_URL} + extra_hosts: + - "host.docker.internal:host-gateway" + networks: + - app_network + depends_on: + - postgres + satellite: + image: ghcr.io/espeon/satellite + ports: + - "3132:3000" + env_file: + - .env + environment: + DATABASE_URL: ${DOCKER_DB_URL} + extra_hosts: + - "host.docker.internal:host-gateway" + networks: + - app_network + depends_on: + - postgres + piper: +# image: ghcr.io/teal-fm/piper:main + image: fatfingers23/piper:latest + # Depends on your .env.air + ports: + - "8080:8080" + env_file: + - .env.air + volumes: + - piper_data:/db +# db-migrations + #TODO to not forget to add an image to run db migrations or add it to aqua in a bash script on run networks: app_network: driver: bridge - volumes: postgres_data: -# redis_data: + caddy_data: + caddy_config: + piper_data: -- 2.51.2