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

Add docs how to build Che server in Che workspace #14181

Merged
merged 1 commit into from
Aug 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
mmorhun marked this conversation as resolved.
Show resolved Hide resolved
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.
mmorhun marked this conversation as resolved.
Show resolved Hide resolved
It might look like `/projects/che/assembly/assembly-main/target/eclipse-che-*-SNAPSHOT/eclipse-che-*-SNAPSHOT`.
mmorhun marked this conversation as resolved.
Show resolved Hide resolved
- 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.
mmorhun marked this conversation as resolved.
Show resolved Hide resolved
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
Copy link
Contributor

Choose a reason for hiding this comment

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

why we need 5GI here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just didn't touch the value...

Copy link
Contributor

Choose a reason for hiding this comment

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

3Gi should be enough

Copy link
Member

Choose a reason for hiding this comment

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

3Gi should be enough

I'm not sure but it looks realistic after removing wsagent code from Che repo,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tested - it isn't. Maybe we should play with build command more.

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