diff --git a/.devcontainer/.env b/.devcontainer/.env new file mode 100644 index 000000000..d1016e040 --- /dev/null +++ b/.devcontainer/.env @@ -0,0 +1,11 @@ +POSTGRES_USER=postgres +POSTGRES_PASSWORD=abc123 +POSTGRES_DB=postgres +POSTGRES_HOST=postgres +POSTGRES_PORT=5432 + +ZENSTACK_TEST_DB_USER=postgres +ZENSTACK_TEST_DB_PASS=abc123 +ZENSTACK_TEST_DB_NAME=postgres +ZENSTACK_TEST_DB_HOST=postgres +ZENSTACK_TEST_DB_PORT=5432 \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..7ef289460 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,20 @@ +{ + "name": "zenstack", + "dockerComposeFile": [ + "./docker-compose.yml" + ], + "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind", + "workspaceFolder": "/workspace", + "service": "workspace", + "shutdownAction": "stopCompose", + "postCreateCommand": "npm i -g pnpm@9.15.9 && pnpm install && pnpm build && pnpm test-scaffold", + "remoteUser": "node", + "customizations": { + "vscode": { + "extensions": [ + "langium.langium-vscode", + "firsttris.vscode-jest-runner" + ] + } + } +} \ No newline at end of file diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 000000000..f8dff6f9c --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,37 @@ +name: zenstack + +volumes: + postgres-data: + +networks: + workspace: + external: false + +services: + workspace: + container_name: zenstack-workspace + image: mcr.microsoft.com/devcontainers/javascript-node:20 + restart: always + volumes: + - ..:/workspace:cached + env_file: ./.env + command: sleep infinity + networks: + - workspace + + postgres: + container_name: zenstack-postgres + image: postgres + restart: always + volumes: + - postgres-data:/var/lib/postgresql/ + env_file: ./.env + networks: + - workspace + ports: + - 5432:5432 + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] + interval: 5s + timeout: 5s + retries: 5 diff --git a/.gitignore b/.gitignore index 307f58a86..2cebbae56 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ dist coverage .build .test +.pnpm-store \ No newline at end of file