diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index f8d6ad52..00000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/go/.devcontainer/base.Dockerfile - -# [Choice] Go version (use -bullseye variants on local arm64/Apple Silicon): 1, 1.16, 1.17, 1-bullseye, 1.16-bullseye, 1.17-bullseye, 1-buster, 1.16-buster, 1.17-buster -ARG VARIANT="1-bullseye" -FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT} - -# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 -ARG NODE_VERSION="none" -RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi - -# [Optional] Uncomment this section to install additional OS packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends curl gnupg - -# [Optional] Uncomment the next lines to use go get to install anything else you need -# USER vscode -# RUN go install [packages] - -# [Optional] Uncomment this line to install global node packages. -# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 \ No newline at end of file diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 00000000..09299e8d --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,12 @@ +# Running these samples in a DevContainer + +If you are reading this, then you probably have this repo open in a DevContainer: - [https://code.visualstudio.com/docs/remote/containers](https://code.visualstudio.com/docs/remote/containers). + +## Start a local Temporal Server +This will run latest Temporal images in a docker network. + +```bash +make start-local +``` + +You should now be able to run any of the samples locally in your dev container. \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7aee28c6..97ae9fca 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,35 +1,21 @@ { - "name": "Temporal", - // Update the 'dockerComposeFile' list if you have more compose files or use different names. - "dockerComposeFile": "docker-compose.yml", - - // The 'service' property is the name of the service for the container that VS Code should - // use. Update this value and .devcontainer/docker-compose.yml to the real service name. - "service": "devcontainer", - "workspaceFolder": "/workspace", - "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], - - // Set *default* container specific settings.json values on container create. - "settings": { - "go.toolsManagement.checkForUpdates": "local", - "go.useLanguageServer": true, - "go.gopath": "/go" + "name": "Temporal Go Samples", + "image": "mcr.microsoft.com/vscode/devcontainers/go:0-1-bullseye", + "customizations": { + "vscode": { + "settings": { + "go.toolsManagement.checkForUpdates": "local", + "go.useLanguageServer": true, + "go.gopath": "/go" + }, + "extensions": [ + "golang.Go", + "ms-azuretools.vscode-docker" + ] + } + }, + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:1": {} }, - - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "golang.Go" - ], - - // Forward port for temporal UI automatically - "forwardPorts": [8088], - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "go version", - - // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode" } diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml deleted file mode 100644 index cf5016c1..00000000 --- a/.devcontainer/docker-compose.yml +++ /dev/null @@ -1,87 +0,0 @@ -# This is a simple docker compose that has been tested to work with remote containers in VS code. -# You can run these samples by installing the Remote Containers plugin in VSCode and opening -# this repo. When prompted, click "Open in Cointainer". -# see https://code.visualstudio.com/docs/remote/containers for info on remote containers -# see https://github.com/temporalio/docker-compose for other reference docker-compose files -version: '3.5' -services: - ## Uncomment if you need search attributes feature. - ## Don't forget to uncomment the ES related comments in the temporal service below. - # elasticsearch: - # container_name: temporal-elasticsearch - # environment: - # - cluster.routing.allocation.disk.threshold_enabled=true - # - cluster.routing.allocation.disk.watermark.low=512mb - # - cluster.routing.allocation.disk.watermark.high=256mb - # - cluster.routing.allocation.disk.watermark.flood_stage=128mb - # - discovery.type=single-node - # - ES_JAVA_OPTS=-Xms100m -Xmx100m - # image: elasticsearch:7.10.1 - # # networks: - # # - temporal-network - # ports: - # - 9200:9200 - devcontainer: - container_name: devcontainer - depends_on: - - temporal - build: - context: . - dockerfile: Dockerfile - args: - VARIANT: "1-bullseye" - NODE_VERSION: "none" - volumes: - # This is where VS Code should expect to find your project's source code and the value of "workspaceFolder" in .devcontainer/devcontainer.json - - ..:/workspace:cached - command: /bin/sh -c "while sleep 1000; do :; done" - # Runs app on the same network as the service container, allows "forwardPorts" in devcontainer.json function. - network_mode: service:temporal - postgresql: - container_name: temporal-postgresql - environment: - POSTGRES_PASSWORD: temporal - POSTGRES_USER: temporal - image: postgres:13 - ports: - - 5432:5432 - temporal: - container_name: temporal - depends_on: - - postgresql - # - elasticsearch - environment: - - DB=postgresql - - DB_PORT=5432 - - POSTGRES_USER=temporal - - POSTGRES_PWD=temporal - - POSTGRES_SEEDS=postgresql - - DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development_es.yaml - # - ENABLE_ES=true - # - ES_SEEDS=elasticsearch - # - ES_VERSION=v7 - image: temporalio/auto-setup:latest - ports: - - 7233:7233 - volumes: - - ./dynamicconfig:/etc/temporal/config/dynamicconfig - temporal-admin-tools: - container_name: temporal-admin-tools - depends_on: - - temporal - environment: - - TEMPORAL_CLI_ADDRESS=temporal:7233 - image: temporalio/admin-tools:latest - stdin_open: true - tty: true - temporal-web: - container_name: temporal-web - depends_on: - - temporal - environment: - - TEMPORAL_GRPC_ENDPOINT=temporal:7233 - - TEMPORAL_PERMIT_WRITE_API=true - image: temporalio/web:latest - ports: - - 8088:8088 - diff --git a/Makefile b/Makefile index 911ee6bb..030d2c05 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,9 @@ update-sdk: clean: rm -rf bin + +start-local: + docker-compose up -d ci-build: staticcheck errcheck workflowcheck bins test GO111MODULE=off go get -u honnef.co/go/tools/cmd/staticcheck \ No newline at end of file