Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evolutionary Improvements to Codenvy Installation #442

Closed
4 of 11 tasks
TylerJewell opened this issue Jul 23, 2016 · 1 comment
Closed
4 of 11 tasks

Evolutionary Improvements to Codenvy Installation #442

TylerJewell opened this issue Jul 23, 2016 · 1 comment
Assignees

Comments

@TylerJewell
Copy link
Contributor

TylerJewell commented Jul 23, 2016

This is a large tracking epic for a number of structural improvements that we will make to the Codenvy installation process to simplify it over time. Each item in the epic list can be taken individually and released in different milestones.

Codenvy Installation Dictionary

Stage                    | Tool to execute | Option to skip stage            | Issue
-------------------------------------------------------------------------------------
pre-flight check         | boostrap script | --skip-pre-flight-check         | #480
post-flight check        | che-test tool   | --skip-post-flight-check        | #479
post installation action | che-action tool | --skip-post-installation-action | 

Evolution of Codenvy to Dockerization

The objective is to run Codenvy and the Codenvy Manager entirely as a set of Docker containers. The new system could potentially be installed on top of a container orchestrator like OpenShift or Kubernetes. This will be a series of incremental steps that we need to take, each one potentially releaseable for testing. The challenging part of any migration is how to maintain configuration management control. The ability for a customer to define a set of properties and then for those properties to be enforced across a set of containers which may be running at a point in time.

For the purposes of this dialog:
a: We have Codenvy, which has dependencies like postgres, haproxy, gorouter.
b: We have puppet, which is the configuration management system.
c: We have the codenvy manager, aka IM, which is a Tomcat application on Java.
d: We have the bootstrap script, which is bash shell.
e: We have the curl launcher, which is a way to download & launch a bootstrap script.

1: Consolidate all of our databases into a single repository. This will make the installation of Codenvy faster, and potentially shrink the size of an image that contains Codenvy.

2: Package Codenvy, Puppet, and all of its dependencies into a single Docker image. The Codenvy Manager would install and run normally. Instead of installing puppet, it would - instead - launch a container that already has puppet + codenvy installed. It would then trigger some configuration, for which Codenvy would update itself. The database, project files, and product configuration would all be saved to the host through a volume mount. This would be for the single-node configuration only. As part of this exercise, we would change the bootstrap script to a) perform pre-flight checks, b) install and configure Docker, c) install and configure codenvy-manager, which d) then launches the codenvy container. In this scenario, configuration management is embedded entirely within the Codenvy container. Users that make configuration changes would have those configuration changes take affect within the container itself.

3: We would then investigate how additional Swarm nodes would could be launched as containers.

4: We would then investigate how the Codenvy Manager could be packaged as its own Docker container.

5: We would then investigate how we could have all configuration managed externally from the Codenvy container, so that any configuration can be applied to any version of Codenvy, and the Codenvy container accepts it.

6: We would then investigate how we could pull out HAProxy and Postgresql as containers that run independently of the Codenvy container. We would then need to investigate how we can support launching groups of containers collectively on top of Kubernetes and OpenShift.

Ignore: - Future: Contents of Bootstrap Script - Sets Up Host to Accept SSH Commands From Docker

#!/bin/bash
echo "Check if the public key exists in the authorized keys."
if [ -f /keys/id_rsa.pub ]; then
  grep -f /keys/id_rsa.pub /.ssh/authorized_keys
  if [ "$?" -eq "0" ]; then
    # The key exists and is in the authorized keys.
    exit 0
  fi
fi

echo "Generate a new key, if it does not exist"
if [ ! -f /keys/id_rsa.pub ]; then
  echo "Install the ssh-keygen command"
  apt-get update && apt-get install -y keychain && rm -rf /var/lib/apt/lists/*

  echo "Create an ssh key"
  ssh-keygen -f /keys/id_rsa -t rsa -N ''
fi

echo "Write the public key to the authorized keys file"
cat /keys/id_rsa.pub >> /.ssh/authorized_keys

Contents of Docker Container - Invokes SSH Commands Into Host

#!/bin/bash

# Probably have this baked into the container that is run
apt-get update && apt-get install -y ssh && rm -rf rm -rf /var/lib/apt/lists/*

# SSH to the host and then execute the "run_on_host.sh" script on the host
ssh -i /keys/id_rsa -o StrictHostKeyChecking=no root@<host-ip> 'bash -s' < /run_on_host.sh

# run_on_host.sh is a bash file that is included in the container
# the contents of that file will be executed as root on the host
@TylerJewell
Copy link
Contributor Author

Replaced dockerization epic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants