Skip to content

Commit

Permalink
Merge pull request #1 from jemaltahir/master
Browse files Browse the repository at this point in the history
Added documentation to deploy genieapp in Rahti2
  • Loading branch information
jaantollander authored Jan 22, 2024
2 parents 7bdfc95 + 54f458d commit 8a51e47
Show file tree
Hide file tree
Showing 2 changed files with 276 additions and 0 deletions.
110 changes: 110 additions & 0 deletions docs/src/openshift/deploying-to-Rahti2-using-cli.md
Original file line number Diff line number Diff line change
@@ -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 <file>
```

Replace `<file>` 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=<hidden>
```

## 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.
166 changes: 166 additions & 0 deletions genieapp.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8a51e47

Please sign in to comment.