sourcegraph / sourcegraph-public-snapshot

Code AI platform with Code Search & Cody
https://sourcegraph.com
Other
10.11k stars 1.29k forks source link

Setup local development using containers. #4976

Open JoseFdri opened 5 years ago

JoseFdri commented 5 years ago

Feature request description

Setup a local development environment using containers to be able run Sourcegraph for contribution purposes in many type of OS and without installing too many dependencies.

Is your feature request related to a problem? If so, please describe.

Currently I'm using Windows OS and was very tricky to get started using the local development documentation.

Describe alternatives you've considered.

I created a repository to get Sourcegraph running in containers using Docker, this would be really helpful to setup a local development environment with one command. Reposotory: Sourcegraph docker scripts.

efritz commented 5 years ago

Hi, Jose! I'm glad you brought this up as running everything in containers rather than a host is also my preferred way to do development. Right now I have a hybrid approach where I'm running postres and redis (the persistent external services) as docker containers and just overriding some of the environment variables for the ./dev/launch.sh script.

I saw your docker scripts and I like that it allows you to use the launch script so you get the nice auto-reload features. I've set up environments that were similar before, but only for angular frontends that would auto-reload.

I'd also like to play around a little bit this week and see if I can come up with something that doesn't require docker-in-docker. This will give people a stable development environment that more closely mirrors how the components are deployed (something that would maps each docker container in a compose environment to a process running in a kube pod), but might come at the cost of not re-compiling go services automatically as you edit them.

JoseFdri commented 5 years ago

Hi @efritz, Glad you saw my approach, you know it's tricky to run launch.sh in windows os and get everything setup as the doc requires, I believe taking everything into containers is a excellent way to make Sourcegraph more multi platform, I believe we can replace docker-in-docker with the current docker host.

efritz commented 5 years ago

Sorry I wasn't able to make much progress on this yet. I tried to decompose some of our services into a more sensible docker-compose environment (without continuous compilation), but it was a bit more effort than I expected.

I think what you have is good for local development for the time being. Could you try to experiment a bit with using the docker host (you can mount the docker socket in a container) to replace DinD?