From 73142f41b20a4ad2de904ffbcf2434619b7261bc Mon Sep 17 00:00:00 2001 From: Tahir Jemal Date: Mon, 22 Jan 2024 08:46:12 +0200 Subject: [PATCH 1/2] Added documentation to deploy genieapp in Rahti2 --- .../deploying-to-Rahti2-uisngg-cli.md | 110 ++++++++++++ genieapp.yaml | 166 ++++++++++++++++++ 2 files changed, 276 insertions(+) create mode 100644 docs/src/openshift/deploying-to-Rahti2-uisngg-cli.md create mode 100644 genieapp.yaml diff --git a/docs/src/openshift/deploying-to-Rahti2-uisngg-cli.md b/docs/src/openshift/deploying-to-Rahti2-uisngg-cli.md new file mode 100644 index 0000000..9756f5f --- /dev/null +++ b/docs/src/openshift/deploying-to-Rahti2-uisngg-cli.md @@ -0,0 +1,110 @@ +# Deploying the Application via Command Line Interface in Rahti2 + +We can deploy our application via the OpenShift Command Line Interface (CLI). + +## Installing the Client + +Follow these steps to install the OpenShift CLI on a Linux system: + +### Step 1: Download the CLI Tool + +1. Navigate to the [OpenShift Container Platform downloads page](https://access.redhat.com/downloads/content) on the Red Hat Customer Portal. +2. In the Version drop-down menu, select the version that corresponds to your OpenShift Container Platform. +3. Find the "OpenShift v4.X Linux Client" entry and click "Download Now". Save the file to your computer. + +### Step 2: Unpack the Archive + +Unpack the downloaded file using the following command in your terminal: + +```bash +tar xvzf +``` + +Replace `` with the name of the downloaded file. + +### Step 3: Add `oc` to Your PATH + +1. Move the `oc` binary to a directory that is included in your system's PATH environment variable. +2. To check your current PATH, use: + + ```bash + echo $PATH + ``` + +### Step 4: Verify the Installation + +After installing, you can access the OpenShift CLI using the `oc` command. Verify the installation by executing: + +```bash +oc --help +``` + +## Login + +Let's login to OpenShift using the token obtained from the [Web User Interface](https://landing.2.rahti.csc.fi/). We recommend to keep the web user interface open if you want to see visually how your deployment is progressing. + +```bash +oc login --server=https://api.2.rahti.csc.fi:6443 --token= +``` + +## Creating a Project + +We denote the user defined parameters using variables. + +```bash +PROJECT="app" +``` + +We can create a new project. + +```bash +oc new-project $PROJECT +``` + +If a project already exists, we can change to existing project instead. + +```bash +oc project $PROJECT +``` + +We can list existing projects + +```bash +oc projects +``` + +We can show an overview of our current project. + +```bash +oc status +``` + +## Deploying the Application + +Create new application using the the configuration `genieapp.yaml` file. + +```bash +oc apply -f genieapp.yaml +``` + +## Troubleshooting + +If,during the deployment process, encounter an error similar to the following: + +``` +Precompiling project... +Killed +error: build error: error building at STEP "RUN julia -e "...compile(); "": error while running runtime: exit status 137 +``` + +To resolve this issue, increase the memory allocation for your deployment to at least 2Gi. Here's how you can do this in the `genieapp.yaml` file. + +Modify the memory allocation liek this: + +```yaml +resources: +limits: + memory: 2Gi +``` + +Apply the changes and deploy your application again using the updated configuration. diff --git a/genieapp.yaml b/genieapp.yaml new file mode 100644 index 0000000..9c72bcc --- /dev/null +++ b/genieapp.yaml @@ -0,0 +1,166 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + openshift.io/generated-by: OpenShiftNewApp + labels: + app: genieapp + app.kubernetes.io/component: genieapp + app.kubernetes.io/instance: genieapp + name: genieapp +spec: + ports: + - name: 8000-tcp + port: 8000 + protocol: TCP + targetPort: 8000 + selector: + app: genieapp + type: ClusterIP + +--- +apiVersion: apps.openshift.io/v1 +kind: DeploymentConfig +metadata: + annotations: + openshift.io/generated-by: OpenShiftNewApp + labels: + app: genieapp + app.kubernetes.io/component: genieapp + app.kubernetes.io/instance: genieapp + name: genieapp +spec: + replicas: 1 + selector: + app: genieapp + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: Rolling + template: + metadata: + annotations: + openshift.io/generated-by: OpenShiftNewApp + labels: + app: genieapp + spec: + containers: + - image: genieapp:latest + name: genieapp + ports: + - containerPort: 8000 + protocol: TCP + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - genieapp + from: + kind: ImageStreamTag + name: genieapp:latest + type: ImageChange + +--- +apiVersion: build.openshift.io/v1 +kind: BuildConfig +metadata: + annotations: + openshift.io/generated-by: OpenShiftNewApp + labels: + app: genieapp + app.kubernetes.io/component: genieapp + app.kubernetes.io/instance: genieapp + name: genieapp +spec: + resources: + limits: + memory: 1Gi + output: + to: + kind: ImageStreamTag + name: genieapp:latest + source: + git: + uri: https://github.com/csc-training/GenieWebApp.jl + type: Git + strategy: + dockerStrategy: + from: + kind: ImageStreamTag + name: julia:1.6-buster + type: Docker + triggers: + - type: ImageChange + - type: ConfigChange + - github: + secretReference: + name: webhooksecret + type: GitHub + +--- +apiVersion: image.openshift.io/v1 +kind: ImageStream +metadata: + annotations: + openshift.io/generated-by: OpenShiftNewApp + labels: + app: genieapp + app.kubernetes.io/component: genieapp + app.kubernetes.io/instance: genieapp + name: genieapp +spec: + lookupPolicy: + local: true + +--- +apiVersion: image.openshift.io/v1 +kind: ImageStream +metadata: + annotations: + openshift.io/generated-by: OpenShiftNewApp + labels: + app: genieapp + app.kubernetes.io/component: genieapp + app.kubernetes.io/instance: genieapp + name: julia +spec: + lookupPolicy: + local: false + tags: + - annotations: + openshift.io/imported-from: julia:1.6-buster + from: + kind: DockerImage + name: julia:1.6-buster + generation: 2 + importPolicy: + importMode: Legacy + name: 1.6-buster + referencePolicy: + type: Source + +--- +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + annotations: + openshift.io/host.generated: "true" + labels: + app: genieapp + app.kubernetes.io/component: genieapp + app.kubernetes.io/instance: genieapp + name: genieapp +spec: + host: "" + port: + targetPort: 8000-tcp + tls: + insecureEdgeTerminationPolicy: Redirect + termination: edge + to: + kind: Service + name: genieapp + weight: 100 + wildcardPolicy: None \ No newline at end of file From 54f458de62b2ebf49114dd8d49ea8b85a7050be4 Mon Sep 17 00:00:00 2001 From: Tahir Jemal Date: Mon, 22 Jan 2024 09:52:43 +0200 Subject: [PATCH 2/2] Rename file --- ...g-to-Rahti2-uisngg-cli.md => deploying-to-Rahti2-using-cli.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/src/openshift/{deploying-to-Rahti2-uisngg-cli.md => deploying-to-Rahti2-using-cli.md} (100%) diff --git a/docs/src/openshift/deploying-to-Rahti2-uisngg-cli.md b/docs/src/openshift/deploying-to-Rahti2-using-cli.md similarity index 100% rename from docs/src/openshift/deploying-to-Rahti2-uisngg-cli.md rename to docs/src/openshift/deploying-to-Rahti2-using-cli.md