Skip to content

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

Merged
johnstcn merged 3 commits into
mainfrom
cj/gh-1345/example-docker-host-gateway
May 17, 2022
Merged

johnstcn merged 3 commits into
mainfrom
cj/gh-1345/example-docker-host-gateway

Conversation

@johnstcn

@johnstcn johnstcn commented May 17, 2022 •

Copy link
Copy Markdown
Member

This PR attempts to reduce the friction to getting a workspace up and running in docker when running Coder via docker-compose using the example docker-local template:

  • docker-compose.yaml: pass through docker socket and set CODER_ACCESS_URL env
  • examples/docker-local: add host.docker.internal to containers

See: #1345

@mafredri mafredri left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very smooth!

Not necessarily in this PR, but I think we still want to document the setup steps?

cd /path/to/coder/repo
docker-compose up -d
coder login http://localhost:7080 # Create first user
coder templates create -d ./examples/docker-local
coder create dev

We could try to make some of them part of the compose file, perhaps it'd also be nicer to docker-compose run coder login ... to avoid having to install the binary.

Comment thread docker-compose.yaml Resolved
…CONNECTION_URL

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
Comment thread docker-compose.yaml Outdated
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"
CODER_ACCESS_URL: "http://host.docker.internal:7080"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be set inside the specific template!

Override the "url" field of the "coder" provider!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL!

@Emyrk

Emyrk commented May 17, 2022

Copy link
Copy Markdown
Member

I didn't realize we had a docker-compose. Sweet!

@johnstcn
johnstcn enabled auto-merge (squash) May 17, 2022 14:39
@johnstcn
johnstcn merged commit 75dc8f5 into main May 17, 2022
@johnstcn
johnstcn deleted the cj/gh-1345/example-docker-host-gateway branch May 17, 2022 14:40
@bpmct

bpmct commented May 17, 2022

Copy link
Copy Markdown
Member

Very smooth!

Not necessarily in this PR, but I think we still want to document the setup steps?

cd /path/to/coder/repo
docker-compose up -d
coder login http://localhost:7080 # Create first user
coder templates create -d ./examples/docker-local
coder create dev

We could try to make some of them part of the compose file, perhaps it'd also be nicer to docker-compose run coder login ... to avoid having to install the binary.

@mafredri Yep, I'd like to document it, but I'd consider #1528 another blocker from this being a clean workflow.

I'm not really sure what the best way to document the coder login thing is... 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants