Skip to content
This repository was archived by the owner on Aug 15, 2022. It is now read-only.

kloud: use metadata for deploying klient - #10935

Merged
cihangir merged 32 commits into
masterfrom
kloud-klient
Apr 5, 2017
Merged

cihangir merged 32 commits into
masterfrom
kloud-klient

Conversation

@rjeczalik

@rjeczalik rjeczalik commented Apr 3, 2017 •

Copy link
Copy Markdown
Contributor

This PR wires kloud/metadata with stack/provider, allowing kloud to deploy a klient service without a .deb builder dependency. Since the metadata provisioning method is generic, it allows kloud to build stacks on images other than Ubuntu 14.04.

The following distributions were tested:

  • RedHat 7.3
  • Suse 12 SP2
  • Ubuntu 16.04
  • Ubuntu 14.04
  • Amazon Linux

distros

A big todo here is to create here terraform tests, which could be integrated with CI to test such stacks. This is an ongoing effort to introduce integration testing for kloud, but outside the scope of this PR. I'm planning to fix it after finalising kd.io - then use kd for the testing.

Blockers:

@rjeczalik rjeczalik added the wip label Apr 3, 2017
@rjeczalik

rjeczalik commented Apr 3, 2017 •

Copy link
Copy Markdown
Contributor Author

Also it will be possible to use custom cloud-init script for the user_data field, so e.g. instead of injecting ssh keys with bash-fu, one can just create the following stack template:

provider:
  aws:
    access_key: '${var.aws_access_key}'
    secret_key: '${var.aws_secret_key}'
resource:
  aws_instance:
    aws-instance:
      instance_type: 't2.nano'
      ami: ''
      tags:
        Name: '${var.koding_user_username}-${var.koding_group_slug}'
      user_data: |
        #cloud-config
        ssh_authorized_keys:
          - ssh-rsa AAAAB3NzaC1yc2EA... koding-350298856
        runcmd:
          - echo "hello world!" >> /helloworld.txt

/cc @gokmen @szkl

@rjeczalik
rjeczalik force-pushed the kloud-klient branch 4 times, most recently from 2c71a76 to 29ba040 Compare April 4, 2017 06:49
@rjeczalik
rjeczalik force-pushed the kloud-klient branch 3 times, most recently from d86cd05 to 8c21e28 Compare April 4, 2017 21:20
Allows for overwriting default timeout for "Checking remote vm"
phase of building a stack - which is currently 5m.
// TODO(rjeczalik): make it configurable during ./configure = add to kites/config/config.json
var (
DefaultEntrypointBaseURL = "https://koding-klient.s3.amazonaws.com/entrypoint"
DefaultScreenURL = "https://koding-dl.s3.amazonaws.com/screen.tar.gz"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

//
// TODO(rjeczalik): make it configurable during ./configure = add to kites/config/config.json
var (
DefaultEntrypointBaseURL = "https://koding-klient.s3.amazonaws.com/entrypoint"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could utilize koding.com/s3 endpoint here or we could copy entrypoint to dl bucket and serve from there from now on

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, went with /s3.

if [ $${USE_EMBEDDED} -eq 1 ]; then
install_screen
elif type yum &>/dev/null; then
yum install --assumeyes screen

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we install a specific and tested version of screen otherwise we might have problems and it would be hard to debug since we wont have any idea on which version is installed. Even on AWS some of the images(same version) has different versions of tools.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


RUN apt-get update && apt-get install -y git build-essential ubuntu-dev-tools dh-make && apt-get clean && \
curl -sSL https://storage.googleapis.com/golang/go1.7.4.linux-amd64.tar.gz | tar -C /usr/local/ -zxf - && \
curl -sSL https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz | tar -C /usr/local/ -zxf - && \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we remove this dockerfile and use koding's base docker image? lets not maintain two images

cc/ @szkl

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW this Dockerfile is going away, once the deb builds are removed.

@codecov-io

codecov-io commented Apr 5, 2017 •

Copy link
Copy Markdown

Codecov Report

Merging #10935 into master will decrease coverage by <.1%.
The diff coverage is 0%.

@@            Coverage Diff            @@
##           master   #10935     +/-   ##
=========================================
- Coverage    30.9%    30.9%   -0.1%     
=========================================
  Files         100      100             
  Lines       11360    11323     -37     
=========================================
- Hits         3514     3500     -14     
+ Misses       7445     7423     -22     
+ Partials      401      400      -1

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 065870a...b514f00. Read the comment docs.

@rjeczalik

Copy link
Copy Markdown
Contributor Author

@cihangir All addressed, ptal.

func guessTerm() string {
terms := [][2]string{
{"xterm-256color", "/usr/share/terminfo/x/xterm-256color"},
{"xterm-256color", "/usr/share/terminfo/78/xterm-256color"},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

78 is the new answer to life the universe and everything

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact 78 is hex code for x - under Linux terminfo files are grouped in directories after the first letter, under macOS - after hex code value of the first letter.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants