This instance will be upgraded to Heptapod 0.27.1 on 2021-12-02 at 15:00 UTC+1 (a few minutes of down time)

Commit ae963f25 authored by Douwe Maan's avatar Douwe Maan
Browse files

Merge branch 'sh-remove-koding' into 'master'

Remove Koding integration and documentation

Closes #39697

See merge request gitlab-org/gitlab-ce!22334
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="" viewBox="0 0 12 14">
<g fill="#d6d7d9">
<path d="M8.7 0L5.3.3l3.2 6.8-3.2 6.6 3.5.3L12 6.9z"/>
<ellipse cx="1.7" cy="11.1" rx="1.7" ry="1.7"/>
<ellipse cx="1.7" cy="5.6" rx="1.7" ry="1.7"/>
\ No newline at end of file
# frozen_string_literal: true
class KodingController < ApplicationController
before_action :check_integration!
layout 'koding'
def index
path = File.join(Rails.root, 'doc/user/project/')
@markdown =
def check_integration!
render_404 unless Gitlab::CurrentSettings.koding_enabled?
......@@ -7,7 +7,6 @@ module ApplicationSettingsHelper
to: :'Gitlab::CurrentSettings.current_application_settings'
def user_oauth_applications?
......@@ -155,8 +154,6 @@ def visible_attributes
......@@ -388,22 +388,6 @@ def project_last_activity(project)
def koding_project_url(project = nil, branch = nil, sha = nil)
if project
import_path = "/Home/Stacks/import"
repo = project.full_path
branch ||= project.default_branch
sha ||= project.commit.short_id
path = "#{import_path}?repo=#{repo}&branch=#{branch}&sha=#{sha}"
return URI.join(Gitlab::CurrentSettings.koding_url, path).to_s
def project_wiki_path_with_version(proj, page, version, is_newest)
url_params = is_newest ? {} : { version_id: version }
project_wiki_path(proj, page, url_params)
......@@ -33,6 +33,8 @@ class ApplicationSetting < ActiveRecord::Base
ignore_column :circuitbreaker_storage_timeout
ignore_column :circuitbreaker_access_retries
ignore_column :circuitbreaker_check_interval
ignore_column :koding_url
ignore_column :koding_enabled
cache_markdown_field :sign_in_text
cache_markdown_field :help_page_text
......@@ -100,10 +102,6 @@ class ApplicationSetting < ActiveRecord::Base
presence: true,
if: :unique_ips_limit_enabled
validates :koding_url,
presence: true,
if: :koding_enabled
validates :plantuml_url,
presence: true,
if: :plantuml_enabled
......@@ -252,8 +250,6 @@ def self.defaults
housekeeping_gc_period: 200,
housekeeping_incremental_repack_period: 10,
import_sources: Settings.gitlab['import_sources'],
koding_enabled: false,
koding_url: nil,
max_artifacts_size: Settings.artifacts['max_size'],
max_attachment_size: Settings.gitlab['max_attachment_size'],
mirror_available: true,
......@@ -36,7 +36,7 @@ class Repository
# For example, for entry `:commit_count` there's a method called `commit_count` which
# stores its data in the `commit_count` cache key.
CACHED_METHODS = %i(size commit_count rendered_readme contribution_guide
changelog license_blob license_key gitignore koding_yml
changelog license_blob license_key gitignore
gitlab_ci_yml branch_names tag_names branch_count
tag_count avatar exists? root_ref has_visible_content?
issue_template_names merge_request_template_names xcode_project?).freeze
......@@ -53,7 +53,6 @@ class Repository
license: %i(license_blob license_key license),
contributing: :contribution_guide,
gitignore: :gitignore,
koding: :koding_yml,
gitlab_ci: :gitlab_ci_yml,
avatar: :avatar,
issue_template: :issue_template_names,
......@@ -619,11 +618,6 @@ def gitignore
cache_method :gitignore
def koding_yml
cache_method :koding_yml
def gitlab_ci_yml
......@@ -36,8 +36,7 @@ def statistics_buttons(show_auto_devops_callout:)
autodevops_anchor_data(show_auto_devops_callout: show_auto_devops_callout),
].compact.reject { |item| item.enabled }
......@@ -125,43 +124,6 @@ def add_readme_path
add_special_file_path(file_name: '')
def add_koding_stack_path
default_branch || 'master',
file_name: '.koding.yml',
commit_message: "Add Koding stack script",
content: <<-CONTENT.strip_heredoc
access_key: '${var.aws_access_key}'
secret_key: '${var.aws_secret_key}'
instance_type: t2.nano
user_data: |-
# Created by GitLab UI for :>
echo _KD_NOTIFY_@Installing Base packages...@
apt-get update -y
apt-get install git -y
echo _KD_NOTIFY_@Cloning #{}...@
export KODING_USER=${var.koding_user_username}
export REPO_URL=#{root_url}${var.koding_queryString_repo}.git
export BRANCH=${var.koding_queryString_branch}
sudo -i -u $KODING_USER git clone $REPO_URL -b $BRANCH
echo _KD_NOTIFY_@#{} cloned.@
def license_short_name
license = repository.license
license&.nickname || license&.name || 'LICENSE'
......@@ -310,14 +272,6 @@ def gitlab_ci_anchor_data
def koding_anchor_data
if current_user && can_current_user_push_code? && koding_enabled? && repository.koding_yml.blank?,
_('Set up Koding'),
def tags_to_show
project.tag_list.take(MAX_TAGS_TO_SHOW) # rubocop: disable CodeReuse/ActiveRecord
......@@ -363,8 +317,4 @@ def add_special_file_path(file_name:, commit_message: nil, branch_name: nil)
branch_name: branch_name
def koding_enabled?
= form_for @application_setting, url: admin_application_settings_path(anchor: 'js-koding-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting)
= f.check_box :koding_enabled, class: 'form-check-input'
= f.label :koding_enabled, class: 'form-check-label' do
Enable Koding
Koding integration has been deprecated since GitLab 10.0. If you disable your Koding integration, you will not be able to enable it again.
= f.label :koding_url, 'Koding URL', class: 'label-bold'
= f.text_field :koding_url, class: 'form-control', placeholder: ''
Koding has integration enabled out of the box for the
%strong gitlab
team, and you need to provide that team's URL here. Learn more in the
= succeed "." do
= link_to "Koding administration documentation", help_page_path("administration/integration/koding")
= f.submit 'Save changes', class: "btn btn-success"
......@@ -68,18 +68,6 @@
= render 'terms'
- if koding_enabled?{ class: ('expanded' if expanded_by_default?) }
= _('Koding')
%button.btn.btn-default.js-settings-toggle{ type: 'button' }
= expanded_by_default? ? _('Collapse') : _('Expand')
= _('Online IDE integration settings.')
= render 'koding'
= render_if_exists 'admin/application_settings/external_authorization_service_form', expanded: expanded_by_default?{ class: ('expanded' if expanded_by_default?) }
= icon('circle', class: 'cgreen')
Integration is active for
= link_to koding_project_url, target: '_blank', rel: 'noopener noreferrer' do
- page_title _("Koding")
- page_description _("Koding Dashboard")
- header_title _("Koding"), koding_path
= render template: "layouts/application"
......@@ -76,8 +76,6 @@
= render 'projects/buttons/download', project: @project, ref: @ref
= render 'projects/buttons/dropdown'
= render 'projects/buttons/koding'
= render 'shared/notifications/button', notification_setting: @notification_setting
- if koding_enabled? && current_user && @repository.koding_yml && @project.can_current_user_push_code?
= link_to koding_project_url(@project), class: 'btn project-action-button inline', target: '_blank', rel: 'noopener noreferrer' do
_('Run in IDE (Koding)')
title: Remove Koding integration and documentation
merge_request: 22334
type: removed
......@@ -81,9 +81,6 @@
draw :instance_statistics
# Koding route
get 'koding' => 'koding#index'
draw :api
draw :sidekiq
draw :help
# frozen_string_literal: true
class RemoveKodingFromApplicationSettings < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def up
remove_column :application_settings, :koding_enabled
remove_column :application_settings, :koding_url
def down
add_column :application_settings, :koding_enabled, :boolean # rubocop:disable Migration/SaferBooleanColumn
add_column :application_settings, :koding_url, :string
......@@ -11,7 +11,7 @@
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20181008200441) do
ActiveRecord::Schema.define(version: 20181013005024) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......@@ -104,8 +104,6 @@
t.boolean "domain_blacklist_enabled", default: false
t.text "domain_blacklist"
t.boolean "usage_ping_enabled", default: true, null: false
t.boolean "koding_enabled"
t.string "koding_url"
t.text "sign_in_text_html"
t.text "help_page_text_html"
t.text "shared_runners_text_html"
# Koding & GitLab
> **Notes:**
> - **As of GitLab 10.0, the Koding integration is deprecated and will be removed
> in a future version. The option to configure it is removed from GitLab's admin
> area.**
> - [Introduced][ce-5909] in GitLab 8.11.
This document will guide you through installing and configuring Koding with
First of all, to be able to use Koding and GitLab together you will need public
access to your server. This allows you to use single sign-on from GitLab to
Koding and using vms from cloud providers like AWS. Koding has a registry for
VMs, called Kontrol and it runs on the same server as Koding itself, VMs from
cloud providers register themselves to Kontrol via the agent that we put into
provisioned VMs. This agent is called Klient and it provides Koding to access
and manage the target machine.
Kontrol and Klient are based on another technology called
[Kite](, that we have written at Koding. Which is a
microservice framework that allows you to develop microservices easily.
## Requirements
### Hardware
Minimum requirements are;
- 2 cores CPU
- 3G RAM
- 10G Storage
If you plan to use AWS to install Koding it is recommended that you use at
least a `c3.xlarge` instance.
### Software
- [Git](
- [Docker](
- [docker-compose](
Koding can run on most of the UNIX based operating systems, since it's shipped
as containerized with Docker support, it can work on any operating system that
supports Docker.
Required services are:
- **PostgreSQL** - Kontrol and Service DB provider
- **MongoDB** - Main DB provider the application
- **Redis** - In memory DB used by both application and services
- **RabbitMQ** - Message Queue for both application and services
which are also provided as a Docker container by Koding.
## Getting Started with Development Versions
### Koding
You can run `docker-compose` environment for developing koding by
executing commands in the following snippet.
git clone
cd koding
docker-compose -f docker-compose-init.yml run init
docker-compose up
This should start koding on `localhost:8090`.
By default there is no team exists in Koding DB. You'll need to create a team
called `gitlab` which is the default team name for GitLab integration in the
configuration. To make things in order it's recommended to create the `gitlab`
team first thing after setting up Koding.
### GitLab
To install GitLab to your environment for development purposes it's recommended
to use GitLab Development Kit which you can get it from
After all those steps, gitlab should be running on `localhost:3000`
## Integration
Integration includes following components;
- Single Sign On with OAuth from GitLab to Koding
- System Hook integration for handling GitLab events on Koding
(`project_created`, `user_joined` etc.)
- Service endpoints for importing/executing stacks from GitLab to Koding
(`Run/Try on IDE (Koding)` buttons on GitLab Projects, Issues, MRs)
As it's pointed out before, you will need public access to this machine that
you've installed Koding and GitLab on. Better to use a domain but a static IP
is also fine.
For IP based installation you can use []( service which is
free and provides DNS resolution to IP based requests like following;
- -> resolves to
- -> resolves to
- and so on...
As Koding needs subdomains for team names; `` requests for
a running koding instance on `` server will be handled as `foo` team
### GitLab Side
You need to enable Koding integration from Settings under Admin Area. To do
that login with an Admin account and do followings;
- open [](
- scroll to bottom of the page until Koding section
- check `Enable Koding` checkbox
- provide GitLab team page for running Koding instance as `Koding URL`*
* For `Koding URL` you need to provide the gitlab integration enabled team on
your Koding installation. Team called `gitlab` has integration on Koding out
of the box, so if you didn't change anything your team on Koding should be
So, if your Koding is running on `` your URL needs
to be ``. You need to provide the same host
with your Koding installation here.
#### Registering Koding for OAuth integration
We need `Application ID` and `Secret` to enable login to Koding via GitLab
feature and to do that you need to register running Koding as a new application
to your running GitLab application. Follow
[these]( steps to
enable this integration.
Redirect URI should be `http://gitlab.`
which again you need to _replace `` with your instance public IP._
Take a copy of `Application ID` and `Secret` that is generated by the GitLab
application, we will need those on _Koding Part_ of this guide.
#### Registering system hooks to Koding (optional)
Koding can take actions based on the events generated by GitLab application.
This feature is still in progress and only following events are processed by
Koding at the moment;
- user_create
- user_destroy
All system events are handled but not implemented on Koding side.
To enable this feature you need to provide a `URL` and a `Secret Token` to your
GitLab application. Open your admin area on your GitLab app from
and provide `URL` as `http://gitlab.` which is the
endpoint to handle GitLab events on Koding side. Provide a `Secret Token` and
keep a copy of it, we will need it on _Koding Part_ of this guide.
_(replace `` with your instance public IP)_
### Koding Part
If you followed the steps in GitLab part we should have followings to enable
Koding part integrations;
- `Application ID` and `Secret` for OAuth integration
- `Secret Token` for system hook integration
- Public address of running GitLab instance
#### Start Koding with GitLab URL
Now we need to configure Koding with all this information to get things ready.
If it's already running please stop koding first.
##### From command-line
Replace followings with the ones you got from GitLab part of this guide;
cd koding
docker-compose run \
--service-ports backend \
/opt/koding/scripts/bootstrap-container build \
--host=**YOUR_IP** \
--gitlabHost=**GITLAB_IP** \
--gitlabPort=**GITLAB_PORT** \
--gitlabToken=**SECRET_TOKEN** \
--gitlabAppId=**APPLICATION_ID** \
##### By updating configuration
Alternatively you can update `gitlab` section on
`config/` like following;
gitlab =
host: '**GITLAB_IP**'
port: '**GITLAB_PORT**'
applicationId: '**APPLICATION_ID**'
applicationSecret: '**SECRET**'
team: 'gitlab'
redirectUri: ''
systemHookToken: '**SECRET_TOKEN**'
hooksEnabled: yes
and start by only providing the `host`;
cd koding
docker-compose run \
--service-ports backend \
/opt/koding/scripts/bootstrap-container build \
--host=**YOUR_IP** \
#### Enable Single Sign On
Once you restarted your Koding and logged in with your username and password
you need to activate oauth authentication for your user. To do that
- Navigate to Dashboard on Koding from;
- Scroll down to Integrations section
- Click on toggle to turn On integration in GitLab integration section
This will redirect you to your GitLab instance and will ask your permission (
if you are not logged in to GitLab at this point you will be redirected after
login) once you accept you will be redirected to your Koding instance.
From now on you can login by using `SIGN IN WITH GITLAB` button on your Login
screen in your Koding instance.
......@@ -49,8 +49,6 @@ Example response:
"sign_in_text" : null,
"container_registry_token_expire_delay": 5,
"repository_storages": ["default"],
"koding_enabled": false,
"koding_url": null,
"plantuml_enabled": false,
"plantuml_url": null,
"terminal_max_session_time": 0,
......@@ -107,8 +105,6 @@ Example response:
"after_sign_out_path": "",
"container_registry_token_expire_delay": 5,
"repository_storages": ["default"],
"koding_enabled": false,
"koding_url": null,
"plantuml_enabled": false,
"plantuml_url": null,
"terminal_max_session_time": 0,
......@@ -179,8 +175,6 @@ are listed in the descriptions of the relevant settings.
| `html_emails_enabled` | boolean | no | Enable HTML emails. |
| `instance_statistics_visibility_private` | boolean | no | When set to `true` Instance statistics will only be available to admins. |
| `import_sources` | array of strings | no | Sources to allow project import from, possible values: `github`, `bitbucket`, `gitlab`, `google_code`, `fogbugz`, `git`, and `gitlab_project`. |
| `koding_enabled` | boolean | no | (If enabled, requires: `koding_url`) Enable Koding integration. Default is `false`. |
| `koding_url` | string | required by: `koding_enabled` | The Koding instance URL for integration. |
| `max_artifacts_size` | integer | no | Maximum artifacts size in MB |
| `max_attachment_size` | integer | no | Limit attachment size in MB |
| `max_pages_size` | integer | no | Maximum size of pages repositories in MB |
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