0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
posthog/.devcontainer/devcontainer.json

73 lines
2.8 KiB
JSON
Raw Normal View History

// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.183.0/containers/docker-existing-docker-compose
// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml.
{
Reimplement codespaces support (#7234) * dev(codespaces): add "lean in" docker configuration for codespaces This changes creates a dedicated `docker-compose.yml` and `Dockerfile` for codespaces and doesn't attempt to have compatability with the existing docker config files. This is intentional and is designed to be a close to what codespaces would consider the ideal, so as to understand what great would look like. At the moment it doesn't do, but could: 1. install python and node packages in the image 2. push this image up to dockerhub 3. specify this image to be used for caching. There is a "cacheFrom" option in the [.devcontainer reference](https://code.visualstudio.com/docs/remote/devcontainerjson-reference) although I haven't checked how this works with using `docker-compose.yml`. Perhaps we just need to add the `image:` property to the `app` service :fingerscrossed: 4. specify default extensions and settings to be used. * Use python 3.9, not the latest python 3 codespaces supports * Add some basic python default settings and extensions * add github codespaces image build workflow * chore: update docker-compose cache from :cache tag * chore: use docker cache-to inline * add codespaces platform comment * temp run on branch * chore: fix flatforms format * chore: update qemu comment * chore: codespaces build use master image * chore: target x86_64 * chore: just use image for codespaces, don't try to build * add in python, node requirements * install node * install node * uncomment node deps install * use app network stack for all services * move .env to .dev.env and us in docker-compose * set WORKDIR to workspace * pin apt packages * pin versions, remove apt-key * add yarn cache clean * Fix hadolint warnings * make codespace build on master, or a PR with codespaces-build label * add missing && * dont bother with clickhouse install, its huge * dont be cute with the networks, just expose explicitly * fix network * create container zsh * correct .env path * point app to the clickhouse container * Also install saml deps * ignore .env again * libxml already installed * correct conditional workflow comment
2021-11-23 09:34:51 +01:00
"name": "PostHog codespaces development environment",
"build": {
"dockerfile": "Dockerfile",
"context": "../",
"cacheFrom": "ghcr.io/posthog/posthog/codespaces:master"
},
"remoteUser": "vscode",
"remoteEnv": {
"DEBUG": "1",
"DATABASE_URL": "postgres://posthog:posthog@localhost:5432/posthog",
"KAFKA_ENABLED": "true",
"KAFKA_HOSTS": "kafka:9092",
"CLICKHOUST_HOST": "localhost",
"CLICKHOUSE_DATABASE": "posthog_test",
"CLICKHOUSE_VERIFY": "False",
"REDIS_URL": "redis://localhost:6379",
"SECRET_KEY": "<randomly generated secret key>"
},
"overrideCommand": false,
"mounts": ["source=codespaces-linux-var-lib-docker,target=/var/lib/docker,type=volume"],
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined",
"--privileged",
"--init",
"--add-host",
"kafka:127.0.0.1"
],
"workspaceFolder": "/workspaces/posthog",
// Set *default* container specific settings.json values on container create.
Reimplement codespaces support (#7234) * dev(codespaces): add "lean in" docker configuration for codespaces This changes creates a dedicated `docker-compose.yml` and `Dockerfile` for codespaces and doesn't attempt to have compatability with the existing docker config files. This is intentional and is designed to be a close to what codespaces would consider the ideal, so as to understand what great would look like. At the moment it doesn't do, but could: 1. install python and node packages in the image 2. push this image up to dockerhub 3. specify this image to be used for caching. There is a "cacheFrom" option in the [.devcontainer reference](https://code.visualstudio.com/docs/remote/devcontainerjson-reference) although I haven't checked how this works with using `docker-compose.yml`. Perhaps we just need to add the `image:` property to the `app` service :fingerscrossed: 4. specify default extensions and settings to be used. * Use python 3.9, not the latest python 3 codespaces supports * Add some basic python default settings and extensions * add github codespaces image build workflow * chore: update docker-compose cache from :cache tag * chore: use docker cache-to inline * add codespaces platform comment * temp run on branch * chore: fix flatforms format * chore: update qemu comment * chore: codespaces build use master image * chore: target x86_64 * chore: just use image for codespaces, don't try to build * add in python, node requirements * install node * install node * uncomment node deps install * use app network stack for all services * move .env to .dev.env and us in docker-compose * set WORKDIR to workspace * pin apt packages * pin versions, remove apt-key * add yarn cache clean * Fix hadolint warnings * make codespace build on master, or a PR with codespaces-build label * add missing && * dont bother with clickhouse install, its huge * dont be cute with the networks, just expose explicitly * fix network * create container zsh * correct .env path * point app to the clickhouse container * Also install saml deps * ignore .env again * libxml already installed * correct conditional workflow comment
2021-11-23 09:34:51 +01:00
"settings": {
/*
Python settings
*/
"python.defaultInterpreterPath": "/usr/local/bin/python",
// Configure linting
"python.linting.enabled": true,
"python.linting.pylintEnabled": false, // We use flake8, disable pylint
"python.linting.flake8Enabled": true,
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
// Configure formatting
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.provider": "black",
// Configure testing
"python.testing.pytestEnabled": true,
"python.testing.pytestPath": "/usr/local/py-utils/bin/pytest"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"esbenp.prettier-vscode",
"ms-azuretools.vscode-docker",
"stkb.rewrap",
"GitHub.copilot",
"KnisterPeter.vscode-github",
"eamodio.gitlens",
"wix.vscode-import-cost",
"Orta.vscode-jest",
"ckolkman.vscode-postgres",
"mtxr.sqltools",
"ultram4rine.sqltools-clickhouse-driver"
],
Reimplement codespaces support (#7234) * dev(codespaces): add "lean in" docker configuration for codespaces This changes creates a dedicated `docker-compose.yml` and `Dockerfile` for codespaces and doesn't attempt to have compatability with the existing docker config files. This is intentional and is designed to be a close to what codespaces would consider the ideal, so as to understand what great would look like. At the moment it doesn't do, but could: 1. install python and node packages in the image 2. push this image up to dockerhub 3. specify this image to be used for caching. There is a "cacheFrom" option in the [.devcontainer reference](https://code.visualstudio.com/docs/remote/devcontainerjson-reference) although I haven't checked how this works with using `docker-compose.yml`. Perhaps we just need to add the `image:` property to the `app` service :fingerscrossed: 4. specify default extensions and settings to be used. * Use python 3.9, not the latest python 3 codespaces supports * Add some basic python default settings and extensions * add github codespaces image build workflow * chore: update docker-compose cache from :cache tag * chore: use docker cache-to inline * add codespaces platform comment * temp run on branch * chore: fix flatforms format * chore: update qemu comment * chore: codespaces build use master image * chore: target x86_64 * chore: just use image for codespaces, don't try to build * add in python, node requirements * install node * install node * uncomment node deps install * use app network stack for all services * move .env to .dev.env and us in docker-compose * set WORKDIR to workspace * pin apt packages * pin versions, remove apt-key * add yarn cache clean * Fix hadolint warnings * make codespace build on master, or a PR with codespaces-build label * add missing && * dont bother with clickhouse install, its huge * dont be cute with the networks, just expose explicitly * fix network * create container zsh * correct .env path * point app to the clickhouse container * Also install saml deps * ignore .env again * libxml already installed * correct conditional workflow comment
2021-11-23 09:34:51 +01:00
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [8000, 5432, 6379, 8123, 8234, 9000, 9092, 9440, 9009]
}