fix: example: update docker-local to use host-gateway (#1507)

* fix: example: update docker-local to use host-gateway
* docker-compose.yaml: Add POSTGRES_ environment variables to CODER_PG_CONNECTION_URL

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
This commit is contained in:
Cian Johnston
2022-05-17 15:40:13 +01:00
committed by GitHub
parent fc9efc2b79
commit 75dc8f59f6
2 changed files with 11 additions and 1 deletions

View File

@ -5,8 +5,10 @@ services:
ports:
- "7080:7080"
environment:
CODER_PG_CONNECTION_URL: "postgresql://username:password@database/coder?sslmode=disable"
CODER_PG_CONNECTION_URL: "postgresql://${POSTGRES_USER:-username}:${POSTGRES_PASSWORD:-password}@database/${POSTGRES_DB:-coder}?sslmode=disable"
CODER_ADDRESS: "0.0.0.0:7080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
database:
condition: service_healthy

View File

@ -15,6 +15,10 @@ provider "docker" {
host = "unix:///var/run/docker.sock"
}
provider "coder" {
url = "http://host.docker.internal:7080"
}
data "coder_workspace" "me" {
}
@ -43,6 +47,10 @@ resource "docker_container" "workspace" {
dns = ["1.1.1.1"]
command = ["sh", "-c", coder_agent.dev.init_script]
env = ["CODER_AGENT_TOKEN=${coder_agent.dev.token}"]
host {
host = "host.docker.internal"
ip = "host-gateway"
}
volumes {
container_path = "/home/coder/"
volume_name = docker_volume.coder_volume.name