Skip to content

Commit

Permalink
Add docs how to build Che server in Che workspace
Browse files Browse the repository at this point in the history
Signed-off-by: Mykola Morhun <[email protected]>
  • Loading branch information
mmorhun committed Aug 16, 2019
1 parent 09291a4 commit e91ca1b
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 59 deletions.
46 changes: 0 additions & 46 deletions .che-dev.yaml

This file was deleted.

41 changes: 40 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,5 +199,44 @@ $ yarn start --disable-host-check --public=$(echo ${server.dev-server} | sed -e
```

### Che server a.k.a WS master
There is a [devfile](https://github.com/eclipse/che/blob/master/devfile.yaml) for development of Che server in Che.
To build Che one may run a predefined build task from the devfile.

Starting Che master requires some manual steps.
Open a terminal in runtime container (`che-server-runtime`) and perform:
- First, set `CHE_HOME` environment variable with absolute path to parent folder of Che master's Tomcat.
It might look like `/projects/che/assembly/assembly-main/target/eclipse-che-*-SNAPSHOT/eclipse-che-*-SNAPSHOT`.
- Then set `CHE_HOST` with the endpoint of new Che master.
If using the [devfile](devfile.yaml) the endpoint is `che-dev` and already set.
- After, set `CHE_INFRASTRUCTURE_ACTIVE` according to your environment.
For example: `openshift` (note, use `kubernetes` and `openshift` insted of `minikube` and `minishift` correspondingly).
- Run `/entrypoint.sh`.
After this, new Che master should be accesible from the `che-dev` endpoint.
To reach Swagger use url from `che-dev` endpoint with `/swagger` suffix.

To start a workspace from Che server under development some additional configuration of the cluster is needed.
One should add rights for the service account to be able to perform all needed for Che server actions.
Example for Openshift (in case of Kubernetes replace `oc` with `kubectl`):
```bash
cat << EOF | oc apply -f -
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app: che
component: che
name: che-workspace-admin
namespace: che
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: admin
subjects:
- kind: ServiceAccount
name: che-workspace
namespace: che
EOF
```

To be provided soon.
Also `CHE_API_INTERNAL`, `CHE_API_EXTERNAL` and `CHE_API` should be set in runner container and point to new Che server API.
If one uses provided devfile, they are already set to: `http://che-dev:8080/api`, which should be changed in case of https protocol.
52 changes: 45 additions & 7 deletions devfile.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,57 @@
apiVersion: 1.0.0
metadata:
name: che-in-che
name: che-server-in-che
projects:
- name: che
source:
type: git
location: 'https://github.com/eclipse/che.git'
components:
- alias: che-dev
type: kubernetes
reference: .che-dev.yaml
- type: dockerimage
image: 'eclipse/che-dev:nightly'
alias: che-server-dev
mountSources: true
memoryLimit: 5Gi
volumes:
- name: maven
containerPath: /home/user/.m2
- type: dockerimage
image: 'eclipse/che-server:nightly'
alias: che-server-runtime
mountSources: true
memoryLimit: 1Gi
endpoints:
- name: che-dev
attributes:
discoverable: 'true'
public: 'true'
port: 8080
env:
- name: CHE_HOST
value: 'che-dev'
- name: CHE_API
value: http://che-dev:8080/api
- name: CHE_API_INTERNAL
value: http://che-dev:8080/api
- name: CHE_API_EXTERNAL
value: http://che-dev:8080/api
command:
- 'tail'
args:
- '-f'
- '/dev/null'
- type: chePlugin
id: redhat/java8/latest
commands:
- name: fastbuild
- name: build
actions:
- type: exec
component: che-dev
command: cd /projects/che && mvn clean install -Pnative -DskipTests=true
component: che-server-dev
command: mvn clean install -Pnative -DskipIntegrationTests
workdir: /projects/che
- name: build without tests
actions:
- type: exec
component: che-server-dev
command: mvn clean install -Pnative -DskipTests=true
workdir: /projects/che
15 changes: 10 additions & 5 deletions dockerfiles/che/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,17 @@ init() {
### Any variables with export is a value that native Tomcat che.sh startup script requires
export CHE_IP=${CHE_IP}

if [ -f "/assembly/tomcat/bin/catalina.sh" ]; then
echo "Found custom assembly..."
export CHE_HOME="/assembly"
if [ -z "$CHE_HOME" ]; then
if [ -f "/assembly/tomcat/bin/catalina.sh" ]; then
echo "Found custom assembly in /assembly"
export CHE_HOME="/assembly"
else
echo "Using embedded assembly."
export CHE_HOME=$(echo /home/user/eclipse-che/)
fi
else
echo "Using embedded assembly..."
export CHE_HOME=$(echo /home/user/eclipse-che/)
export CHE_HOME=$(echo ${CHE_HOME})
echo "Using custom assembly from $CHE_HOME"
fi

### We need to discover the host mount provided by the user for `/data`
Expand Down

0 comments on commit e91ca1b

Please sign in to comment.