-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat(readme): Add config section to readme #234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
297c528
add config section to readme
hubertdeng123 e7cbe1f
include details on bind mounts
hubertdeng123 9589389
add missing space
hubertdeng123 3269da8
mode field belongs in remote block
hubertdeng123 4383f7d
some further tweaks
hubertdeng123 f0197db
add examples
hubertdeng123 622cec9
add more generic command
hubertdeng123 1f05326
add config section underneath installation
hubertdeng123 ce3abe6
add some more details under installation section
hubertdeng123 3c9ce3a
clearly define the two steps for installation
hubertdeng123 635d8c3
lower case things to keep consistent
hubertdeng123 dc01a9c
clean up readme and make things a bit more clear
hubertdeng123 d0f91d6
Merge branch 'main' into hubertdeng123/add-config-section-readme
hubertdeng123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,15 +6,6 @@ A standalone cli tool used to manage dependencies for services. It simplifies th | |
|
|
||
| `devservices` reads configuration files located in the `devservices` directory of your repository. These configurations define services, their dependencies, and various modes of operation. | ||
|
|
||
| ## Installation | ||
|
|
||
| The recommended way to install devservices is through a virtualenv in the requirements.txt. | ||
|
|
||
| ``` | ||
| devservices==1.0.16 | ||
| ``` | ||
|
|
||
|
|
||
| ## Usage | ||
|
|
||
| devservices provides several commands to manage your services: | ||
|
|
@@ -31,3 +22,122 @@ NOTE: service-name is an optional parameter. If not provided, devservices will a | |
| - `devservices list-dependencies <service-name>`: List all dependencies for a service and whether they are enabled/disabled. | ||
| - `devservices update` Update devservices to the latest version. | ||
| - `devservices purge`: Purge the local devservices cache. | ||
|
|
||
| ## Installation | ||
|
|
||
| ### 1. Add devservices to your requirements.txt | ||
|
|
||
| The recommended way to install devservices is through a virtualenv in the requirements.txt. Once that is installed and a devservices config file is added, you should be able to run `devservices up` to begin local development. | ||
|
|
||
| ``` | ||
| devservices==1.0.16 | ||
| ``` | ||
|
|
||
| ### 2. Add devservices config files | ||
|
|
||
| Each repo should have a `devservices` directory with a `config.yml` file. This file is used to define services, dependencies, and modes. Other files and subdirectories in the `devservices` directory are optional and can be most commonly used for volume mounts. | ||
|
|
||
| The configuration file is a yaml file that looks like this: | ||
|
|
||
| ```yaml | ||
| # This is a yaml block that holds devservices specific configuration settings. This is comprised of a few main sections: | ||
| # - version: The version of the devservices config file. This is used to ensure compatibility between devservices and the config file. | ||
| # - service_name: The name of the service. This is used to identify the service in the config file. | ||
| # - dependencies: A list of dependencies for the service. Each dependency is a yaml block that holds the dependency configuration. There are two types of dependencies: | ||
| # - local: A dependency that is defined in the config file. These dependencies do not have a remote field. | ||
|
||
| # - remote: A dependency that is defined in the devservices directory in a remote repository. These configs are automatically fetched from the remote repository and installed. Any dependency with a remote field will be treated as a remote dependency. Example: https://github.com/getsentry/snuba/blob/59a5258ccbb502827ebc1d3b1bf80c607a3301bf/devservices/config.yml#L8 | ||
| # - modes: A list of modes for the service. Each mode includes a list of dependencies that are enabled in that mode. | ||
hubertdeng123 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| x-sentry-service-config: | ||
| version: 0.1 | ||
| service_name: example-service | ||
| dependencies: | ||
| example-dependency-1: | ||
| description: Example dependency defined in the config file | ||
| example-dependency-2: | ||
| description: Example dependency defined in the config file | ||
| example-remote-dependency: | ||
| description: Remote dependency defined in the `devservices` directory in the example-repository repo | ||
| remote: | ||
| repo_name: example-repository | ||
| branch: main | ||
| repo_link: https://github.com/getsentry/example-repository.git | ||
| mode: default # Optional field, mode to run remote dependency in that defaults to `default` | ||
| modes: | ||
| default: [example-dependency-1, example-remote-dependency] | ||
| custom-mode: [example-dependency-1, example-dependency-2, example-remote-dependency] | ||
|
|
||
| # This will be a standard block used by docker compose to define dependencies. | ||
| # | ||
| # The following fields are important to all dependencies: | ||
| # - image: The docker image to use for the dependency. | ||
| # - ports: The ports to expose for the dependency. Please only expose ports to localhost(127.0.0.1) | ||
| # - healthcheck: The docker healthcheck to use for the dependency. | ||
| # - environment: The environment variables to set for the dependency. | ||
| # - extra_hosts: The extra hosts to add to the dependency. | ||
| # - networks: The networks to add to the dependency. In order for devservices to work properly, the dependency must be on the `devservices` network. | ||
| # - labels: The labels to add to the dependency. The `orchestrator=devservices` label is required for devservices to determine a container is managed by devservices. | ||
| # - restart: The restart policy to use for the dependency. | ||
| # | ||
| # These fields are optional: | ||
| # - ulimits: The ulimits to set for the dependency. This is useful for setting resource constraints for the dependency. | ||
| # - volumes: The volumes to mount for the dependency. This is useful for mounting data volumes for the dependency if data should be persisted between runs. It can also be useful to use a bind mount to mount a local directory into a container. Example of bind mounting clickhouse configs from a local directory https://github.com/getsentry/snuba/blob/59a5258ccbb502827ebc1d3b1bf80c607a3301bf/devservices/config.yml#L44 | ||
| # - command: The command to run for the dependency. This can override the default command for the docker image. | ||
| # For more information on the docker compose file services block, see the docker compose file reference: https://docs.docker.com/reference/compose-file/services/ | ||
| services: | ||
| example-dependency-1: | ||
| image: ghcr.io/getsentry/example-dependency-1:1.0.0 | ||
| ulimits: | ||
| nofile: | ||
| soft: 262144 | ||
| hard: 262144 | ||
| ports: | ||
| - 127.0.0.1:1234:1234 | ||
| healthcheck: | ||
| test: wget -q -O - http://localhost:1234/health | ||
| interval: 5s | ||
| timeout: 5s | ||
| retries: 3 | ||
| environment: | ||
| EXAMPLE_ENV_VAR: example-value | ||
| volumes: | ||
| - example-dependency-1-data:/var/lib/example-dependency-1 | ||
| extra_hosts: | ||
| host.docker.internal: host-gateway | ||
| networks: | ||
| - devservices | ||
| labels: | ||
| - orchestrator=devservices | ||
| restart: unless-stopped | ||
|
|
||
| example-dependency-2: | ||
| image: ghcr.io/getsentry/example-dependency-2:1.0.0 | ||
| ports: | ||
| - 127.0.0.1:2345:2345 | ||
| command: ["devserver"] | ||
| healthcheck: | ||
| test: curl -f http://localhost:2345/health | ||
| interval: 5s | ||
| timeout: 5s | ||
| retries: 3 | ||
| environment: | ||
| EXAMPLE_ENV_VAR: example-value | ||
| extra_hosts: | ||
| host.docker.internal: host-gateway | ||
| networks: | ||
| - devservices | ||
| labels: | ||
| - orchestrator=devservices | ||
hubertdeng123 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| restart: unless-stopped | ||
|
|
||
| # This is a standard block used by docker compose to define volumes. | ||
| # For more information, see the docker compose file reference: https://docs.docker.com/reference/compose-file/volumes/ | ||
| volumes: | ||
| example-dependency-1-data: | ||
|
|
||
| # This is a standard block used by docker compose to define networks. Defining the devservices network is required for devservices to work properly. By default, devservices will create an external network called `devservices` that is used to connect all dependencies. | ||
| # For more information, see the docker compose file reference: https://docs.docker.com/reference/compose-file/networks/ | ||
| networks: | ||
| devservices: | ||
| name: devservices | ||
| external: true | ||
| ``` | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.