Skip to content
Snippets Groups Projects
Commit 3fd2f7d5 authored by Jacob Vosmaer (GitLab)'s avatar Jacob Vosmaer (GitLab)
Browse files

Merge branch 'gdk-cli' into 'master'

Add 'gdk' command wrapper and gem

Combine `make` and `./run` into `gdk`. Can be invoked as `gdk`, e.g. `gdk run db`.

This does not remove `make` and `./run`, it just adds an integrated wrapper.

Installation become:

```
gem install gitlab-development-kit
gdk init # clones repo
cd gitlab-development-kit
gdk install gitlab_repo=https://bla
```

See merge request !174
parents 05bf0c2a bea998ee
No related branches found
No related tags found
1 merge request!174Add 'gdk' command wrapper and gem
Loading
Loading
@@ -43,3 +43,4 @@
/nginx/uwsgi_temp
/.gitlab-shell-bundle
/.gitlab-bundle
/*.gem
Loading
Loading
@@ -51,14 +51,15 @@ resource:
 
echo _KD_NOTIFY_@Cloning GitLab repository...@
# clone and run gitlab
git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git
gem install gitlab-development-kit
gdk init
 
# force to use 0.0.0.0 for localhost
echo "0.0.0.0" > gitlab-development-kit/host
 
echo _KD_NOTIFY_@Compiling GitLab...@
cd gitlab-development-kit
make
gdk install
 
EOF
 
Loading
Loading
@@ -70,7 +71,7 @@ resource:
echo ""
echo "Now launch a new terminal and do;"
echo " $ cd gitlab-development-kit"
echo " $ ./run"
echo " $ gdk run"
echo ""
 
echo _KD_DONE_
Loading
Loading
# GitLab Development Kit cheat sheet
 
./run # Start everything
./run db # Start enough to run tests
./run app # Start GitLab, need './run db'
gdk run # Start everything
gdk run db # Start enough to run tests
gdk run app # Start GitLab, needs 'gdk run db'
 
make gitlab_repo=https://my-fork # Install everything
make update # Pull application changes from Git
make clean-config all # Delete and regenerate all config files created by GDK
gdk install gitlab_repo=https://my-fork # Install everything
gdk update # Pull application changes from Git
gdk reconfigure # Delete and regenerate all config files created by GDK
 
# Development admin account: root / 5iveL!fe
bin/gdk 0 → 100755
#!/usr/bin/env ruby
require 'fileutils'
# Gitlab Development Kit CLI launcher
#
# Note to contributors: this script must not change (much) because it is
# installed outside the gitlab-development-kit repository with 'gem
# install'. Edit lib/gdk.rb to define new commands.
def main
case ARGV.first
when 'init'
if ARGV.count > 2
puts "Usage: gdk init [DIR]"
return false
end
cmd = %W(git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git)
cmd << ARGV[1] if ARGV.count == 2
system(*cmd)
else
$gdk_root = find_root(Dir.pwd)
if $gdk_root.nil?
puts "Could not find GDK_ROOT in the current directory or any of its parents."
return false
end
puts "(in #{$gdk_root})"
load(File.join($gdk_root, 'lib/gdk.rb'))
GDK::main
end
end
def find_root(current)
if File.exist?(File.join(current, 'GDK_ROOT'))
File.realpath(current)
elsif File.realpath(current) == '/'
nil
else
find_root(File.join(current, '..'))
end
end
exit(main)
Loading
Loading
@@ -5,7 +5,7 @@ quickest way to do it.
 
```
cd gitlab-development-kit
./run
gdk run
```
 
Open [localhost:3000](http://localhost:3000) in your web browser. It
Loading
Loading
Loading
Loading
@@ -15,8 +15,8 @@ On OS X you can add this certificate to the trust store with:
Next make sure that HTTPS is enabled in gitlab/config/gitlab.yml: look
for the `https:` and `port:` settings.
 
Uncomment the `nginx` line in your Procfile. Now `./run app`
(and `./run`) will start NGINX listening on https://localhost:3443.
Uncomment the `nginx` line in your Procfile. Now `gdk run app`
(and `gdk run`) will start NGINX listening on https://localhost:3443.
 
If you are using a port other than localhost:3000 for
gitlab-workhorse, or if you want to use a port other than
Loading
Loading
Loading
Loading
@@ -6,12 +6,12 @@ application then run:
 
```
echo 0.0.0.0 > host
./run
gdk run
```
 
If you would like to revert back to the `localhost` network then run:
 
```
rm host
./run
gdk run
```
Loading
Loading
@@ -10,7 +10,7 @@ Golang compiler and NPM installed. InfluxDB and Grafana consume about
You need to have a working GDK installation before you install InfluxDB
and Grafana.
 
First make sure you do not have `./run` active anywhere. Then run:
First make sure you do not have `gdk run` active anywhere. Then run:
 
rm Procfile
make performance-metrics-setup
Loading
Loading
Loading
Loading
@@ -12,6 +12,6 @@ development server (localhost:3000) you need to comment out the
`rails-web:` line in the Procfile in your GDK root directory because
Unicorn is not compatible with Pry.
 
Then launch GDK as usual (e.g. with `./run`) and in a separate
terminal run: `./run thin`. Your Pry prompts will appear in the window
Then launch GDK as usual (e.g. with `gdk run`) and in a separate
terminal run: `gdk run thin`. Your Pry prompts will appear in the window
that runs Thin.
Loading
Loading
@@ -8,11 +8,12 @@ contain 'problematic' characters such as ` ` and `(`. For example,
cause problems.
 
```
git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git
gem install gitlab-development-kit
gdk init
cd gitlab-development-kit
```
 
The `Makefile` will clone the repositories, install the Gem bundles and set up
The `gdk install` command will clone the repositories, install the Gem bundles and set up
basic configuration files. Pick one:
 
## Develop in a fork
Loading
Loading
@@ -20,19 +21,19 @@ basic configuration files. Pick one:
```
# Set up GDK with 'origin' pointing to your gitlab-ce fork.
# Replace MY-FORK with your namespace
make gitlab_repo=https://gitlab.com/MY-FORK/gitlab-ce.git
gdk install gitlab_repo=https://gitlab.com/MY-FORK/gitlab-ce.git
support/set-gitlab-upstream
```
 
The set-gitlab-upstream script creates a remote named `upstream` for
[the canonical GitLab CE
repository](https://gitlab.com/gitlab-org/gitlab-ce). It also modifies
`make update` (See [Update gitlab and gitlab-shell
`gdk update` (See [Update gitlab and gitlab-shell
repositories](Update gitlab and gitlab-shell repositories)) to pull
down from the upstream repository instead of your fork, making it
easier to keep up-to-date with the project.
 
If you want to push changes from upstream to your fork, run `make
If you want to push changes from upstream to your fork, run `gdk
update` and then `git push origin` from the `gitlab` directory.
 
## Develop in the main repo
Loading
Loading
@@ -41,7 +42,7 @@ Alternatively, you can clone all components from their official source.
 
```
# Clone your own forked repositories
make
gdk install
```
 
 
Loading
Loading
@@ -56,13 +57,14 @@ instead of 3000 so that you can run GDK EE next to CE without port
conflicts.
 
```
git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git gdk-ee
gem install gdk
gdk init gdk-ee
cd gdk-ee
echo 3001 > port
make gitlab_repo=https://gitlab.com/gitlab-org/gitlab-ee.git
gdk install gitlab_repo=https://gitlab.com/gitlab-org/gitlab-ee.git
```
 
Now you can start GitLab EE with `./run` in the `gdk-ee` directory and you
Now you can start GitLab EE with `gdk run` in the `gdk-ee` directory and you
will not have port conflicts with a separate GDK instance for CE that
might still be running.
 
Loading
Loading
@@ -73,15 +75,15 @@ onboarding document: https://about.gitlab.com/handbook/developer-onboarding/#git
 
Start GitLab and all required services:
 
./run
gdk run
 
To start only the databases use:
 
./run db
gdk run db
 
To start only the app (assuming the DBs are already running):
 
./run app
gdk run app
 
To access GitLab you may now go to http://localhost:3000 in your
browser. The development login credentials are `root` and `5iveL!fe`.
Loading
Loading
# coding: utf-8
Gem::Specification.new do |spec|
spec.name = "gitlab-development-kit"
spec.version = '0.1.1'
spec.authors = ["Jacob Vosmaer"]
spec.email = ["jacob@gitlab.com"]
spec.summary = %q{CLI for GitLab Development Kit}
spec.description = %q{CLI for GitLab Development Kit.}
spec.homepage = "https://gitlab.com/gitlab-org/gitlab-development-kit"
spec.license = "MIT"
spec.files = []
spec.executables = ['gdk']
end
# GitLab Development Kit CLI parser / executor
module GDK
PROGNAME = 'gdk'
# This function is called from bin/gdk. It must return true/false or
# an exit code.
def self.main
case ARGV.shift
when 'run'
system('./run', *ARGV, chdir: $gdk_root)
when 'install'
system('make', *ARGV, chdir: $gdk_root)
when 'update'
system('make', 'update', chdir: $gdk_root)
when 'reconfigure'
system('make', 'clean-config', 'all', chdir: $gdk_root)
when 'help'
puts File.read(File.join($gdk_root, 'HELP'))
true
else
puts "Usage: #{PROGNAME} run|init|install|update|reconfigure|help [ARGS...]"
false
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment