Commit a927a9bf authored by Gokmen Goksel's avatar Gokmen Goksel Committed by Stan Hu

Support integration with Koding (online IDE)

Koding: #index: landing page for Koding integration

If enabled it will provide a link to open remote Koding instance url
for now we are also providing the sneak preview video for how
integration works in detail.

Repository: check whether .koding.yml file exists on repository

Projects: landing page: show Run in IDE (Koding) button if repo has stack file

Projects: MR: show Run in IDE Koding button if repo has stack file on active branch

ProjectHelpers: add_koding_stack: stack generator for provided project

With this helper we will auto-generate the required stack template
for a given project. For the feature we can request this base template
from the running Koding instance on integration.

Currently this will provide users to create a t2.nano instance on aws
and it'll automatically configures the instance for basic requirements.

Projects: empty state and landing page provide shortcuts to create stack

projects_helper: use branch on checkout and provide an entry point

This ${var.koding_queryString_branch} will be replaced with the branch
provided in query string which will allow us to use same stack template
for different branches of the same repository.

ref: https://github.com/koding/koding/pull/8597/commits/b8c0e43c4c24bf132670aa8a3cfb0d634acfd09b

projects_helper: provide sha info in query string to use existing vms

With this change we'll be able to query existing vms on Koding side
based on the commit id that they've created.

ref: https://github.com/koding/koding/pull/8597/commits/1d630fadf31963fa6ccd3bed92e526761a30a343

Integration: Docs: Koding documentation added

Disable /koding route if integration is disabled

Use application settings to enable Koding

Projects_helper: better indentation with strip_heredoc usage

Projects_helper: return koding_url as is if there is no project provided

current_settings: set koding_enabled: false by default

Koding_Controller: to render not_found once integration is disabled

Dashboard_specs: update spec for Koding enabled case

Projects_Helper: make repo dynamic

ref: https://github.com/koding/koding/pull/8597/commits/4d615242f45aaea4c4986be84ecc612b0bb1514c

Updated documentation to have right format
parent 66eb0185
...@@ -4,6 +4,7 @@ v 8.11.0 (unreleased) ...@@ -4,6 +4,7 @@ v 8.11.0 (unreleased)
- Use test coverage value from the latest successful pipeline in badge. !5862 - Use test coverage value from the latest successful pipeline in badge. !5862
- Add test coverage report badge. !5708 - Add test coverage report badge. !5708
- Remove the http_parser.rb dependency by removing the tinder gem. !5758 (tbalthazar) - Remove the http_parser.rb dependency by removing the tinder gem. !5758 (tbalthazar)
- Add Koding (online IDE) integration
- Ability to specify branches for Pivotal Tracker integration (Egor Lynko) - Ability to specify branches for Pivotal Tracker integration (Egor Lynko)
- Fix don't pass a local variable called `i` to a partial. !20510 (herminiotorres) - Fix don't pass a local variable called `i` to a partial. !20510 (herminiotorres)
- Add delimiter to project stars and forks count (ClemMakesApps) - Add delimiter to project stars and forks count (ClemMakesApps)
......
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" 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"/>
</g>
</svg>
\ No newline at end of file
...@@ -109,6 +109,8 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -109,6 +109,8 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:sentry_dsn, :sentry_dsn,
:akismet_enabled, :akismet_enabled,
:akismet_api_key, :akismet_api_key,
:koding_enabled,
:koding_url,
:email_author_in_body, :email_author_in_body,
:repository_checks_enabled, :repository_checks_enabled,
:metrics_packet_size, :metrics_packet_size,
......
class KodingController < ApplicationController
before_action :check_integration!, :authenticate_user!, :reject_blocked!
layout 'koding'
def index
path = File.join(Rails.root, 'doc/integration/koding-usage.md')
@markdown = File.read(path)
end
private
def check_integration!
render_404 unless current_application_settings.koding_enabled?
end
end
...@@ -31,6 +31,10 @@ module ApplicationSettingsHelper ...@@ -31,6 +31,10 @@ module ApplicationSettingsHelper
current_application_settings.akismet_enabled? current_application_settings.akismet_enabled?
end end
def koding_enabled?
current_application_settings.koding_enabled?
end
def allowed_protocols_present? def allowed_protocols_present?
current_application_settings.enabled_git_access_protocol.present? current_application_settings.enabled_git_access_protocol.present?
end end
......
...@@ -236,6 +236,60 @@ module ProjectsHelper ...@@ -236,6 +236,60 @@ module ProjectsHelper
) )
end end
def add_koding_stack_path(project)
namespace_project_new_blob_path(
project.namespace,
project,
project.default_branch || 'master',
file_name: '.koding.yml',
commit_message: "Add Koding stack script",
content: <<-CONTENT.strip_heredoc
provider:
aws:
access_key: '${var.aws_access_key}'
secret_key: '${var.aws_secret_key}'
resource:
aws_instance:
#{project.path}-vm:
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 #{project.name}...@
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_@#{project.name} cloned.@
CONTENT
)
end
def koding_project_url(project = nil, branch = nil, sha = nil)
if project
import_path = "/Home/Stacks/import"
repo = project.path_with_namespace
branch ||= project.default_branch
sha ||= project.commit.short_id
path = "#{import_path}?repo=#{repo}&branch=#{branch}&sha=#{sha}"
return URI.join(current_application_settings.koding_url, path).to_s
end
current_application_settings.koding_url
end
def contribution_guide_path(project) def contribution_guide_path(project)
if project && contribution_guide = project.repository.contribution_guide if project && contribution_guide = project.repository.contribution_guide
namespace_project_blob_path( namespace_project_blob_path(
......
...@@ -55,6 +55,10 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -55,6 +55,10 @@ class ApplicationSetting < ActiveRecord::Base
presence: true, presence: true,
if: :akismet_enabled if: :akismet_enabled
validates :koding_url,
presence: true,
if: :koding_enabled
validates :max_attachment_size, validates :max_attachment_size,
presence: true, presence: true,
numericality: { only_integer: true, greater_than: 0 } numericality: { only_integer: true, greater_than: 0 }
...@@ -149,6 +153,8 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -149,6 +153,8 @@ class ApplicationSetting < ActiveRecord::Base
two_factor_grace_period: 48, two_factor_grace_period: 48,
recaptcha_enabled: false, recaptcha_enabled: false,
akismet_enabled: false, akismet_enabled: false,
koding_enabled: false,
koding_url: nil,
repository_checks_enabled: true, repository_checks_enabled: true,
disabled_oauth_sign_in_sources: [], disabled_oauth_sign_in_sources: [],
send_user_confirmation_email: false, send_user_confirmation_email: false,
......
...@@ -277,7 +277,7 @@ class Repository ...@@ -277,7 +277,7 @@ class Repository
def cache_keys def cache_keys
%i(size commit_count %i(size commit_count
readme version contribution_guide changelog readme version contribution_guide changelog
license_blob license_key gitignore) license_blob license_key gitignore koding_yml)
end end
# Keys for data on branch/tag operations. # Keys for data on branch/tag operations.
...@@ -553,6 +553,14 @@ class Repository ...@@ -553,6 +553,14 @@ class Repository
end end
end end
def koding_yml
return nil unless head_exists?
cache.fetch(:koding_yml) do
file_on_head(/\A\.koding\.yml\z/)
end
end
def gitlab_ci_yml def gitlab_ci_yml
return nil unless head_exists? return nil unless head_exists?
......
...@@ -388,6 +388,25 @@ ...@@ -388,6 +388,25 @@
.help-block .help-block
If you got a lot of false alarms from repository checks you can choose to clear all repository check information from the database. If you got a lot of false alarms from repository checks you can choose to clear all repository check information from the database.
%fieldset
%legend Koding
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
= f.label :koding_enabled do
= f.check_box :koding_enabled
Enable Koding
.form-group
= f.label :koding_url, 'Koding URL', class: 'control-label col-sm-2'
.col-sm-10
= f.text_field :koding_url, class: 'form-control', placeholder: 'http://gitlab.your-koding-instance.com:8090'
.help-block
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 integration documentation", help_page_path("integration/koding")
.form-actions .form-actions
= f.submit 'Save', class: 'btn btn-save' = f.submit 'Save', class: 'btn btn-save'
.row-content-block.second-block.center
%p
= icon('circle', class: 'cgreen')
Integration is active for
= link_to koding_project_url, target: '_blank' do
#{current_application_settings.koding_url}
.documentation.wiki
= markdown @markdown
- page_title "Koding"
- page_description "Koding Dashboard"
- header_title "Koding", koding_path
= render template: "layouts/application"
...@@ -12,6 +12,11 @@ ...@@ -12,6 +12,11 @@
= link_to activity_dashboard_path, class: 'dashboard-shortcuts-activity', title: 'Activity' do = link_to activity_dashboard_path, class: 'dashboard-shortcuts-activity', title: 'Activity' do
%span %span
Activity Activity
- if koding_enabled?
= nav_link(controller: :koding) do
= link_to koding_path, title: 'Koding' do
%span
Koding
= nav_link(controller: [:groups, 'groups/milestones', 'groups/group_members']) do = nav_link(controller: [:groups, 'groups/milestones', 'groups/group_members']) do
= link_to dashboard_groups_path, title: 'Groups' do = link_to dashboard_groups_path, title: 'Groups' do
%span %span
......
- if koding_enabled? && current_user && can_push_branch?(@project, @project.default_branch)
- if @repository.koding_yml
= link_to koding_project_url(@project), class: 'btn', target: '_blank' do
Run in IDE (Koding)
- else
= link_to add_koding_stack_path(@project), class: 'btn' do
Set Up Koding
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
- if @merge_request.open? - if @merge_request.open?
.pull-right .pull-right
- if @merge_request.source_branch_exists? - if @merge_request.source_branch_exists?
- if koding_enabled? && @repository.koding_yml
= link_to koding_project_url(@merge_request.source_project, @merge_request.source_branch, @merge_request.commits.first.short_id), class: "btn inline btn-grouped btn-sm", target: '_blank' do
Run in IDE (Koding)
= link_to "#modal_merge_info", class: "btn inline btn-grouped btn-sm", "data-toggle" => "modal" do = link_to "#modal_merge_info", class: "btn inline btn-grouped btn-sm", "data-toggle" => "modal" do
Check out branch Check out branch
......
...@@ -64,10 +64,12 @@ ...@@ -64,10 +64,12 @@
%li.missing %li.missing
= link_to add_special_file_path(@project, file_name: '.gitlab-ci.yml') do = link_to add_special_file_path(@project, file_name: '.gitlab-ci.yml') do
Set Up CI Set Up CI
%li.project-repo-buttons-right %li.project-repo-buttons-right
.project-repo-buttons.project-right-buttons .project-repo-buttons.project-right-buttons
- if current_user - if current_user
= render 'shared/members/access_request_buttons', source: @project = render 'shared/members/access_request_buttons', source: @project
= render "projects/buttons/koding"
.btn-group.project-repo-btn-group .btn-group.project-repo-btn-group
= render "projects/buttons/download" = render "projects/buttons/download"
......
...@@ -90,6 +90,11 @@ Rails.application.routes.draw do ...@@ -90,6 +90,11 @@ Rails.application.routes.draw do
get 'help/ui' => 'help#ui' get 'help/ui' => 'help#ui'
get 'help/*path' => 'help#show', as: :help_page get 'help/*path' => 'help#show', as: :help_page
#
# Koding route
#
get 'koding' => 'koding#index'
# #
# Global snippets # Global snippets
# #
......
class AddKodingToApplicationSettings < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def change
add_column :application_settings, :koding_enabled, :boolean
add_column :application_settings, :koding_url, :string
end
end
...@@ -90,6 +90,8 @@ ActiveRecord::Schema.define(version: 20160818205718) do ...@@ -90,6 +90,8 @@ ActiveRecord::Schema.define(version: 20160818205718) do
t.string "enabled_git_access_protocol" t.string "enabled_git_access_protocol"
t.boolean "domain_blacklist_enabled", default: false t.boolean "domain_blacklist_enabled", default: false
t.text "domain_blacklist" t.text "domain_blacklist"
t.boolean "koding_enabled"
t.string "koding_url"
end end
create_table "audit_events", force: :cascade do |t| create_table "audit_events", force: :cascade do |t|
......
...@@ -15,6 +15,7 @@ See the documentation below for details on how to configure these services. ...@@ -15,6 +15,7 @@ See the documentation below for details on how to configure these services.
- [Gmail actions buttons](gmail_action_buttons_for_gitlab.md) Adds GitLab actions to messages - [Gmail actions buttons](gmail_action_buttons_for_gitlab.md) Adds GitLab actions to messages
- [reCAPTCHA](recaptcha.md) Configure GitLab to use Google reCAPTCHA for new users - [reCAPTCHA](recaptcha.md) Configure GitLab to use Google reCAPTCHA for new users
- [Akismet](akismet.md) Configure Akismet to stop spam - [Akismet](akismet.md) Configure Akismet to stop spam
- [Koding](koding.md) Configure Koding to use IDE integration
GitLab Enterprise Edition contains [advanced Jenkins support][jenkins]. GitLab Enterprise Edition contains [advanced Jenkins support][jenkins].
......
# Koding & GitLab
This document will guide you through using Koding integration on GitLab in
detail. For configuring and installing please follow [this](koding.md) guide.
You can use Koding integration to run and develop your projects on GitLab. This
will allow you and the users to test your project without leaving the browser.
Koding handles projects as stacks which are basic recipes to define your
environment for your project. With this integration you can automatically
create a proper stack template for your projects. Currently auto-generated
stack templates are designed to work with AWS which requires a valid AWS
credential to be able to use these stacks. You can find more information about
stacks and the other providers that you can use on Koding from
[here](https://www.koding.com/docs).
# Enable Integration
You can enable Koding integration by providing the running Koding instance URL
in Application Settings;
- Open **Admin area > Settings** (`/admin/application_settings`).
![Enable Koding](help/integration/img/koding_enable-koding.png)
Once enabled you will see `Koding` link on your sidebar which leads you to
Koding Landing page
![Koding Landing](help/integration/img/koding_landing.png)
You can navigate to running Koding instance from here. For more information and
details about configuring integration please follow [this](koding.md) guide.
# Set up Koding on Projects
Once it's enabled, you will see some integration buttons on Project pages,
Merge Requests etc. To get started working on a specific project you first need
to create a `.koding.yml` file under your project root. You can easily do that
by using `Set Up Koding` button which will be visible on every project's
landing page;
![Set Up Koding](help/integration/img/koding_set-up-ide.png)
Once you click this will open a New File page on GitLab with auto-generated
`.koding.yml` content based on your server and repository configuration.
![Commit .koding.yml](help/integration/img/koding_commit-koding.yml.png)
# Run a project on Koding
If there is `.koding.yml` exists in your project root, you will see
`Run in IDE (Koding)` button in your project landing page. You can initiate the
process from here.
![Run on Koding](help/integration/img/koding_run-in-ide.png)
This will open Koding defined in the settings in a new window and will start
importing the project's stack file;
![Import Stack](help/integration/img/koding_stack-import.png)
You should see the details of your repository imported into your Koding
instance. Once it's completed it will lead you to the Stack Editor and from
there you can start using your new stack integrated with your project on your
GitLab instance. For details about what's next you can follow
[this](https://www.koding.com/docs/creating-an-aws-stack) guide from 8. step.
Once stack initialized you will see the `README.md` content from your project
in `Stack Build` wizard, this wizard will let you to build the stack and import
your project into it. **Once it's completed it will automatically open the
related vm instead of importing from scratch**
![Stack Building](help/integration/img/koding_start-build.png)
This will take time depending on the required environment.
![Stack Building in Progress](help/integration/img/koding_build-in-progress.png)
It usually takes ~4 min. to make it ready with a `t2.nano` instance on given
AWS region. (`t2.nano` is default vm type on auto-generated stack template
which can be manually changed)
![Stack Building Success](help/integration/img/koding_build-success.png)
You can check out the `Build Logs` from this success modal as well;
![Stack Build Logs](help/integration/img/koding_build-logs.png)
You can now `Start Coding`!
![Edit On IDE](help/integration/img/koding_edit-on-ide.png)
# Try a Merge Request on IDE
It's also possible to try a change on IDE before merging it. This flow only
enabled if the target project has `.koding.yml` in it's target branch. You
should see the alternative version of `Run in IDE (Koding)` button in merge
request pages as well;
![Run in IDE on MR](help/integration/img/koding_run-mr-in-ide.png)
This will again take you to Koding with proper arguments passed, which will
allow Koding to modify the stack template provided by target branch. You can
see the difference;
![Different Branch for MR](help/integration/img/koding_different-stack-on-mr-try.png)
The flow for the branch stack is also same with the regular project flow.
# Open GitLab from Koding
Since stacks generated with import flow defined in previous steps, they have
information about the repository they are belonging to. By using this
information you can access to related GitLab page from stacks on your sidebar
on Koding.
![Open GitLab from Koding](help/integration/img/koding_open-gitlab-from-koding.png)
# Koding & GitLab
This document will guide you through installing and configuring Koding with
GitLab.
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](github.com/koding/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](https://git-scm.com)
- [docker](https://www.docker.com)
- [docker-compose](https://www.docker.com/products/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.
```bash
git clone https://github.com/koding/koding.git
cd koding
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
[here](https://gitlab.com/gitlab-org/gitlab-development-kit).
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 [xip.io](https://xip.io) service which is
free and provides DNS resolution to IP based requests like following;
- 127.0.0.1.xip.io -> resolves to 127.0.0.1
- foo.bar.baz.127.0.0.1.xip.io -> resolves to 127.0.0.1
- and so on...
As Koding needs subdomains for team names; `foo.127.0.0.1.xip.io` requests for
a running koding instance on `127.0.0.1` server will be handled as `foo` team
requests.
### 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 [http://127.0.0.1:3000/admin/application_settings](http://127.0.0.1:3000/admin/application_settings)
- 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
`gitlab`.
So, if your Koding is running on `http://1.2.3.4.xip.io:8090` your URL needs
to be `http://gitlab.1.2.3.4.xip.io:8090`. 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](http://docs.gitlab.com/ce/integration/oauth_provider.html) steps to
enable this integration.
Redirect URI should be `http://gitlab.127.0.0.1:8090/-/oauth/gitlab/callback`
which again you need to _replace `127.0.0.1` 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
[http://127.0.0.1:3000/admin/hooks](http://127.0.0.1:3000/admin/hooks)
and provide `URL` as `http://gitlab.127.0.0.1:8090/-/api/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 `127.0.0.1` 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;
```bash
cd koding
docker-compose run \
--service-ports backend \
/opt/koding/scripts/bootstrap-container build \
--host=**YOUR_IP**.xip.io \
--gitlabHost=**GITLAB_IP** \
--gitlabPort=**GITLAB_PORT** \
--gitlabToken=**SECRET_TOKEN** \
--gitlabAppId=**APPLICATION_ID** \
--gitlabAppSecret=**SECRET**
```
##### By updating configuration
Alternatively you can update `gitlab` section on
`config/credentials.default.coffee` 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`;
```bash
cd koding
docker-compose run \
--service-ports backend \
/opt/koding/scripts/bootstrap-container build \
--host=**YOUR_IP**.xip.io \
```
#### 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;
`http://gitlab.**YOUR_IP**.xip.io:8090/Home/my-account`
- 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.
...@@ -30,6 +30,7 @@ module Gitlab ...@@ -30,6 +30,7 @@ module Gitlab
signup_enabled: Settings.gitlab['signup_enabled'], signup_enabled: Settings.gitlab['signup_enabled'],
signin_enabled: Settings.gitlab['signin_enabled'], signin_enabled: Settings.gitlab['signin_enabled'],
gravatar_enabled: Settings.gravatar['enabled'], gravatar_enabled: Settings.gravatar['enabled'],
koding_enabled: false,
sign_in_text: nil, sign_in_text: nil,
after_sign_up_text: nil, after_sign_up_text: nil,
help_page_text: nil, help_page_text: nil,
......
...@@ -43,6 +43,20 @@ describe "Dashboard access", feature: true do ...@@ -43,6 +43,20 @@ describe "Dashboard access", feature: true do
it { is_expected.to be_allowed_for :visitor } it { is_expected.to be_allowed_for :visitor }
end end
describe "GET /koding" do
subject { koding_path }
context 'with Koding enabled' do
before do
stub_application_setting(koding_enabled?: true)
end
it { is_expected.to be_allowed_for :admin }
it { is_expected.to be_allowed_for :user }
it { is_expected.to be_denied_for :visitor }
end
end
describe "GET /projects/new" do describe "GET /projects/new" do
it { expect(new_project_path).to be_allowed_for :admin } it { expect(new_project_path).to be_allowed_for :admin }
it { expect(new_project_path).to be_allowed_for :user } it { expect(new_project_path).to be_allowed_for :user }
......
...@@ -122,6 +122,13 @@ describe HelpController, "routing" do ...@@ -122,6 +122,13 @@ describe HelpController, "routing" do
end end
end end
# koding GET /koding(.:format) koding#index
describe KodingController, "routing" do
it "to #index" do
expect(get("/koding")).to route_to('koding#index')
end
end
# profile_account GET /profile/account(.:format) profile#account # profile_account GET /profile/account(.:format) profile#account
# profile_history GET /profile/history(.:format) profile#history # profile_history GET /profile/history(.:format) profile#history
# profile_password PUT /profile/password(.:format) profile#password_update # profile_password PUT /profile/password(.:format) profile#password_update
......
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