Commit b8f13a73 authored by Ash McKenzie's avatar Ash McKenzie

Support `gdk run` with multiple args

parent 734b2a67
......@@ -3,6 +3,7 @@
gdk run # Start everything
gdk run db # Start enough to run tests
gdk run geo_db # Start Geo tracking database
gdk run db geo_db # Start enough to run tests, including Geo tracking database
gdk run gitaly # Start gitaly (git backend service)
gdk run jobs # Start GitLab background jobs
gdk run grafana # Start Grafana in a separate port
......
# GDK commands
## Running
To start up the GDK with all default enabled services, run:
```sh
gdk run
```
If you'd like to run a specific group of services, you can do so by providing
the service group names as arguments. Multiple arguments are supported:
### Run just DB services
```sh
gdk run db
```
### Run DB and Geo DB services
```sh
gdk run db geo_db
```
## Update gitlab and gitlab-shell repositories
When working on a new feature, always check that your `gitlab` repository is up
......@@ -8,7 +31,7 @@ to date with the upstream master branch.
In order to fetch the latest code, first make sure that `foreman` for
postgres is runnning (needed for db migration) and then run:
```
```sh
gdk update
```
......@@ -29,6 +52,6 @@ remove an individual file (e.g. `rm Procfile`) and rebuild it by
running `make`. If you want to rebuild _all_ configuration files
created by the Makefile, run:
```
```sh
gdk reconfigure
```
......@@ -105,7 +105,7 @@ to operate *as* a primary except in tests where the current Geo node has been
stubbed.
To ensure the tracking database is started, restart GDK. You will need to use
`gdk run`, rather than `gdk run db`, to run the tests.
`gdk run db geo_db` (at a minimum) or `gdk run` to be able to run the tests.
## Copy database encryption key
......
......@@ -106,13 +106,19 @@ Start GitLab and all required services:
gdk run
```
To start only the databases use:
To start only the database services, use:
```sh
gdk run db
```
To start only the app (assuming the DBs are already running):
To start database services and gitaly, use:
```sh
gdk run db gitaly
```
To start only the app (assuming the database services are already running), use:
```sh
gdk run app
......
def main(argv)
case argv[0]
applications = applications_from(argv)
print_url if applications.include?('gitlab-workhorse')
foreman_exec(applications)
end
def applications_from(argv)
exec_thin! if argv[0] == 'thin'
return %w[all] if argv.empty?
argv.each_with_object([]) do |command, all|
all << applications_for(command)
end.flatten.uniq
end
def exec_thin!
exec(
{ 'RAILS_ENV' => 'development' },
*%W[bundle exec thin --socket=#{Dir.pwd}/gitlab.socket start],
chdir: 'gitlab'
)
end
def applications_for(command)
case command
when 'db'
foreman_exec(%w[redis postgresql openldap influxdb webpack registry minio elasticsearch jaeger])
%w[redis postgresql openldap influxdb webpack registry minio elasticsearch jaeger]
when 'geo_db'
foreman_exec(%w[postgresql-geo])
%w[postgresql-geo]
when 'app'
svcs = %w[gitlab-workhorse nginx grafana sshd gitaly storage-check gitlab-pages praefect]
foreman_exec(svcs + %w[rails-web rails-background-jobs])
%w[gitlab-workhorse nginx grafana sshd gitaly storage-check gitlab-pages praefect rails-web rails-background-jobs]
when 'grafana'
foreman_exec(%w[grafana])
when 'thin'
exec(
{ 'RAILS_ENV' => 'development' },
*%W[bundle exec thin --socket=#{Dir.pwd}/gitlab.socket start],
chdir: 'gitlab'
)
%w[grafana]
when 'gitaly'
foreman_exec(%w[gitaly])
%w[gitaly]
when 'jobs'
foreman_exec(%w[rails-background-jobs])
when nil
print_url
foreman_exec(%w[all])
%w[rails-background-jobs]
else
puts
puts "GitLab Development Kit does not recognize this command."
puts "GitLab Development Kit does not recognize command '#{command}'."
puts "Make sure you are using the latest version or check available commands with: \`gdk help\` "
puts
exit 1
......@@ -34,11 +47,13 @@ end
def foreman_exec(svcs = [], exclude: [])
args = %w[ruby lib/daemonizer.rb foreman start]
unless svcs.empty? && exclude.empty?
args << '-m'
svc_string = ['all=0', svcs.map { |svc| svc + '=1' }, exclude.map { |svc| svc + '=0' }].join(',')
args << svc_string
end
exec({
'GITLAB_TRACING' => 'opentracing://jaeger?http_endpoint=http%3A%2F%2Flocalhost%3A14268%2Fapi%2Ftraces&sampler=const&sampler_param=1',
'GITLAB_TRACING_URL' => 'http://localhost:16686/search?service={{ service }}&tags=%7B"correlation_id"%3A"{{ correlation_id }}"%7D'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment