Skip to content

refactor: move desktop related containers into compose/desktop #552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions compose/desktop/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Use postgres/example user/password credentials
version: "3.5"

services:
# Run: docker compose up setup
# Then run: docker compose up -d
setup:
image: node:18
working_dir: /codepod
volumes:
- ../..:/codepod
# pnpm-store serves two purposes:
# 1. without it, pnpm install will throw error. Ref:
# https://github.com/pnpm/pnpm/issues/3952#issuecomment-1262136483
# 2. it is mounted to all service containers, and will cache and speed up
# pnpm install and pnpm add/remove
- pnpm-store:/codepod/.pnpm-store
command: sh -c "corepack enable && pnpm install && echo '=== Setup Finished, idling ===' && tail -f /dev/null"

desktop-api:
image: node:18
working_dir: /codepod/apps/desktop-api
ports:
- 4001:4001
volumes:
- ../..:/codepod
- desktop-var-codepod:/var/codepod
- pnpm-store:/codepod/.pnpm-store
command: sh -c "corepack enable && pnpm dev"

desktop-yjs:
image: node:18
working_dir: /codepod/apps/desktop-yjs
ports:
- 4234:4233
volumes:
- ../..:/codepod
- pnpm-store:/codepod/.pnpm-store
- desktop-var-codepod:/var/codepod
- /var/run/docker.sock:/var/run/docker.sock
command: sh -c "corepack enable && pnpm dev"

desktop-ui:
image: node:18
working_dir: /codepod/apps/desktop-ui
ports:
- 3001:3001
environment:
VITE_APP_YJS_WS_URL: "ws://localhost:4234/socket"
VITE_APP_API_URL: "http://localhost:4001/graphql"
# Native spawner
VITE_APP_SPAWNER_API_URL: "http://localhost:4022/graphql"
# Docker spawner
# VITE_APP_SPAWNER_API_URL: "http://localhost:4021/graphql"
volumes:
- ../..:/codepod
- pnpm-store:/codepod/.pnpm-store
command: sh -c "corepack enable && pnpm dev"

volumes:
pnpm-store:
desktop-var-codepod:

networks:
default:
name: codepod
driver: bridge
44 changes: 0 additions & 44 deletions compose/dev/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,6 @@ services:
JWT_SECRET: ${JWT_SECRET}
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}

desktop-api:
image: node:18
working_dir: /codepod/apps/desktop-api
ports:
- 4001:4001
volumes:
- ../..:/codepod
- desktop-var-codepod:/var/codepod
- pnpm-store:/codepod/.pnpm-store
command: sh -c "corepack enable && pnpm dev"
environment:
JWT_SECRET: ${JWT_SECRET}
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}

spawner-native:
# This image has python and ipykernel installed.
build:
Expand Down Expand Up @@ -132,18 +118,6 @@ services:
DATABASE_URL: "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}?schema=public"
JWT_SECRET: ${JWT_SECRET}

desktop-yjs:
image: node:18
working_dir: /codepod/apps/desktop-yjs
ports:
- 4234:4233
volumes:
- ../..:/codepod
- pnpm-store:/codepod/.pnpm-store
- desktop-var-codepod:/var/codepod
- /var/run/docker.sock:/var/run/docker.sock
command: sh -c "corepack enable && pnpm dev"

web-ui:
image: node:18
working_dir: /codepod/apps/web-ui
Expand All @@ -163,23 +137,6 @@ services:
- pnpm-store:/codepod/.pnpm-store
command: sh -c "corepack enable && pnpm dev"

desktop-ui:
image: node:18
working_dir: /codepod/apps/desktop-ui
ports:
- 3001:3001
environment:
VITE_APP_YJS_WS_URL: "ws://localhost:4234/socket"
VITE_APP_API_URL: "http://localhost:4001/graphql"
# Native spawner
VITE_APP_SPAWNER_API_URL: "http://localhost:4022/graphql"
# Docker spawner
# VITE_APP_SPAWNER_API_URL: "http://localhost:4021/graphql"
volumes:
- ../..:/codepod
- pnpm-store:/codepod/.pnpm-store
command: sh -c "corepack enable && pnpm dev"

# This container is only used for installing node_modules into the volume, so
# that the docker spawner can use the image without waiting for installing.
example-runtime-dev:
Expand All @@ -201,7 +158,6 @@ services:
volumes:
db-data:
pnpm-store:
desktop-var-codepod:

networks:
default:
Expand Down