diff --git a/.che-dev.yaml b/.che-dev.yaml deleted file mode 100644 index 4f02ccc5121..00000000000 --- a/.che-dev.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -kind: List -items: - - apiVersion: v1 - kind: Pod - metadata: - name: ws - spec: - containers: - - name: dev - image: 'eclipse/che-dev:nightly' - resources: - limits: - memory: 5Gi - volumeMounts: - - mountPath: /projects - name: projects - - mountPath: /home/user/.m2 - name: maven - volumes: - - name: projects - persistentVolumeClaim: - claimName: projects - - name: maven - persistentVolumeClaim: - claimName: maven - - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: projects - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 2Gi - - apiVersion: v1 - kind: PersistentVolumeClaim - metadata: - name: maven - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 3Gi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2f00a3ebeff..b526a5d35bc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/devfile.yaml b/devfile.yaml index 86d5c3b0d7b..5f9d291f021 100644 --- a/devfile.yaml +++ b/devfile.yaml @@ -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 diff --git a/dockerfiles/che/entrypoint.sh b/dockerfiles/che/entrypoint.sh index efd25da767b..5216ef3d203 100755 --- a/dockerfiles/che/entrypoint.sh +++ b/dockerfiles/che/entrypoint.sh @@ -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`